Changeset 5e758e4 in mainline
- Timestamp:
- 2023-11-19T12:22:11Z (13 months ago)
- Branches:
- master, topic/simplify-dev-export
- Children:
- 69935a8
- Parents:
- e8a6279f
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar-cfg/smeedit.c
re8a6279f r5e758e4 41 41 #include "taskbar-cfg.h" 42 42 #include "smeedit.h" 43 #include "startmenu.h" 43 44 44 45 static void wnd_close(ui_window_t *, void *); … … 111 112 } 112 113 114 smee->startmenu = smenu; 113 115 smee->smentry = smentry; 114 116 … … 361 363 362 364 (void)smenu_entry_save(smee->smentry->entry); 363 365 startmenu_entry_update(smee->smentry); 364 366 smeedit_destroy(smee); 365 367 } -
uspace/app/taskbar-cfg/startmenu.c
re8a6279f r5e758e4 398 398 } 399 399 400 /** Update start menu entry caption. 401 * 402 * When editing an entry the entry's label might change. We need 403 * to update the list entry caption to reflect that. 404 * 405 * @param entry Start menu entry 406 */ 407 errno_t startmenu_entry_update(startmenu_entry_t *entry) 408 { 409 return ui_list_entry_set_caption(entry->lentry, 410 smenu_entry_get_caption(entry->entry)); 411 } 412 400 413 /** Entry in entry list is selected. 401 414 * -
uspace/app/taskbar-cfg/startmenu.h
re8a6279f r5e758e4 48 48 extern startmenu_entry_t *startmenu_get_selected(startmenu_t *); 49 49 extern void startmenu_edit(startmenu_t *); 50 extern errno_t startmenu_entry_update(startmenu_entry_t *); 50 51 51 52 #endif -
uspace/lib/ui/include/ui/list.h
re8a6279f r5e758e4 60 60 extern void *ui_list_entry_get_arg(ui_list_entry_t *); 61 61 extern ui_list_t *ui_list_entry_get_list(ui_list_entry_t *); 62 extern errno_t ui_list_entry_set_caption(ui_list_entry_t *, const char *); 62 63 extern size_t ui_list_entries_cnt(ui_list_t *); 63 64 extern errno_t ui_list_sort(ui_list_t *); -
uspace/lib/ui/src/list.c
re8a6279f r5e758e4 800 800 } 801 801 802 /** Change list entry caption. 803 * 804 * @param entry UI list entry 805 * @param caption New caption 806 * 807 * @return EOK on success, ENOMEM if out of memory 808 */ 809 errno_t ui_list_entry_set_caption(ui_list_entry_t *entry, const char *caption) 810 { 811 char *dcaption; 812 813 dcaption = str_dup(caption); 814 if (dcaption == NULL) 815 return ENOMEM; 816 817 free(entry->caption); 818 entry->caption = dcaption; 819 820 (void)ui_list_entry_paint(entry, ui_list_entry_get_idx(entry)); 821 return EOK; 822 } 823 802 824 /** Clear UI list entry list. 803 825 * -
uspace/lib/ui/test/list.c
re8a6279f r5e758e4 1039 1039 } 1040 1040 1041 /** ui_list_entry_set_caption() sets entry captino */ 1042 PCUT_TEST(entry_set_caption) 1043 { 1044 ui_t *ui; 1045 ui_window_t *window; 1046 ui_wnd_params_t params; 1047 ui_list_t *list; 1048 ui_list_entry_attr_t attr; 1049 ui_list_entry_t *entry; 1050 errno_t rc; 1051 1052 rc = ui_create_disp(NULL, &ui); 1053 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1054 1055 ui_wnd_params_init(¶ms); 1056 params.caption = "Test"; 1057 1058 rc = ui_window_create(ui, ¶ms, &window); 1059 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1060 1061 rc = ui_list_create(window, true, &list); 1062 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1063 1064 ui_list_entry_attr_init(&attr); 1065 1066 /* Append entry and get pointer to it */ 1067 attr.caption = "a"; 1068 attr.arg = (void *)1; 1069 entry = NULL; 1070 rc = ui_list_entry_append(list, &attr, &entry); 1071 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1072 PCUT_ASSERT_NOT_NULL(entry); 1073 1074 /* Change caption */ 1075 rc = ui_list_entry_set_caption(entry, "b"); 1076 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1077 PCUT_ASSERT_STR_EQUALS("b", entry->caption); 1078 1079 ui_list_destroy(list); 1080 ui_window_destroy(window); 1081 ui_destroy(ui); 1082 } 1083 1041 1084 /** ui_list_entries_cnt() returns the number of entries */ 1042 1085 PCUT_TEST(entries_cnt)
Note:
See TracChangeset
for help on using the changeset viewer.