Changeset ee3b28a9 in mainline for uspace/app
- Timestamp:
- 2024-02-26T13:30:48Z (20 months ago)
- Branches:
- master
- Children:
- d92b8e8f
- Parents:
- 90ba06c
- git-author:
- Jiri Svoboda <jiri@…> (2024-02-25 16:12:29)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-02-26 13:30:48)
- Location:
- uspace/app
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar-cfg/smeedit.c
r90ba06c ree3b28a9 403 403 404 404 startmenu_repaint(smee->startmenu); 405 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 405 406 } else { 406 407 /* Edit existing entry */ … … 419 420 (void)smenu_entry_save(smee->smentry->entry); 420 421 startmenu_entry_update(smee->smentry); 422 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 421 423 } 422 424 -
uspace/app/taskbar-cfg/startmenu.c
r90ba06c ree3b28a9 515 515 516 516 (void)smee; 517 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 517 518 } 518 519 … … 533 534 (void)startmenu_insert(smenu, entry, &smentry); 534 535 (void)ui_control_paint(ui_list_ctl(smenu->entries_list)); 536 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 535 537 } 536 538 … … 633 635 free(smentry); 634 636 (void)ui_control_paint(ui_list_ctl(smenu->entries_list)); 637 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 635 638 } 636 639 … … 685 688 686 689 (void)ui_control_paint(ui_list_ctl(smenu->entries_list)); 690 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 687 691 } 688 692 … … 711 715 712 716 (void)ui_control_paint(ui_list_ctl(smenu->entries_list)); 717 (void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT); 713 718 } 714 719 -
uspace/app/taskbar/taskbar.c
r90ba06c ree3b28a9 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 48 48 #include "wndlist.h" 49 49 50 #define TASKBAR_CONFIG_FILE "/cfg/taskbar.sif" 51 50 52 static void taskbar_wnd_close(ui_window_t *, void *); 51 53 static void taskbar_wnd_kbd(ui_window_t *, void *, kbd_event_t *); 52 54 static void taskbar_wnd_pos(ui_window_t *, void *, pos_event_t *); 55 static void taskbar_notif_cb(void *); 53 56 54 57 static ui_window_cb_t window_cb = { … … 201 204 } 202 205 203 rc = tbsmenu_load(taskbar->tbsmenu, "/cfg/taskbar.sif");206 rc = tbsmenu_load(taskbar->tbsmenu, TASKBAR_CONFIG_FILE); 204 207 if (rc != EOK) { 205 208 printf("Error loading start menu from '%s'.\n", 206 "/cfg/taskbar.sif"); 209 TASKBAR_CONFIG_FILE); 210 } 211 212 rc = tbarcfg_listener_create(TBARCFG_NOTIFY_DEFAULT, 213 taskbar_notif_cb, (void *)taskbar, &taskbar->lst); 214 if (rc != EOK) { 215 printf("Error listening for configuration changes.\n"); 207 216 } 208 217 … … 287 296 return EOK; 288 297 error: 298 if (taskbar->lst != NULL) 299 tbarcfg_listener_destroy(taskbar->lst); 289 300 if (taskbar->clock != NULL) 290 301 taskbar_clock_destroy(taskbar->clock); … … 304 315 void taskbar_destroy(taskbar_t *taskbar) 305 316 { 317 if (taskbar->lst != NULL) 318 tbarcfg_listener_destroy(taskbar->lst); 306 319 ui_fixed_remove(taskbar->fixed, taskbar_clock_ctl(taskbar->clock)); 307 320 taskbar_clock_destroy(taskbar->clock); … … 312 325 } 313 326 327 /** Configuration change notification callback. 328 * 329 * Called when configuration changed. 330 * 331 * @param arg Argument (taskbar_t *) 332 */ 333 static void taskbar_notif_cb(void *arg) 334 { 335 taskbar_t *taskbar = (taskbar_t *)arg; 336 337 ui_lock(taskbar->ui); 338 tbsmenu_reload(taskbar->tbsmenu); 339 ui_unlock(taskbar->ui); 340 } 341 314 342 /** @} 315 343 */ -
uspace/app/taskbar/tbsmenu.c
r90ba06c ree3b28a9 135 135 errno_t rc; 136 136 137 if (tbsmenu->repopath != NULL) 138 free(tbsmenu->repopath); 139 140 tbsmenu->repopath = str_dup(repopath); 141 if (tbsmenu->repopath == NULL) 142 return ENOMEM; 143 144 /* Remove existing entries */ 145 tentry = tbsmenu_first(tbsmenu); 146 while (tentry != NULL) { 147 tbsmenu_remove(tbsmenu, tentry, false); 148 tentry = tbsmenu_first(tbsmenu); 149 } 150 137 151 rc = tbarcfg_open(repopath, &tbcfg); 138 152 if (rc != EOK) … … 170 184 } 171 185 186 /** Reload start menu from repository (or schedule reload). 187 * 188 * @param tbsmenu Start menu 189 */ 190 void tbsmenu_reload(tbsmenu_t *tbsmenu) 191 { 192 if (!tbsmenu_is_open(tbsmenu)) 193 (void) tbsmenu_load(tbsmenu, tbsmenu->repopath); 194 else 195 tbsmenu->needs_reload = true; 196 } 197 172 198 /** Set start menu rectangle. 173 199 * … … 198 224 { 199 225 ui_menu_close(tbsmenu->smenu); 226 227 if (tbsmenu->needs_reload) 228 (void) tbsmenu_load(tbsmenu, tbsmenu->repopath); 200 229 } 201 230 -
uspace/app/taskbar/tbsmenu.h
r90ba06c ree3b28a9 48 48 extern errno_t tbsmenu_create(ui_window_t *, ui_fixed_t *, tbsmenu_t **); 49 49 extern errno_t tbsmenu_load(tbsmenu_t *, const char *); 50 extern void tbsmenu_reload(tbsmenu_t *); 50 51 extern void tbsmenu_set_rect(tbsmenu_t *, gfx_rect_t *); 51 52 extern void tbsmenu_open(tbsmenu_t *); -
uspace/app/taskbar/types/taskbar.h
r90ba06c ree3b28a9 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 60 60 /** Clock */ 61 61 taskbar_clock_t *clock; 62 /** Configuration change listener */ 63 tbarcfg_listener_t *lst; 62 64 } taskbar_t; 63 65 -
uspace/app/taskbar/types/tbsmenu.h
r90ba06c ree3b28a9 40 40 #include <gfx/coord.h> 41 41 #include <stdbool.h> 42 #include <tbarcfg/tbarcfg.h> 42 43 #include <ui/pbutton.h> 43 44 #include <ui/fixed.h> … … 84 85 /** Device ID of last input event */ 85 86 sysarg_t ev_idev_id; 87 88 /** Repository path name */ 89 char *repopath; 90 91 /** Need to reload menu when possible */ 92 bool needs_reload; 86 93 } tbsmenu_t; 87 94
Note:
See TracChangeset
for help on using the changeset viewer.