summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-26 13:50:07 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-26 13:50:07 +0200
commitc69280c86ad2602171daa4b4bf820c7b59bc9324 (patch)
treefaffa5447a64204893e24c7deeaf82a7304b96f5 /src/ui/window.c
parent0635b3d7d37ea111379df65df35432845a0ea133 (diff)
Feeds: Working on menu items
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index b31707fe..6e046bdc 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -97,7 +97,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
97 97
98#if !defined (iHaveNativeMenus) 98#if !defined (iHaveNativeMenus)
99/* TODO: Submenus wouldn't hurt here. */ 99/* TODO: Submenus wouldn't hurt here. */
100static const iMenuItem navMenuItems[] = { 100static const iMenuItem navMenuItems_[] = {
101 { "New Tab", 't', KMOD_PRIMARY, "tabs.new" }, 101 { "New Tab", 't', KMOD_PRIMARY, "tabs.new" },
102 { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, 102 { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
103 { "---", 0, 0, NULL }, 103 { "---", 0, 0, NULL },
@@ -121,27 +121,21 @@ static const iMenuItem navMenuItems[] = {
121 121
122#if defined (iHaveNativeMenus) 122#if defined (iHaveNativeMenus)
123/* Using native menus. */ 123/* Using native menus. */
124static const iMenuItem fileMenuItems[] = { 124static const iMenuItem fileMenuItems_[] = {
125 { "New Tab", SDLK_t, KMOD_PRIMARY, "tabs.new" }, 125 { "New Tab", SDLK_t, KMOD_PRIMARY, "tabs.new" },
126 { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, 126 { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
127 { "---", 0, 0, NULL }, 127 { "---", 0, 0, NULL },
128 { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" }, 128 { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" },
129}; 129};
130 130
131static const iMenuItem editMenuItems[] = { 131static const iMenuItem editMenuItems_[] = {
132 { "Copy", SDLK_c, KMOD_PRIMARY, "copy" }, 132 { "Copy", SDLK_c, KMOD_PRIMARY, "copy" },
133 { "Copy Link to Page", SDLK_c, KMOD_PRIMARY | KMOD_SHIFT, "document.copylink" }, 133 { "Copy Link to Page", SDLK_c, KMOD_PRIMARY | KMOD_SHIFT, "document.copylink" },
134 { "---", 0, 0, NULL }, 134 { "---", 0, 0, NULL },
135 { "Find", SDLK_f, KMOD_PRIMARY, "focus.set id:find.input" }, 135 { "Find", SDLK_f, KMOD_PRIMARY, "focus.set id:find.input" },
136 { "---", 0, 0, NULL },
137 { "Bookmark This Page...", SDLK_d, KMOD_PRIMARY, "bookmark.add" },
138}; 136};
139 137
140static const iMenuItem identityMenuItems[] = { 138static const iMenuItem viewMenuItems_[] = {
141 { "New Identity...", SDLK_n, KMOD_PRIMARY | KMOD_SHIFT, "ident.new" },
142};
143
144static const iMenuItem viewMenuItems[] = {
145 { "Show Bookmarks", '1', KMOD_PRIMARY, "sidebar.mode arg:0 toggle:1" }, 139 { "Show Bookmarks", '1', KMOD_PRIMARY, "sidebar.mode arg:0 toggle:1" },
146 { "Show Feeds", '2', KMOD_PRIMARY, "sidebar.mode arg:1 toggle:1" }, 140 { "Show Feeds", '2', KMOD_PRIMARY, "sidebar.mode arg:1 toggle:1" },
147 { "Show History", '3', KMOD_PRIMARY, "sidebar.mode arg:2 toggle:1" }, 141 { "Show History", '3', KMOD_PRIMARY, "sidebar.mode arg:2 toggle:1" },
@@ -162,13 +156,25 @@ static const iMenuItem viewMenuItems[] = {
162 { "Wrap Preformatted", 0, 0, "forcewrap.toggle" } 156 { "Wrap Preformatted", 0, 0, "forcewrap.toggle" }
163}; 157};
164 158
165static const iMenuItem helpMenuItems[] = { 159static iMenuItem bookmarksMenuItems_[] = {
160 { "Bookmark This Page...", SDLK_d, KMOD_PRIMARY, "bookmark.add" },
161 { "---", 0, 0, NULL },
162 { "Subscribe as Feed", 0, 0, "bookmark.addtag tag:subscribed" },
163 { "---", 0, 0, NULL },
164 { "Refresh Feeds", SDLK_r, KMOD_PRIMARY | KMOD_SHIFT, "feeds.refresh" },
165};
166
167static const iMenuItem identityMenuItems_[] = {
168 { "New Identity...", SDLK_n, KMOD_PRIMARY | KMOD_SHIFT, "ident.new" },
169};
170
171static const iMenuItem helpMenuItems_[] = {
166 { "Help", 0, 0, "!open url:about:help" }, 172 { "Help", 0, 0, "!open url:about:help" },
167 { "Release Notes", 0, 0, "!open url:about:version" }, 173 { "Release Notes", 0, 0, "!open url:about:version" },
168}; 174};
169#endif 175#endif
170 176
171static const iMenuItem identityButtonMenuItems[] = { 177static const iMenuItem identityButtonMenuItems_[] = {
172 { "No Active Identity", 0, 0, "ident.showactive" }, 178 { "No Active Identity", 0, 0, "ident.showactive" },
173 { "---", 0, 0, NULL }, 179 { "---", 0, 0, NULL },
174#if !defined (iHaveNativeMenus) 180#if !defined (iHaveNativeMenus)
@@ -377,7 +383,7 @@ static void setupUserInterface_Window(iWindow *d) {
377 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f870", 0, 0, "navigate.back"))); 383 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f870", 0, 0, "navigate.back")));
378 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f872", 0, 0, "navigate.forward"))); 384 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f872", 0, 0, "navigate.forward")));
379 iLabelWidget *idMenu = makeMenuButton_LabelWidget( 385 iLabelWidget *idMenu = makeMenuButton_LabelWidget(
380 "\U0001f464", identityButtonMenuItems, iElemCount(identityButtonMenuItems)); 386 "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_));
381 setAlignVisually_LabelWidget(idMenu, iTrue); 387 setAlignVisually_LabelWidget(idMenu, iTrue);
382 addChild_Widget(navBar, iClob(idMenu)); 388 addChild_Widget(navBar, iClob(idMenu));
383 setId_Widget(as_Widget(idMenu), "navbar.ident"); 389 setId_Widget(as_Widget(idMenu), "navbar.ident");
@@ -414,15 +420,16 @@ static void setupUserInterface_Window(iWindow *d) {
414 "\U0001f3e0", SDLK_h, KMOD_PRIMARY | KMOD_SHIFT, "navigate.home"))); 420 "\U0001f3e0", SDLK_h, KMOD_PRIMARY | KMOD_SHIFT, "navigate.home")));
415#if !defined (iHaveNativeMenus) 421#if !defined (iHaveNativeMenus)
416 iLabelWidget *navMenu = 422 iLabelWidget *navMenu =
417 makeMenuButton_LabelWidget("\U0001d362", navMenuItems, iElemCount(navMenuItems)); 423 makeMenuButton_LabelWidget("\U0001d362", navMenuItems_, iElemCount(navMenuItems_));
418 setAlignVisually_LabelWidget(navMenu, iTrue); 424 setAlignVisually_LabelWidget(navMenu, iTrue);
419 addChild_Widget(navBar, iClob(navMenu)); 425 addChild_Widget(navBar, iClob(navMenu));
420#else 426#else
421 insertMenuItems_MacOS("File", 1, fileMenuItems, iElemCount(fileMenuItems)); 427 insertMenuItems_MacOS("File", 1, fileMenuItems_, iElemCount(fileMenuItems_));
422 insertMenuItems_MacOS("Edit", 2, editMenuItems, iElemCount(editMenuItems)); 428 insertMenuItems_MacOS("Edit", 2, editMenuItems_, iElemCount(editMenuItems_));
423 insertMenuItems_MacOS("View", 3, viewMenuItems, iElemCount(viewMenuItems)); 429 insertMenuItems_MacOS("View", 3, viewMenuItems_, iElemCount(viewMenuItems_));
424 insertMenuItems_MacOS("Identity", 4, identityMenuItems, iElemCount(identityMenuItems)); 430 insertMenuItems_MacOS("Bookmarks", 4, bookmarksMenuItems_, iElemCount(bookmarksMenuItems_));
425 insertMenuItems_MacOS("Help", 6, helpMenuItems, iElemCount(helpMenuItems)); 431 insertMenuItems_MacOS("Identity", 5, identityMenuItems_, iElemCount(identityMenuItems_));
432 insertMenuItems_MacOS("Help", 7, helpMenuItems_, iElemCount(helpMenuItems_));
426#endif 433#endif
427 } 434 }
428 /* Tab bar. */ { 435 /* Tab bar. */ {