Changeset dcd8214 in mainline


Ignore:
Timestamp:
2023-11-02T08:58:21Z (13 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
40eab9f
Parents:
3e05a69
git-author:
Jiri Svoboda <jiri@…> (2023-11-01 18:58:03)
git-committer:
Jiri Svoboda <jiri@…> (2023-11-02 08:58:21)
Message:

Add dialog window for editing start menu entry

Note it does not do anything yet.

Location:
uspace/app/taskbar-cfg
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar-cfg/meson.build

    r3e05a69 rdcd8214  
    3131        'taskbar-cfg.c',
    3232        'main.c',
     33        'smeedit.c',
    3334        'startmenu.c'
    3435)
  • uspace/app/taskbar-cfg/startmenu.c

    r3e05a69 rdcd8214  
    4646#include <ui/tab.h>
    4747#include <ui/window.h>
     48#include "smeedit.h"
    4849#include "startmenu.h"
    4950#include "taskbar-cfg.h"
     
    5253static void startmenu_new_entry_clicked(ui_pbutton_t *, void *);
    5354static void startmenu_delete_entry_clicked(ui_pbutton_t *, void *);
     55static void startmenu_edit_entry_clicked(ui_pbutton_t *, void *);
    5456
    5557/** Entry list callbacks */
     
    6365};
    6466
    65 /** Remove seat button callbacks */
     67/** Delete entry button callbacks */
    6668ui_pbutton_cb_t startmenu_delete_entry_button_cb = {
    6769        .clicked = startmenu_delete_entry_clicked
     70};
     71
     72/** Edit entry button callbacks */
     73ui_pbutton_cb_t startmenu_edit_entry_button_cb = {
     74        .clicked = startmenu_edit_entry_clicked
    6875};
    6976
     
    163170            (void *)smenu);
    164171
    165         /* 'New Entry' button */
     172        /* New entry button */
    166173
    167174        rc = ui_pbutton_create(ui_res, "New...", &smenu->new_entry);
     
    194201            (void *)smenu);
    195202
    196         /* 'Delete Entry' button */
     203        /* Delete entry button */
    197204
    198205        rc = ui_pbutton_create(ui_res, "Delete", &smenu->delete_entry);
     
    224231        ui_pbutton_set_cb(smenu->delete_entry,
    225232            &startmenu_delete_entry_button_cb, (void *)smenu);
     233
     234        /* Edit entry button */
     235
     236        rc = ui_pbutton_create(ui_res, "Edit...", &smenu->edit_entry);
     237        if (rc != EOK) {
     238                printf("Error creating button.\n");
     239                goto error;
     240        }
     241
     242        if (ui_resource_is_textmode(ui_res)) {
     243                rect.p0.x = 58;
     244                rect.p0.y = 9;
     245                rect.p1.x = 68;
     246                rect.p1.y = 10;
     247        } else {
     248                rect.p0.x = 370;
     249                rect.p0.y = 140;
     250                rect.p1.x = 450;
     251                rect.p1.y = 165;
     252        }
     253
     254        ui_pbutton_set_rect(smenu->edit_entry, &rect);
     255
     256        rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->edit_entry));
     257        if (rc != EOK) {
     258                printf("Error adding control to layout.\n");
     259                goto error;
     260        }
     261
     262        ui_pbutton_set_cb(smenu->edit_entry,
     263            &startmenu_edit_entry_button_cb, (void *)smenu);
    226264
    227265        ui_tab_add(smenu->tab, ui_fixed_ctl(smenu->fixed));
     
    346384}
    347385
     386/** Edit selected menu entry.
     387 *
     388 * @param smenu Start menu
     389 */
     390void startmenu_edit(startmenu_t *smenu)
     391{
     392        smeedit_t *smee;
     393        errno_t rc;
     394
     395        rc = smeedit_create(smenu, &smee);
     396        if (rc != EOK)
     397                return;
     398
     399        (void)smee;
     400}
     401
    348402/** Entry in entry list is selected.
    349403 *
     
    357411}
    358412
    359 /** New Entry' button clicked.
     413/** New entry button clicked.
    360414 *
    361415 * @param pbutton Push button
    362  * @param arg Argument (dcfg_seats_entry_t *)
     416 * @param arg Argument (startmenu_t *)
    363417 */
    364418static void startmenu_new_entry_clicked(ui_pbutton_t *pbutton, void *arg)
     
    368422}
    369423
    370 /** "Delete Entry' button clicked.
     424/** Delete entry button clicked.
    371425 *
    372426 * @param pbutton Push button
    373  * @param arg Argument (dcfg_seats_entry_t *)
     427 * @param arg Argument (startmenu_t *)
    374428 */
    375429static void startmenu_delete_entry_clicked(ui_pbutton_t *pbutton, void *arg)
     
    379433}
    380434
     435/** Edit entry button clicked.
     436 *
     437 * @param pbutton Push button
     438 * @param arg Argument (startmenu_t *)
     439 */
     440static void startmenu_edit_entry_clicked(ui_pbutton_t *pbutton, void *arg)
     441{
     442        startmenu_t *smenu = (startmenu_t *)arg;
     443
     444        (void)pbutton;
     445        startmenu_edit(smenu);
     446}
     447
    381448/** @}
    382449 */
  • uspace/app/taskbar-cfg/startmenu.h

    r3e05a69 rdcd8214  
    4646extern errno_t startmenu_insert(startmenu_t *, const char *, const char *,
    4747    startmenu_entry_t **);
     48extern void startmenu_edit(startmenu_t *);
    4849
    4950#endif
Note: See TracChangeset for help on using the changeset viewer.