diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-02 10:02:16 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-02 10:02:16 +0200 |
commit | b9cdb34c59dc133b549deed5a4f3b9bb95197cca (patch) | |
tree | 1ed42fabfff17fe5d7d2c0ed4c8687f471df345d /src/ui/root.c | |
parent | f4942e1b4da6dc1334dcdb4f2daae670bfa1f813 (diff) |
Refactored CertListWidget out of the sidebar
The identity list is needed elsewhere outside of the sidebar, so moved it into a specialized ListWidget class.
Diffstat (limited to 'src/ui/root.c')
-rw-r--r-- | src/ui/root.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index f06ae842..5ed6b529 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -332,7 +332,8 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
332 | return iTrue; | 332 | return iTrue; |
333 | } | 333 | } |
334 | else if (equal_Command(cmd, "identmenu.open")) { | 334 | else if (equal_Command(cmd, "identmenu.open")) { |
335 | iWidget *button = findWidget_Root("navbar.ident"); | 335 | iWidget *toolBar = findWidget_Root("toolbar"); |
336 | iWidget *button = findWidget_Root(toolBar ? "toolbar.ident" : "navbar.ident"); | ||
336 | iArray items; | 337 | iArray items; |
337 | init_Array(&items, sizeof(iMenuItem)); | 338 | init_Array(&items, sizeof(iMenuItem)); |
338 | /* Current identity. */ | 339 | /* Current identity. */ |
@@ -375,16 +376,21 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
375 | (iMenuItem[]){ | 376 | (iMenuItem[]){ |
376 | { add_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" }, | 377 | { add_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" }, |
377 | { "${menu.identity.import}", SDLK_i, KMOD_PRIMARY | KMOD_SHIFT, "ident.import" }, | 378 | { "${menu.identity.import}", SDLK_i, KMOD_PRIMARY | KMOD_SHIFT, "ident.import" }, |
378 | { "---" }, | 379 | { "---" } }, 3); |
380 | if (deviceType_App() == desktop_AppDeviceType) { | ||
381 | pushBack_Array(&items, &(iMenuItem) | ||
379 | { isVisible_Widget(sidebar) && mode_SidebarWidget(sidebar) == identities_SidebarMode | 382 | { isVisible_Widget(sidebar) && mode_SidebarWidget(sidebar) == identities_SidebarMode |
380 | ? leftHalf_Icon " ${menu.hide.identities}" | 383 | ? leftHalf_Icon " ${menu.hide.identities}" |
381 | : leftHalf_Icon " ${menu.show.identities}", | 384 | : leftHalf_Icon " ${menu.show.identities}", |
382 | 0, | 385 | 0, |
383 | 0, | 386 | 0, |
384 | deviceType_App() == phone_AppDeviceType ? "toolbar.showident" | 387 | deviceType_App() == phone_AppDeviceType ? "toolbar.showident" |
385 | : "sidebar.mode arg:3 toggle:1" }, | 388 | : "sidebar.mode arg:3 toggle:1" }); |
386 | }, | 389 | } |
387 | 4); | 390 | else { |
391 | pushBack_Array(&items, &(iMenuItem){ gear_Icon " ${menu.identities}", 0, 0, | ||
392 | "toolbar.showident"}); | ||
393 | } | ||
388 | iWidget *menu = | 394 | iWidget *menu = |
389 | makeMenu_Widget(button, constData_Array(&items), size_Array(&items)); | 395 | makeMenu_Widget(button, constData_Array(&items), size_Array(&items)); |
390 | openMenu_Widget(menu, topLeft_Rect(bounds_Widget(button))); | 396 | openMenu_Widget(menu, topLeft_Rect(bounds_Widget(button))); |
@@ -1475,7 +1481,7 @@ void createUserInterface_Root(iRoot *d) { | |||
1475 | frameless_WidgetFlag), | 1481 | frameless_WidgetFlag), |
1476 | "toolbar.forward"); | 1482 | "toolbar.forward"); |
1477 | setId_Widget(addChildFlags_Widget(toolBar, | 1483 | setId_Widget(addChildFlags_Widget(toolBar, |
1478 | iClob(newLargeIcon_LabelWidget("\U0001f464", "toolbar.showident")), | 1484 | iClob(newLargeIcon_LabelWidget("\U0001f464", "identmenu.open")), |
1479 | frameless_WidgetFlag), | 1485 | frameless_WidgetFlag), |
1480 | "toolbar.ident"); | 1486 | "toolbar.ident"); |
1481 | setId_Widget(addChildFlags_Widget(toolBar, | 1487 | setId_Widget(addChildFlags_Widget(toolBar, |