diff options
-rw-r--r-- | src/ui/sidebarwidget.c | 44 | ||||
-rw-r--r-- | src/ui/widget.h | 1 | ||||
-rw-r--r-- | src/ui/window.c | 2 |
3 files changed, 29 insertions, 18 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 5c71ef0d..1a769f64 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -100,6 +100,7 @@ struct Impl_SidebarWidget { | |||
100 | iLabelWidget * modeButtons[max_SidebarMode]; | 100 | iLabelWidget * modeButtons[max_SidebarMode]; |
101 | int maxButtonLabelWidth; | 101 | int maxButtonLabelWidth; |
102 | int widthAsGaps; | 102 | int widthAsGaps; |
103 | int buttonFont; | ||
103 | int itemFonts[2]; | 104 | int itemFonts[2]; |
104 | size_t numUnreadEntries; | 105 | size_t numUnreadEntries; |
105 | iWidget * resizer; | 106 | iWidget * resizer; |
@@ -133,6 +134,17 @@ static int cmpTitle_Bookmark_(const iBookmark **a, const iBookmark **b) { | |||
133 | return cmpStringCase_String(&bm1->title, &bm2->title); | 134 | return cmpStringCase_String(&bm1->title, &bm2->title); |
134 | } | 135 | } |
135 | 136 | ||
137 | static iLabelWidget *addActionButton_SidebarWidget_(iSidebarWidget *d, const char *label, | ||
138 | const char *command, int64_t flags) { | ||
139 | iLabelWidget *btn = addChildFlags_Widget(d->actions, | ||
140 | iClob(new_LabelWidget(label, command)), | ||
141 | (deviceType_App() != desktop_AppDeviceType ? | ||
142 | extraPadding_WidgetFlag : 0) | flags); | ||
143 | setFont_LabelWidget(btn, d->buttonFont == uiLabelLarge_FontId ? defaultBig_FontId : d->buttonFont); | ||
144 | checkIcon_LabelWidget(btn); | ||
145 | return btn; | ||
146 | } | ||
147 | |||
136 | static void updateItems_SidebarWidget_(iSidebarWidget *d) { | 148 | static void updateItems_SidebarWidget_(iSidebarWidget *d) { |
137 | clear_ListWidget(d->list); | 149 | clear_ListWidget(d->list); |
138 | releaseChildren_Widget(d->blank); | 150 | releaseChildren_Widget(d->blank); |
@@ -216,14 +228,10 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
216 | } | 228 | } |
217 | } | 229 | } |
218 | /* Actions. */ { | 230 | /* Actions. */ { |
219 | addChildFlags_Widget( | 231 | addActionButton_SidebarWidget_(d, "${sidebar.action.feeds.showall}", "feeds.mode arg:0", |
220 | d->actions, | 232 | d->feedsMode == all_FeedsMode ? selected_WidgetFlag : 0); |
221 | iClob(new_LabelWidget("${sidebar.action.feeds.showall}", "feeds.mode arg:0")), | 233 | addActionButton_SidebarWidget_(d, "${sidebar.action.feeds.showunread}", "feeds.mode arg:1", |
222 | d->feedsMode == all_FeedsMode ? selected_WidgetFlag : 0); | 234 | d->feedsMode == unread_FeedsMode ? selected_WidgetFlag : 0); |
223 | addChildFlags_Widget(d->actions, | ||
224 | iClob(new_LabelWidget("${sidebar.action.feeds.showunread}", | ||
225 | "feeds.mode arg:1")), | ||
226 | d->feedsMode == unread_FeedsMode ? selected_WidgetFlag : 0); | ||
227 | } | 235 | } |
228 | d->menu = makeMenu_Widget( | 236 | d->menu = makeMenu_Widget( |
229 | as_Widget(d), | 237 | as_Widget(d), |
@@ -293,9 +301,9 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
293 | { copy_Icon " ${menu.dup}", 0, 0, "bookmark.dup" }, | 301 | { copy_Icon " ${menu.dup}", 0, 0, "bookmark.dup" }, |
294 | { "${menu.copyurl}", 0, 0, "bookmark.copy" }, | 302 | { "${menu.copyurl}", 0, 0, "bookmark.copy" }, |
295 | { "---", 0, 0, NULL }, | 303 | { "---", 0, 0, NULL }, |
296 | { "?", 0, 0, "bookmark.tag tag:subscribed" }, | 304 | { "", 0, 0, "bookmark.tag tag:subscribed" }, |
297 | { "?", 0, 0, "bookmark.tag tag:homepage" }, | 305 | { "", 0, 0, "bookmark.tag tag:homepage" }, |
298 | { "?", 0, 0, "bookmark.tag tag:remotesource" }, | 306 | { "", 0, 0, "bookmark.tag tag:remotesource" }, |
299 | { "---", 0, 0, NULL }, | 307 | { "---", 0, 0, NULL }, |
300 | { delete_Icon " " uiTextCaution_ColorEscape "${bookmark.delete}", 0, 0, "bookmark.delete" }, | 308 | { delete_Icon " " uiTextCaution_ColorEscape "${bookmark.delete}", 0, 0, "bookmark.delete" }, |
301 | { "---", 0, 0, NULL }, | 309 | { "---", 0, 0, NULL }, |
@@ -359,12 +367,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
359 | } | 367 | } |
360 | case identities_SidebarMode: { | 368 | case identities_SidebarMode: { |
361 | /* Actions. */ { | 369 | /* Actions. */ { |
362 | checkIcon_LabelWidget(addChild_Widget( | 370 | addActionButton_SidebarWidget_(d, add_Icon " ${sidebar.action.ident.new}", "ident.new", 0); |
363 | d->actions, | 371 | addActionButton_SidebarWidget_(d, "${sidebar.action.ident.import}", "ident.import", 0); |
364 | iClob(new_LabelWidget(add_Icon " ${sidebar.action.ident.new}", "ident.new")))); | ||
365 | checkIcon_LabelWidget(addChild_Widget( | ||
366 | d->actions, | ||
367 | iClob(new_LabelWidget("${sidebar.action.ident.import}", "ident.import")))); | ||
368 | } | 372 | } |
369 | const iString *tabUrl = url_DocumentWidget(document_App()); | 373 | const iString *tabUrl = url_DocumentWidget(document_App()); |
370 | isEmpty = iTrue; | 374 | isEmpty = iTrue; |
@@ -460,15 +464,16 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
460 | } | 464 | } |
461 | // arrange_Widget(d->blank); | 465 | // arrange_Widget(d->blank); |
462 | } | 466 | } |
467 | #if 0 | ||
463 | if (deviceType_App() != desktop_AppDeviceType) { | 468 | if (deviceType_App() != desktop_AppDeviceType) { |
464 | /* Touch-friendly action buttons. */ | 469 | /* Touch-friendly action buttons. */ |
465 | iForEach(ObjectList, i, children_Widget(d->actions)) { | 470 | iForEach(ObjectList, i, children_Widget(d->actions)) { |
466 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | 471 | if (isInstance_Object(i.object, &Class_LabelWidget)) { |
467 | setPadding_Widget(i.object, 0, gap_UI, 0, gap_UI); | 472 | setPadding_Widget(i.object, 0, gap_UI, 0, gap_UI); |
468 | setFont_LabelWidget(i.object, defaultBig_FontId); | ||
469 | } | 473 | } |
470 | } | 474 | } |
471 | } | 475 | } |
476 | #endif | ||
472 | arrange_Widget(d->actions); | 477 | arrange_Widget(d->actions); |
473 | arrange_Widget(as_Widget(d)); | 478 | arrange_Widget(as_Widget(d)); |
474 | } | 479 | } |
@@ -561,6 +566,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
561 | d->mode = -1; | 566 | d->mode = -1; |
562 | d->feedsMode = all_FeedsMode; | 567 | d->feedsMode = all_FeedsMode; |
563 | d->numUnreadEntries = 0; | 568 | d->numUnreadEntries = 0; |
569 | d->buttonFont = uiLabel_FontId; | ||
564 | d->itemFonts[0] = uiContent_FontId; | 570 | d->itemFonts[0] = uiContent_FontId; |
565 | d->itemFonts[1] = uiContentBold_FontId; | 571 | d->itemFonts[1] = uiContentBold_FontId; |
566 | #if defined (iPlatformAppleMobile) | 572 | #if defined (iPlatformAppleMobile) |
@@ -578,6 +584,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
578 | iZap(d->modeButtons); | 584 | iZap(d->modeButtons); |
579 | d->resizer = NULL; | 585 | d->resizer = NULL; |
580 | d->list = NULL; | 586 | d->list = NULL; |
587 | d->actions = NULL; | ||
581 | /* On a phone, the right sidebar is used exclusively for Identities. */ | 588 | /* On a phone, the right sidebar is used exclusively for Identities. */ |
582 | const iBool isPhone = deviceType_App() == phone_AppDeviceType; | 589 | const iBool isPhone = deviceType_App() == phone_AppDeviceType; |
583 | if (!isPhone || d->side == left_SideBarSide) { | 590 | if (!isPhone || d->side == left_SideBarSide) { |
@@ -660,6 +667,7 @@ void deinit_SidebarWidget(iSidebarWidget *d) { | |||
660 | } | 667 | } |
661 | 668 | ||
662 | void setButtonFont_SidebarWidget(iSidebarWidget *d, int font) { | 669 | void setButtonFont_SidebarWidget(iSidebarWidget *d, int font) { |
670 | d->buttonFont = font; | ||
663 | for (int i = 0; i < max_SidebarMode; i++) { | 671 | for (int i = 0; i < max_SidebarMode; i++) { |
664 | if (d->modeButtons[i]) { | 672 | if (d->modeButtons[i]) { |
665 | setFont_LabelWidget(d->modeButtons[i], font); | 673 | setFont_LabelWidget(d->modeButtons[i], font); |
diff --git a/src/ui/widget.h b/src/ui/widget.h index dc79a22c..27295149 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h | |||
@@ -198,6 +198,7 @@ iLocalDef int height_Widget(const iAnyObject *d) { | |||
198 | return 0; | 198 | return 0; |
199 | } | 199 | } |
200 | iLocalDef iObjectList *children_Widget(iAnyObject *d) { | 200 | iLocalDef iObjectList *children_Widget(iAnyObject *d) { |
201 | if (d == NULL) return NULL; | ||
201 | iAssert(isInstance_Object(d, &Class_Widget)); | 202 | iAssert(isInstance_Object(d, &Class_Widget)); |
202 | return ((iWidget *) d)->children; | 203 | return ((iWidget *) d)->children; |
203 | } | 204 | } |
diff --git a/src/ui/window.c b/src/ui/window.c index 642bcba5..d00d19a7 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -151,8 +151,10 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
151 | else if (deviceType_App() == phone_AppDeviceType && equal_Command(cmd, "window.resized")) { | 151 | else if (deviceType_App() == phone_AppDeviceType && equal_Command(cmd, "window.resized")) { |
152 | /* Place the sidebar next to or under doctabs depending on orientation. */ | 152 | /* Place the sidebar next to or under doctabs depending on orientation. */ |
153 | iSidebarWidget *sidebar = findChild_Widget(root, "sidebar"); | 153 | iSidebarWidget *sidebar = findChild_Widget(root, "sidebar"); |
154 | iSidebarWidget *sidebar2 = findChild_Widget(root, "sidebar2"); | ||
154 | removeChild_Widget(parent_Widget(sidebar), sidebar); | 155 | removeChild_Widget(parent_Widget(sidebar), sidebar); |
155 | setButtonFont_SidebarWidget(sidebar, isLandscape_App() ? uiLabel_FontId : uiLabelLarge_FontId); | 156 | setButtonFont_SidebarWidget(sidebar, isLandscape_App() ? uiLabel_FontId : uiLabelLarge_FontId); |
157 | setButtonFont_SidebarWidget(sidebar2, isLandscape_App() ? uiLabel_FontId : uiLabelLarge_FontId); | ||
156 | // setBackgroundColor_Widget(findChild_Widget(as_Widget(sidebar), "buttons"), | 158 | // setBackgroundColor_Widget(findChild_Widget(as_Widget(sidebar), "buttons"), |
157 | // isPortrait_App() ? uiBackgroundUnfocusedSelection_ColorId | 159 | // isPortrait_App() ? uiBackgroundUnfocusedSelection_ColorId |
158 | // : uiBackgroundSidebar_ColorId); | 160 | // : uiBackgroundSidebar_ColorId); |