summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-19 18:33:28 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-19 18:33:28 (EDT)
commit51483cbf60bc45fe09916ed390201bbb90c6bbbc (patch)
tree93a8d13b5bc7884e73baeb5d7b4a1e327bad015e /src
parentd50680f12a16e493212f7862001f2ba2c6e4a599 (diff)
downloadmarquee-51483cbf60bc45fe09916ed390201bbb90c6bbbc.zip
marquee-51483cbf60bc45fe09916ed390201bbb90c6bbbc.tar.gz
marquee-51483cbf60bc45fe09916ed390201bbb90c6bbbc.tar.bz2
src/tab-chrome.[ch]: Add (non-functional) menu
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c60
-rw-r--r--src/tab-chrome.h1
2 files changed, 61 insertions, 0 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index bb360d3..e724809 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -243,6 +243,56 @@ uri_activate_cb(GtkEntry *entry, MqTabChrome *chrome)
gtk_entry_get_text(GTK_ENTRY(entry)));
}
+#define BUTTON_ROWS 5
+#define BUTTON_COLS 3
+#define NEW_BUTTON(Y, X, ICON, TOOLTIP) \
+ do { \
+ buttons[Y * BUTTON_COLS + X] = gtk_button_new_from_icon_name(\
+ ICON, GTK_ICON_SIZE_BUTTON); \
+ gtk_widget_set_tooltip_text(buttons[Y * BUTTON_COLS + X], \
+ TOOLTIP); \
+ gtk_grid_attach(GTK_GRID(grid), buttons[Y * BUTTON_COLS + X], \
+ X, Y, 1, 1); \
+ } while (0)
+
+static void
+menu_button_clicked_cb(GtkToolButton *tool_button,
+ MqTabChrome __attribute__((unused)) *chrome)
+{
+ GtkWidget *grid;
+ GtkWidget *buttons[BUTTON_ROWS * BUTTON_COLS];
+ GtkWidget *popover;
+
+ /* Set up the grid. */
+ grid = gtk_grid_new();
+
+ NEW_BUTTON(0, 0, "document-open", "Open file");
+ NEW_BUTTON(0, 1, "document-save-as", "Save page");
+ NEW_BUTTON(0, 2, "mail-message-new", "E-mail link");
+ NEW_BUTTON(1, 0, "edit-find", "Find");
+ NEW_BUTTON(1, 1, "document-print-preview", "Print preview");
+ NEW_BUTTON(1, 2, "document-print", "Print");
+ NEW_BUTTON(2, 0, "bookmark-new", "Bookmarks");
+ NEW_BUTTON(2, 1, "document-open-recent", "History");
+ NEW_BUTTON(2, 2, "document-save", "Downloads");
+ NEW_BUTTON(3, 0, "view-fullscreen", "Full screen");
+ NEW_BUTTON(3, 1, "document-properties", "Developer tools");
+ NEW_BUTTON(3, 2, "system-run", "Preferences");
+ NEW_BUTTON(4, 0, "help-about", "About Marquee");
+ NEW_BUTTON(4, 2, "application-exit", "Quit");
+
+ /* Set up the popover. */
+ popover = gtk_popover_new(GTK_WIDGET(tool_button));
+ gtk_container_add(GTK_CONTAINER(popover), grid);
+
+ /* NB: gtk_popover_popup() is new in GTK+ 3.22. */
+ gtk_widget_show_all(popover);
+}
+
+#undef BUTTON_ROWS
+#undef BUTTON_COLS
+#undef NEW_BUTTON
+
static GtkWidget *
navigation_toolbar_new(MqTabChrome *chrome, gchar *uri)
{
@@ -324,6 +374,16 @@ navigation_toolbar_new(MqTabChrome *chrome, gchar *uri)
pango_attr_list_insert(chrome->hovered_link_style,
pango_attr_style_new(PANGO_STYLE_ITALIC));
+ /* Menu button */
+ chrome->menu_button = gtk_tool_button_new(
+ gtk_image_new_from_icon_name("open-menu-symbolic",
+ GTK_ICON_SIZE_SMALL_TOOLBAR), "Menu");
+ gtk_widget_set_tooltip_text(GTK_WIDGET(chrome->menu_button),
+ "Open menu");
+ g_signal_connect(chrome->menu_button, "clicked",
+ G_CALLBACK(menu_button_clicked_cb), chrome);
+ gtk_toolbar_insert(navigation_toolbar, chrome->menu_button, -1);
+
gtk_widget_set_hexpand(GTK_WIDGET(navigation_toolbar), TRUE);
chrome->load_failed = FALSE;
diff --git a/src/tab-chrome.h b/src/tab-chrome.h
index baf0e3a..4940fc8 100644
--- a/src/tab-chrome.h
+++ b/src/tab-chrome.h
@@ -42,6 +42,7 @@ typedef struct {
gboolean load_failed;
GtkWidget *back_forward_popover;
gint back_items;
+ GtkToolItem *menu_button;
} MqTabChrome;
MqTabChrome *