Changes in uspace/app/taskbar/taskbar.c [d92b8e8f:82d3c28] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar/taskbar.c
rd92b8e8f r82d3c28 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2023 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 52 50 static void taskbar_wnd_close(ui_window_t *, void *); 53 51 static void taskbar_wnd_kbd(ui_window_t *, void *, kbd_event_t *); 54 52 static void taskbar_wnd_pos(ui_window_t *, void *, pos_event_t *); 55 static void taskbar_notif_cb(void *);56 53 57 54 static ui_window_cb_t window_cb = { … … 131 128 gfx_rect_t scr_rect; 132 129 gfx_rect_t rect; 133 char *dspec = NULL;134 char *qmark;135 130 errno_t rc; 136 131 137 132 taskbar = calloc(1, sizeof(taskbar_t)); 138 133 if (taskbar == NULL) { 139 printf("Out of memory.\n");140 134 rc = ENOMEM; 141 135 goto error; 142 136 } 143 144 dspec = str_dup(display_spec);145 if (dspec == NULL) {146 printf("Out of memory.\n");147 rc = ENOMEM;148 goto error;149 }150 151 /* Remove additional arguments */152 qmark = str_chr(dspec, '?');153 if (qmark != NULL)154 *qmark = '\0';155 137 156 138 rc = ui_create(display_spec, &taskbar->ui); … … 213 195 } 214 196 215 rc = tbsmenu_create(taskbar->window, taskbar->fixed, dspec, 216 &taskbar->tbsmenu); 197 rc = tbsmenu_create(taskbar->window, taskbar->fixed, &taskbar->tbsmenu); 217 198 if (rc != EOK) { 218 199 printf("Error creating start menu.\n"); … … 220 201 } 221 202 222 rc = tbsmenu_load(taskbar->tbsmenu, TASKBAR_CONFIG_FILE);203 rc = tbsmenu_load(taskbar->tbsmenu, "/cfg/taskbar.sif"); 223 204 if (rc != EOK) { 224 205 printf("Error loading start menu from '%s'.\n", 225 TASKBAR_CONFIG_FILE); 226 } 227 228 rc = tbarcfg_listener_create(TBARCFG_NOTIFY_DEFAULT, 229 taskbar_notif_cb, (void *)taskbar, &taskbar->lst); 230 if (rc != EOK) { 231 printf("Error listening for configuration changes.\n"); 206 "/cfg/taskbar.sif"); 232 207 } 233 208 … … 309 284 } 310 285 311 free(dspec);312 286 *rtaskbar = taskbar; 313 287 return EOK; 314 288 error: 315 if (dspec != NULL)316 free(dspec);317 if (taskbar->lst != NULL)318 tbarcfg_listener_destroy(taskbar->lst);319 289 if (taskbar->clock != NULL) 320 290 taskbar_clock_destroy(taskbar->clock); … … 327 297 if (taskbar->ui != NULL) 328 298 ui_destroy(taskbar->ui); 329 free(taskbar);330 299 return rc; 331 300 … … 335 304 void taskbar_destroy(taskbar_t *taskbar) 336 305 { 337 if (taskbar->lst != NULL)338 tbarcfg_listener_destroy(taskbar->lst);339 306 ui_fixed_remove(taskbar->fixed, taskbar_clock_ctl(taskbar->clock)); 340 307 taskbar_clock_destroy(taskbar->clock); … … 345 312 } 346 313 347 /** Configuration change notification callback.348 *349 * Called when configuration changed.350 *351 * @param arg Argument (taskbar_t *)352 */353 static void taskbar_notif_cb(void *arg)354 {355 taskbar_t *taskbar = (taskbar_t *)arg;356 357 ui_lock(taskbar->ui);358 tbsmenu_reload(taskbar->tbsmenu);359 ui_unlock(taskbar->ui);360 }361 362 314 /** @} 363 315 */
Note:
See TracChangeset
for help on using the changeset viewer.