diff options
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 7729ccca..7d0e8b42 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -76,8 +76,12 @@ static void clearItems_SidebarWidget_(iSidebarWidget *d) { | |||
76 | 76 | ||
77 | static iRect contentBounds_SidebarWidget_(const iSidebarWidget *d) { | 77 | static iRect contentBounds_SidebarWidget_(const iSidebarWidget *d) { |
78 | iRect bounds = bounds_Widget(constAs_Widget(d)); | 78 | iRect bounds = bounds_Widget(constAs_Widget(d)); |
79 | adjustEdges_Rect(&bounds, as_Widget(d->modeButtons[0])->rect.size.y + gap_UI, | 79 | const iWidget *scroll = constAs_Widget(d->scroll); |
80 | -constAs_Widget(d->scroll)->rect.size.x, -gap_UI, 0); | 80 | adjustEdges_Rect(&bounds, |
81 | as_Widget(d->modeButtons[0])->rect.size.y + gap_UI, | ||
82 | isVisible_Widget(scroll) ? -scroll->rect.size.x : 0, | ||
83 | -gap_UI, | ||
84 | 0); | ||
81 | return bounds; | 85 | return bounds; |
82 | } | 86 | } |
83 | 87 | ||
@@ -318,6 +322,15 @@ void setWidth_SidebarWidget(iSidebarWidget *d, int width) { | |||
318 | iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) { | 322 | iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) { |
319 | iSidebarWidget *d = findWidget_App("sidebar"); | 323 | iSidebarWidget *d = findWidget_App("sidebar"); |
320 | if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { | 324 | if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { |
325 | if (equal_Command(cmd, "bmed.accept")) { | ||
326 | const iSidebarItem *item = hoverItem_SidebarWidget_(d); | ||
327 | iAssert(item); /* hover item cannot have been changed */ | ||
328 | iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id); | ||
329 | set_String(&bm->title, text_InputWidget(findChild_Widget(editor, "bmed.title"))); | ||
330 | set_String(&bm->url, text_InputWidget(findChild_Widget(editor, "bmed.url"))); | ||
331 | set_String(&bm->tags, text_InputWidget(findChild_Widget(editor, "bmed.tags"))); | ||
332 | postCommand_App("bookmarks.changed"); | ||
333 | } | ||
321 | setFlags_Widget(as_Widget(d), disabled_WidgetFlag, iFalse); | 334 | setFlags_Widget(as_Widget(d), disabled_WidgetFlag, iFalse); |
322 | destroy_Widget(editor); | 335 | destroy_Widget(editor); |
323 | return iTrue; | 336 | return iTrue; |
@@ -402,9 +415,10 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
402 | if (d->mode == bookmarks_SidebarMode && item) { | 415 | if (d->mode == bookmarks_SidebarMode && item) { |
403 | setFlags_Widget(w, disabled_WidgetFlag, iTrue); | 416 | setFlags_Widget(w, disabled_WidgetFlag, iTrue); |
404 | iWidget *dlg = makeBookmarkEditor_Widget(); | 417 | iWidget *dlg = makeBookmarkEditor_Widget(); |
405 | setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &item->label); | 418 | iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id); |
406 | setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &item->url); | 419 | setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &bm->title); |
407 | //setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &item->) | 420 | setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &bm->url); |
421 | setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &bm->tags); | ||
408 | setCommandHandler_Widget(dlg, handleBookmarkEditorCommands_SidebarWidget_); | 422 | setCommandHandler_Widget(dlg, handleBookmarkEditorCommands_SidebarWidget_); |
409 | } | 423 | } |
410 | return iTrue; | 424 | return iTrue; |