diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/sidebarwidget.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 6f1a7c04..6c29136e 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -140,15 +140,15 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
140 | if (equal_String(docUrl, &entry->url)) { | 140 | if (equal_String(docUrl, &entry->url)) { |
141 | item->listItem.isSelected = iTrue; /* currently being viewed */ | 141 | item->listItem.isSelected = iTrue; /* currently being viewed */ |
142 | } | 142 | } |
143 | item->icon = 0; | ||
144 | const iTime visitTime = urlVisitTime_Visited(visited_App(), &entry->url); | 143 | const iTime visitTime = urlVisitTime_Visited(visited_App(), &entry->url); |
145 | if (!isValid_Time(&visitTime)) { | 144 | if (!isValid_Time(&visitTime)) { |
146 | item->icon = 0x25cf; /* black circle */ | 145 | item->indent = 1; /* unread */ |
147 | } | 146 | } |
148 | set_String(&item->url, &entry->url); | 147 | set_String(&item->url, &entry->url); |
149 | set_String(&item->label, &entry->title); | 148 | set_String(&item->label, &entry->title); |
150 | const iBookmark *bm = get_Bookmarks(bookmarks_App(), entry->bookmarkId); | 149 | const iBookmark *bm = get_Bookmarks(bookmarks_App(), entry->bookmarkId); |
151 | if (bm) { | 150 | if (bm) { |
151 | item->icon = bm->icon; | ||
152 | // appendCStr_String(&item->meta, uiTextCaution_ColorEscape); | 152 | // appendCStr_String(&item->meta, uiTextCaution_ColorEscape); |
153 | // appendChar_String(&item->meta, bm->icon); | 153 | // appendChar_String(&item->meta, bm->icon); |
154 | // appendChar_String(&item->meta, ' '); | 154 | // appendChar_String(&item->meta, ' '); |
@@ -938,11 +938,11 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
938 | range_String(&d->meta)); | 938 | range_String(&d->meta)); |
939 | } | 939 | } |
940 | else { | 940 | else { |
941 | const iBool isUnread = (d->icon != 0); | 941 | const iBool isUnread = (d->indent != 0); |
942 | const int h1 = lineHeight_Text(uiLabel_FontId); | 942 | const int h1 = lineHeight_Text(uiLabel_FontId); |
943 | const int h2 = lineHeight_Text(uiContent_FontId); | 943 | const int h2 = lineHeight_Text(uiContent_FontId); |
944 | const int iconPad = 4 * gap_UI; | 944 | const int iconPad = 9 * gap_UI; |
945 | const iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) }; | 945 | iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) }; |
946 | if (isUnread) { | 946 | if (isUnread) { |
947 | /* | 947 | /* |
948 | iString str; | 948 | iString str; |
@@ -952,9 +952,21 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
952 | deinit_String(&str);*/ | 952 | deinit_String(&str);*/ |
953 | fillRect_Paint( | 953 | fillRect_Paint( |
954 | p, | 954 | p, |
955 | (iRect){ topLeft_Rect(iconArea), init_I2(gap_UI, height_Rect(iconArea)) }, | 955 | (iRect){ topLeft_Rect(iconArea), init_I2(gap_UI / 2, height_Rect(iconArea)) }, |
956 | iconColor); | 956 | iconColor); |
957 | } | 957 | } |
958 | /* Icon. */ { | ||
959 | /* TODO: Use the primary hue from the theme of this site. */ | ||
960 | iString str; | ||
961 | initUnicodeN_String(&str, &d->icon, 1); | ||
962 | drawCentered_Text(uiContent_FontId, | ||
963 | adjusted_Rect(iconArea, init_I2(gap_UI, 0), zero_I2()), | ||
964 | iTrue, | ||
965 | isHover && isPressing ? iconColor : uiTextCaution_ColorId, | ||
966 | "%s", | ||
967 | cstr_String(&str)); | ||
968 | deinit_String(&str); | ||
969 | } | ||
958 | /* Select the layout based on how the title fits. */ | 970 | /* Select the layout based on how the title fits. */ |
959 | iInt2 titleSize = advanceRange_Text(uiContent_FontId, range_String(&d->label)); | 971 | iInt2 titleSize = advanceRange_Text(uiContent_FontId, range_String(&d->label)); |
960 | const iInt2 metaSize = advanceRange_Text(uiLabel_FontId, range_String(&d->meta)); | 972 | const iInt2 metaSize = advanceRange_Text(uiLabel_FontId, range_String(&d->meta)); |