Changeset b1397ab in mainline for uspace/app/taskbar-cfg/smeedit.c
- Timestamp:
- 2023-11-09T13:02:16Z (6 months ago)
- Branches:
- master, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e0d874b7
- Parents:
- 40eab9f
- git-author:
- Jiri Svoboda <jiri@…> (2023-11-08 18:01:53)
- git-committer:
- Jiri Svoboda <jiri@…> (2023-11-09 13:02:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar-cfg/smeedit.c
r40eab9f rb1397ab 48 48 }; 49 49 50 static void smeedit_ok_clicked(ui_pbutton_t *, void *); 51 static void smeedit_cancel_clicked(ui_pbutton_t *, void *); 52 53 /** OK button callbacks */ 54 ui_pbutton_cb_t smeedit_ok_button_cb = { 55 .clicked = smeedit_ok_clicked 56 }; 57 58 /** Cancel button callbacks */ 59 ui_pbutton_cb_t smeedit_cancel_button_cb = { 60 .clicked = smeedit_cancel_clicked 61 }; 62 50 63 /** Window close button was clicked. 51 64 * … … 64 77 * 65 78 * @param smenu Start menu 79 * @param smentry Start menu entry to edit or @c NULL if creating 80 * a new entry 66 81 * @param rsmee Place to store pointer to new start menu entry edit window 67 82 * @return EOK on success or an error code 68 83 */ 69 errno_t smeedit_create(startmenu_t *smenu, smeedit_t **rsmee) 84 errno_t smeedit_create(startmenu_t *smenu, startmenu_entry_t *smentry, 85 smeedit_t **rsmee) 70 86 { 71 87 ui_wnd_params_t params; … … 75 91 gfx_rect_t rect; 76 92 ui_resource_t *res; 93 const char *cmd; 94 const char *caption; 77 95 errno_t rc; 78 96 79 97 ui = smenu->tbarcfg->ui; 98 99 if (smentry != NULL) { 100 cmd = smenu_entry_get_cmd(smentry->entry); 101 caption = smenu_entry_get_caption(smentry->entry); 102 } else { 103 cmd = ""; 104 caption = ""; 105 } 80 106 81 107 smee = calloc(1, sizeof(smeedit_t)); … … 85 111 } 86 112 113 smee->smentry = smentry; 114 87 115 ui_wnd_params_init(¶ms); 88 116 params.caption = "Edit Start Menu Entry"; … … 145 173 /* Command entry */ 146 174 147 rc = ui_entry_create(window, "foo", &smee->ecmd);175 rc = ui_entry_create(window, cmd, &smee->ecmd); 148 176 if (rc != EOK) 149 177 goto error; … … 199 227 /* Caption entry */ 200 228 201 rc = ui_entry_create(window, "bar", &smee->ecaption);229 rc = ui_entry_create(window, caption, &smee->ecaption); 202 230 if (rc != EOK) 203 231 goto error; … … 243 271 } 244 272 273 ui_pbutton_set_cb(smee->bok, &smeedit_ok_button_cb, (void *)smee); 245 274 ui_pbutton_set_rect(smee->bok, &rect); 246 275 ui_pbutton_set_default(smee->bok, true); … … 271 300 } 272 301 302 ui_pbutton_set_cb(smee->bcancel, &smeedit_cancel_button_cb, 303 (void *)smee); 273 304 ui_pbutton_set_rect(smee->bcancel, &rect); 274 305 … … 303 334 } 304 335 336 /** OK button clicked. 337 * 338 * @params bok OK button 339 * @params arg Argument (smeedit_t *) 340 */ 341 static void smeedit_ok_clicked(ui_pbutton_t *bok, void *arg) 342 { 343 smeedit_t *smee; 344 const char *cmd; 345 const char *caption; 346 errno_t rc; 347 348 (void)bok; 349 smee = (smeedit_t *)arg; 350 351 cmd = ui_entry_get_text(smee->ecmd); 352 caption = ui_entry_get_text(smee->ecaption); 353 354 rc = smenu_entry_set_cmd(smee->smentry->entry, cmd); 355 if (rc != EOK) 356 return; 357 358 smenu_entry_set_caption(smee->smentry->entry, caption); 359 if (rc != EOK) 360 return; 361 362 (void)smenu_entry_save(smee->smentry->entry); 363 364 smeedit_destroy(smee); 365 } 366 367 /** Cancel button clicked. 368 * 369 * @params bok OK button 370 * @params arg Argument (smeedit_t *) 371 */ 372 static void smeedit_cancel_clicked(ui_pbutton_t *bcancel, void *arg) 373 { 374 smeedit_t *smee; 375 376 (void)bcancel; 377 smee = (smeedit_t *)arg; 378 smeedit_destroy(smee); 379 } 380 305 381 /** @} 306 382 */
Note:
See TracChangeset
for help on using the changeset viewer.