summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-19 19:03:33 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-19 19:04:04 (EDT)
commitc41de59a3accda61fe12bb73b0ec05a11974730b (patch)
treeac0bcac219502084e17ce6af1d9d99f455ecb576 /src
parent4ed5bcb2d89cd28e7a8ce0daea05eb491b3cd904 (diff)
downloadmarquee-c41de59a3accda61fe12bb73b0ec05a11974730b.zip
marquee-c41de59a3accda61fe12bb73b0ec05a11974730b.tar.gz
marquee-c41de59a3accda61fe12bb73b0ec05a11974730b.tar.bz2
src/window.c: Convert tab list button to toggle button
Diffstat (limited to 'src')
-rw-r--r--src/window.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c
index ed4f65a..f3bfa41 100644
--- a/src/window.c
+++ b/src/window.c
@@ -60,6 +60,18 @@ tab_list_back_button_clicked_cb(GtkButton __attribute__((unused)) *button,
gtk_grid_attach(GTK_GRID(button_grid), \
buttons[Y * BUTTON_COLS + X], X, Y, 1, 1); \
} while (0)
+#define NEW_TOGGLE(Y, X, ICON, TOOLTIP) \
+ do { \
+ buttons[Y * BUTTON_COLS + X] = gtk_toggle_button_new(); \
+ gtk_button_set_image(GTK_BUTTON(buttons[Y * BUTTON_COLS + X]), \
+ gtk_image_new_from_icon_name(ICON, \
+ GTK_ICON_SIZE_BUTTON)); \
+ gtk_widget_set_tooltip_text(buttons[Y * BUTTON_COLS + X], \
+ TOOLTIP); \
+ gtk_widget_set_can_focus(buttons[Y * BUTTON_COLS + X], FALSE); \
+ gtk_grid_attach(GTK_GRID(button_grid), \
+ buttons[Y * BUTTON_COLS + X], X, Y, 1, 1); \
+ } while (0)
static gboolean
tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab)
@@ -86,7 +98,7 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab)
NEW_BUTTON(0, 3, "window-close", "Close tab");
NEW_BUTTON(1, 0, "tab-new-symbolic", "New tab");
NEW_BUTTON(1, 1, "edit-undo", "Undo close tab");
- NEW_BUTTON(1, 3, "view-list-symbolic", "Tab list...");
+ NEW_TOGGLE(1, 3, "view-list-symbolic", "Tab list...");
/* Set up the button rows box. */
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
@@ -117,6 +129,7 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab)
#undef BUTTON_ROWS
#undef BUTTON_COLS
#undef NEW_BUTTON
+#undef NEW_TOGGLE
static void
add_tab(MqWindow *window, gchar *uri, gint position)