summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-18 17:11:40 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-18 17:11:40 (EDT)
commit9b4f934fde6bf75a32fedf98fcaf51870112d9ca (patch)
tree0d50846109686c8a4adb9deafd7109bd8c979067 /src
parentd203c16164255e7824c6394627b1a50ca536a8ab (diff)
downloadmarquee-9b4f934fde6bf75a32fedf98fcaf51870112d9ca.zip
marquee-9b4f934fde6bf75a32fedf98fcaf51870112d9ca.tar.gz
marquee-9b4f934fde6bf75a32fedf98fcaf51870112d9ca.tar.bz2
src/tab-chrome.c: Use toggle button for tab history stack
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index c164b5e..7a9aba9 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -40,12 +40,22 @@ forward_clicked_cb(GtkButton __attribute__((unused)) *toolbutton,
webkit_web_view_go_forward(chrome->web_view);
}
+static void
+back_forward_toggle_button_toggled(GtkToggleButton *toggle_button,
+ GtkStack *stack)
+{
+ gtk_stack_set_visible_child(stack, gtk_stack_get_child_by_name(
+ stack,
+ gtk_toggle_button_get_active(toggle_button) ?
+ "text" : "list"));
+}
+
static gboolean
back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
MqTabChrome *chrome)
{
GtkWidget *stack;
- GtkWidget *stack_switcher;
+ GtkWidget *toggle_button;
GtkWidget *box;
GtkWidget *popover;
@@ -54,25 +64,19 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
}
stack = gtk_stack_new();
- gtk_stack_add_titled(GTK_STACK(stack), gtk_label_new("List"), "list", "LIST");
- gtk_stack_add_titled(GTK_STACK(stack), gtk_label_new("Text"), "text", "TEXT");
-
- stack_switcher = gtk_stack_switcher_new();
- gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(stack_switcher),
+ gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("List"), "list");
+ gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("Text"), "text");
+
+ toggle_button = gtk_toggle_button_new();
+ gtk_button_set_image(GTK_BUTTON(toggle_button),
+ gtk_image_new_from_icon_name("edit-select-all",
+ GTK_ICON_SIZE_SMALL_TOOLBAR));
+ g_signal_connect(toggle_button, "toggled",
+ G_CALLBACK(back_forward_toggle_button_toggled),
GTK_STACK(stack));
- /*
- gtk_box_pack_start(GTK_BOX(stack_switcher),
- gtk_image_new_from_icon_name("view-list-symbolic",
- GTK_ICON_SIZE_SMALL_TOOLBAR),
- FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(stack_switcher),
- gtk_image_new_from_icon_name("edit-select-all-symbolic",
- GTK_ICON_SIZE_SMALL_TOOLBAR),
- FALSE, FALSE, 0);
- */
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start(GTK_BOX(box), stack_switcher, TRUE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(box), toggle_button, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), stack, TRUE, FALSE, 0);
popover = gtk_popover_new(widget);