diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-25 22:51:26 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-25 22:51:26 +0200 |
commit | b13e07934739d1855bb7b9f695528d03a46756b4 (patch) | |
tree | 3f28e9da2bd001048b09c7e4a46bc72e222188a8 /src | |
parent | feac9ab1c7f33aced1801bc2810563cb94d9bc5b (diff) |
SidebarWidget: Feed items show bookmark icon
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/sidebarwidget.c | 24 | ||||
-rw-r--r-- | src/visited.c | 2 |
2 files changed, 19 insertions, 7 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)); |
diff --git a/src/visited.c b/src/visited.c index b339198e..a1dab6be 100644 --- a/src/visited.c +++ b/src/visited.c | |||
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
29 | #include <the_Foundation/ptrarray.h> | 29 | #include <the_Foundation/ptrarray.h> |
30 | #include <the_Foundation/sortedarray.h> | 30 | #include <the_Foundation/sortedarray.h> |
31 | 31 | ||
32 | static const size_t maxAgeVisited_Visited_ = 3600 * 24 * 30; /* one month */ | 32 | static const size_t maxAgeVisited_Visited_ = 2 * 3600 * 24 * 30; /* two months */ |
33 | 33 | ||
34 | void init_VisitedUrl(iVisitedUrl *d) { | 34 | void init_VisitedUrl(iVisitedUrl *d) { |
35 | initCurrent_Time(&d->when); | 35 | initCurrent_Time(&d->when); |