Changeset f2cb80a in mainline for uspace/app/taskbar-cfg/smeedit.c
- Timestamp:
- 2024-02-23T17:57:23Z (11 months ago)
- Children:
- 192019f
- Parents:
- 86f862c (diff), 90ba06c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- boba-buba <120932204+boba-buba@…> (2024-02-23 17:57:23)
- git-committer:
- GitHub <noreply@…> (2024-02-23 17:57:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar-cfg/smeedit.c
r86f862c rf2cb80a 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #include <stdio.h> 37 37 #include <stdlib.h> 38 #include <ui/checkbox.h> 38 39 #include <ui/fixed.h> 39 40 #include <ui/resource.h> … … 94 95 const char *cmd; 95 96 const char *caption; 97 bool terminal; 96 98 errno_t rc; 97 99 … … 101 103 cmd = smenu_entry_get_cmd(smentry->entry); 102 104 caption = smenu_entry_get_caption(smentry->entry); 105 terminal = smenu_entry_get_terminal(smentry->entry); 103 106 } else { 104 107 cmd = ""; 105 108 caption = ""; 109 terminal = false; 106 110 } 107 111 … … 116 120 117 121 ui_wnd_params_init(¶ms); 118 params.caption = smentry != NULL ? "Edit Start Menu Entry" 119 :"Create Start Menu Entry";122 params.caption = smentry != NULL ? "Edit Start Menu Entry" : 123 "Create Start Menu Entry"; 120 124 if (ui_is_textmode(ui)) { 121 125 params.rect.p0.x = 0; 122 126 params.rect.p0.y = 0; 123 127 params.rect.p1.x = 50; 124 params.rect.p1.y = 1 2;128 params.rect.p1.y = 13; 125 129 } else { 126 130 params.rect.p0.x = 0; 127 131 params.rect.p0.y = 0; 128 132 params.rect.p1.x = 370; 129 params.rect.p1.y = 2 00;133 params.rect.p1.y = 230; 130 134 } 131 135 … … 255 259 } 256 260 261 /* Start in terminal checkbox */ 262 263 rc = ui_checkbox_create(res, "Start in terminal", &smee->cbterminal); 264 if (rc != EOK) 265 goto error; 266 267 /* FIXME: Auto layout */ 268 if (ui_is_textmode(ui)) { 269 rect.p0.x = 3; 270 rect.p0.y = 8; 271 rect.p1.x = 6; 272 rect.p1.y = 9; 273 } else { 274 rect.p0.x = 10; 275 rect.p0.y = 155; 276 rect.p1.x = 360; 277 rect.p1.y = 170; 278 } 279 280 ui_checkbox_set_rect(smee->cbterminal, &rect); 281 ui_checkbox_set_checked(smee->cbterminal, terminal); 282 283 rc = ui_fixed_add(smee->fixed, ui_checkbox_ctl(smee->cbterminal)); 284 if (rc != EOK) { 285 printf("Error adding control to layout.\n"); 286 goto error; 287 } 288 257 289 /* OK button */ 258 290 … … 264 296 if (ui_is_textmode(ui)) { 265 297 rect.p0.x = 23; 266 rect.p0.y = 9;298 rect.p0.y = 10; 267 299 rect.p1.x = 35; 268 rect.p1.y = 1 0;300 rect.p1.y = 11; 269 301 } else { 270 302 rect.p0.x = 190; 271 rect.p0.y = 1 55;303 rect.p0.y = 190; 272 304 rect.p1.x = 270; 273 rect.p1.y = 180;305 rect.p1.y = 215; 274 306 } 275 307 … … 293 325 if (ui_is_textmode(ui)) { 294 326 rect.p0.x = 36; 295 rect.p0.y = 9;327 rect.p0.y = 10; 296 328 rect.p1.x = 48; 297 rect.p1.y = 1 0;329 rect.p1.y = 11; 298 330 } else { 299 331 rect.p0.x = 280; 300 rect.p0.y = 1 55;332 rect.p0.y = 190; 301 333 rect.p1.x = 360; 302 rect.p1.y = 180;334 rect.p1.y = 215; 303 335 } 304 336 … … 345 377 { 346 378 smeedit_t *smee; 379 smenu_entry_t *entry; 380 startmenu_entry_t *smentry; 347 381 const char *cmd; 348 382 const char *caption; 383 bool terminal; 349 384 errno_t rc; 350 385 … … 354 389 cmd = ui_entry_get_text(smee->ecmd); 355 390 caption = ui_entry_get_text(smee->ecaption); 391 terminal = ui_checkbox_get_checked(smee->cbterminal); 356 392 357 393 if (smee->smentry == NULL) { 358 394 /* Create new entry */ 359 395 rc = smenu_entry_create(smee->startmenu->tbarcfg->tbarcfg, 360 caption, cmd );396 caption, cmd, terminal, &entry); 361 397 if (rc != EOK) 362 398 return; 399 400 rc = startmenu_insert(smee->startmenu, entry, &smentry); 401 if (rc != EOK) 402 return; 403 404 startmenu_repaint(smee->startmenu); 363 405 } else { 364 406 /* Edit existing entry */ 365 366 367 407 rc = smenu_entry_set_cmd(smee->smentry->entry, cmd); 368 408 if (rc != EOK) … … 370 410 371 411 smenu_entry_set_caption(smee->smentry->entry, caption); 412 if (rc != EOK) 413 return; 414 415 smenu_entry_set_terminal(smee->smentry->entry, terminal); 372 416 if (rc != EOK) 373 417 return;
Note:
See TracChangeset
for help on using the changeset viewer.