summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/sidebarwidget.c39
-rw-r--r--src/ui/window.c6
2 files changed, 38 insertions, 7 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 2120b1e1..b865679e 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -94,6 +94,7 @@ struct Impl_SidebarWidget {
94 iString cmdPrefix; 94 iString cmdPrefix;
95 iWidget * blank; 95 iWidget * blank;
96 iListWidget * list; 96 iListWidget * list;
97 iWidget * actions; /* below the list, area for buttons */
97 int modeScroll[max_SidebarMode]; 98 int modeScroll[max_SidebarMode];
98 iLabelWidget * modeButtons[max_SidebarMode]; 99 iLabelWidget * modeButtons[max_SidebarMode];
99 int maxButtonLabelWidth; 100 int maxButtonLabelWidth;
@@ -134,6 +135,8 @@ static int cmpTitle_Bookmark_(const iBookmark **a, const iBookmark **b) {
134static void updateItems_SidebarWidget_(iSidebarWidget *d) { 135static void updateItems_SidebarWidget_(iSidebarWidget *d) {
135 clear_ListWidget(d->list); 136 clear_ListWidget(d->list);
136 releaseChildren_Widget(d->blank); 137 releaseChildren_Widget(d->blank);
138 releaseChildren_Widget(d->actions);
139 d->actions->rect.size.y = 0;
137 destroy_Widget(d->menu); 140 destroy_Widget(d->menu);
138 d->menu = NULL; 141 d->menu = NULL;
139 switch (d->mode) { 142 switch (d->mode) {
@@ -338,6 +341,12 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
338 break; 341 break;
339 } 342 }
340 case identities_SidebarMode: { 343 case identities_SidebarMode: {
344 /* Actions. */ {
345 checkIcon_LabelWidget(addChild_Widget(
346 d->actions, iClob(new_LabelWidget(add_Icon " New...", "ident.new"))));
347 checkIcon_LabelWidget(addChild_Widget(
348 d->actions, iClob(new_LabelWidget("Import...", "ident.import"))));
349 }
341 const iString *tabUrl = url_DocumentWidget(document_App()); 350 const iString *tabUrl = url_DocumentWidget(document_App());
342 iConstForEach(PtrArray, i, identities_GmCerts(certs_App())) { 351 iConstForEach(PtrArray, i, identities_GmCerts(certs_App())) {
343 const iGmIdentity *ident = i.ptr; 352 const iGmIdentity *ident = i.ptr;
@@ -426,8 +435,19 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
426 uiBackgroundSidebar_ColorId); 435 uiBackgroundSidebar_ColorId);
427 addChild_Widget(d->blank, iClob(div)); 436 addChild_Widget(d->blank, iClob(div));
428 } 437 }
429 arrange_Widget(d->blank); 438// arrange_Widget(d->blank);
439 }
440 if (deviceType_App() != desktop_AppDeviceType) {
441 /* Touch-friendly action buttons. */
442 iForEach(ObjectList, i, children_Widget(d->actions)) {
443 if (isInstance_Object(i.object, &Class_LabelWidget)) {
444 setPadding_Widget(i.object, 0, gap_UI, 0, gap_UI);
445 setFont_LabelWidget(i.object, defaultBig_FontId);
446 }
447 }
430 } 448 }
449 arrange_Widget(d->actions);
450 arrange_Widget(as_Widget(d));
431} 451}
432 452
433static void updateItemHeight_SidebarWidget_(iSidebarWidget *d) { 453static void updateItemHeight_SidebarWidget_(iSidebarWidget *d) {
@@ -557,9 +577,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) {
557 resizeWidthOfChildren_WidgetFlag | 577 resizeWidthOfChildren_WidgetFlag |
558 arrangeHeight_WidgetFlag | resizeToParentWidth_WidgetFlag | 578 arrangeHeight_WidgetFlag | resizeToParentWidth_WidgetFlag |
559 drawBackgroundToHorizontalSafeArea_WidgetFlag); 579 drawBackgroundToHorizontalSafeArea_WidgetFlag);
560// if (deviceType_App() == phone_AppDeviceType) {
561 setBackgroundColor_Widget(buttons, uiBackgroundSidebar_ColorId); 580 setBackgroundColor_Widget(buttons, uiBackgroundSidebar_ColorId);
562 // }
563 } 581 }
564 else { 582 else {
565 iLabelWidget *heading = new_LabelWidget(person_Icon " ${sidebar.identities}", NULL); 583 iLabelWidget *heading = new_LabelWidget(person_Icon " ${sidebar.identities}", NULL);
@@ -567,14 +585,25 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) {
567 setBackgroundColor_Widget(as_Widget(heading), uiBackgroundSidebar_ColorId); 585 setBackgroundColor_Widget(as_Widget(heading), uiBackgroundSidebar_ColorId);
568 setTextColor_LabelWidget(heading, uiTextSelected_ColorId); 586 setTextColor_LabelWidget(heading, uiTextSelected_ColorId);
569 setFont_LabelWidget(addChildFlags_Widget(vdiv, iClob(heading), borderTop_WidgetFlag | 587 setFont_LabelWidget(addChildFlags_Widget(vdiv, iClob(heading), borderTop_WidgetFlag |
570 alignLeft_WidgetFlag | frameless_WidgetFlag), 588 alignLeft_WidgetFlag | frameless_WidgetFlag |
589 drawBackgroundToHorizontalSafeArea_WidgetFlag),
571 uiLabelLargeBold_FontId); 590 uiLabelLargeBold_FontId);
572 } 591 }
573 iWidget *content = new_Widget(); 592 iWidget *content = new_Widget();
574 setFlags_Widget(content, resizeChildren_WidgetFlag, iTrue); 593 setFlags_Widget(content, resizeChildren_WidgetFlag, iTrue);
594 iWidget *listAndActions = makeVDiv_Widget();
595 addChild_Widget(content, iClob(listAndActions));
575 d->list = new_ListWidget(); 596 d->list = new_ListWidget();
576 setPadding_Widget(as_Widget(d->list), 0, gap_UI, 0, gap_UI); 597 setPadding_Widget(as_Widget(d->list), 0, gap_UI, 0, gap_UI);
577 addChildFlags_Widget(content, iClob(d->list), drawBackgroundToHorizontalSafeArea_WidgetFlag); 598 addChildFlags_Widget(listAndActions,
599 iClob(d->list),
600 expand_WidgetFlag | drawBackgroundToHorizontalSafeArea_WidgetFlag);
601 addChildFlags_Widget(listAndActions, iClob(d->actions = new_Widget()),
602 arrangeHorizontal_WidgetFlag |
603 arrangeHeight_WidgetFlag |
604 resizeWidthOfChildren_WidgetFlag |
605 drawBackgroundToHorizontalSafeArea_WidgetFlag);
606 setBackgroundColor_Widget(d->actions, uiBackground_ColorId);
578 d->contextItem = NULL; 607 d->contextItem = NULL;
579 d->blank = new_Widget(); 608 d->blank = new_Widget();
580 addChildFlags_Widget(content, iClob(d->blank), resizeChildren_WidgetFlag); 609 addChildFlags_Widget(content, iClob(d->blank), resizeChildren_WidgetFlag);
diff --git a/src/ui/window.c b/src/ui/window.c
index 3ea45695..5ebebf1c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -502,8 +502,10 @@ static void updatePadding_Window_(iWindow *d) {
502 } 502 }
503 } 503 }
504 if (toolBar) { 504 if (toolBar) {
505 iWidget *sidebar = findChild_Widget(d->root, "sidebar"); 505 /* TODO: get this from toolBar height, but it's buggy for some reason */
506 setPadding_Widget(sidebar, 0, 0, 0, isPortrait_App() ? 11 * gap_UI + bottom : 0); 506 const int sidebarBottomPad = isPortrait_App() ? 11 * gap_UI + bottom : 0;
507 setPadding_Widget(findChild_Widget(d->root, "sidebar"), 0, 0, 0, sidebarBottomPad);
508 setPadding_Widget(findChild_Widget(d->root, "sidebar2"), 0, 0, 0, sidebarBottomPad);
507 /* TODO: There seems to be unrelated layout glitch in the sidebar where its children 509 /* TODO: There seems to be unrelated layout glitch in the sidebar where its children
508 are not arranged correctly until it's hidden and reshown. */ 510 are not arranged correctly until it's hidden and reshown. */
509 } 511 }