summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-04 09:26:52 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-04 09:26:52 +0200
commit39d66598f3641749bd3e2b9b2588e921912d4ec7 (patch)
treeabb7998d0165e0e1e598278da8d8e836bf705afc /src/ui
parentc8089179f84a2cabd84a47a800aaadd9af8bd9b8 (diff)
SidebarWidget: Interaction with the right sidebar
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/keys.h2
-rw-r--r--src/ui/sidebarwidget.c5
-rw-r--r--src/ui/window.c5
3 files changed, 11 insertions, 1 deletions
diff --git a/src/ui/keys.h b/src/ui/keys.h
index cc56f8d1..8bcd4f53 100644
--- a/src/ui/keys.h
+++ b/src/ui/keys.h
@@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36# define navigateRoot_KeyShortcut SDLK_UP, KMOD_SHIFT | KMOD_PRIMARY 36# define navigateRoot_KeyShortcut SDLK_UP, KMOD_SHIFT | KMOD_PRIMARY
37# define byWord_KeyModifier KMOD_ALT 37# define byWord_KeyModifier KMOD_ALT
38# define byLine_KeyModifier KMOD_PRIMARY 38# define byLine_KeyModifier KMOD_PRIMARY
39# define rightSidebar_KeyModifier KMOD_CTRL
39# define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY 40# define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY
40#else 41#else
41# define reload_KeyShortcut SDLK_r, KMOD_PRIMARY 42# define reload_KeyShortcut SDLK_r, KMOD_PRIMARY
@@ -47,6 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
47# define navigateRoot_KeyShortcut SDLK_UP, KMOD_SHIFT | KMOD_ALT 48# define navigateRoot_KeyShortcut SDLK_UP, KMOD_SHIFT | KMOD_ALT
48# define byWord_KeyModifier KMOD_CTRL 49# define byWord_KeyModifier KMOD_CTRL
49# define byLine_KeyModifier 0 50# define byLine_KeyModifier 0
51# define rightSidebar_KeyModifier KMOD_SHIFT | KMOD_CTRL
50# define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY 52# define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY
51#endif 53#endif
52 54
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 121e9a7c..ca4404d5 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -580,7 +580,8 @@ void setWidth_SidebarWidget(iSidebarWidget *d, int width) {
580 580
581iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) { 581iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) {
582 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { 582 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) {
583 iSidebarWidget *d = findWidget_App("sidebar"); 583 iAssert(startsWith_String(id_Widget(editor), "bmed."));
584 iSidebarWidget *d = findWidget_App(cstr_String(id_Widget(editor)) + 5); /* bmed.sidebar */
584 if (equal_Command(cmd, "bmed.accept")) { 585 if (equal_Command(cmd, "bmed.accept")) {
585 const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title")); 586 const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title"));
586 const iString *url = text_InputWidget(findChild_Widget(editor, "bmed.url")); 587 const iString *url = text_InputWidget(findChild_Widget(editor, "bmed.url"));
@@ -719,6 +720,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
719 if (d->mode == bookmarks_SidebarMode && item) { 720 if (d->mode == bookmarks_SidebarMode && item) {
720 setFlags_Widget(w, disabled_WidgetFlag, iTrue); 721 setFlags_Widget(w, disabled_WidgetFlag, iTrue);
721 iWidget *dlg = makeBookmarkEditor_Widget(); 722 iWidget *dlg = makeBookmarkEditor_Widget();
723 setId_Widget(dlg, format_CStr("bmed.%s", cstr_String(id_Widget(w))));
722 iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id); 724 iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id);
723 setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &bm->title); 725 setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &bm->title);
724 setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &bm->url); 726 setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &bm->url);
@@ -800,6 +802,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
800 if (isCommand_Widget(w, ev, "feed.entry.edit")) { 802 if (isCommand_Widget(w, ev, "feed.entry.edit")) {
801 setFlags_Widget(w, disabled_WidgetFlag, iTrue); 803 setFlags_Widget(w, disabled_WidgetFlag, iTrue);
802 iWidget *dlg = makeBookmarkEditor_Widget(); 804 iWidget *dlg = makeBookmarkEditor_Widget();
805 setId_Widget(dlg, format_CStr("bmed.%s", cstr_String(id_Widget(w))));
803 setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &feedBookmark->title); 806 setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &feedBookmark->title);
804 setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &feedBookmark->url); 807 setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &feedBookmark->url);
805 setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &feedBookmark->tags); 808 setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &feedBookmark->tags);
diff --git a/src/ui/window.c b/src/ui/window.c
index 53300d24..6441a2e3 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -511,6 +511,11 @@ static void setupUserInterface_Window(iWindow *d) {
511 addAction_Widget(d->root, '3', KMOD_PRIMARY, "sidebar.mode arg:2 toggle:1"); 511 addAction_Widget(d->root, '3', KMOD_PRIMARY, "sidebar.mode arg:2 toggle:1");
512 addAction_Widget(d->root, '4', KMOD_PRIMARY, "sidebar.mode arg:3 toggle:1"); 512 addAction_Widget(d->root, '4', KMOD_PRIMARY, "sidebar.mode arg:3 toggle:1");
513 addAction_Widget(d->root, '5', KMOD_PRIMARY, "sidebar.mode arg:4 toggle:1"); 513 addAction_Widget(d->root, '5', KMOD_PRIMARY, "sidebar.mode arg:4 toggle:1");
514 addAction_Widget(d->root, '1', rightSidebar_KeyModifier, "sidebar2.mode arg:0 toggle:1");
515 addAction_Widget(d->root, '2', rightSidebar_KeyModifier, "sidebar2.mode arg:1 toggle:1");
516 addAction_Widget(d->root, '3', rightSidebar_KeyModifier, "sidebar2.mode arg:2 toggle:1");
517 addAction_Widget(d->root, '4', rightSidebar_KeyModifier, "sidebar2.mode arg:3 toggle:1");
518 addAction_Widget(d->root, '5', rightSidebar_KeyModifier, "sidebar2.mode arg:4 toggle:1");
514 } 519 }
515} 520}
516 521