summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-18 23:41:27 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-19 00:16:00 (EDT)
commit61a817c365ddfb646247b1a110607e4422801896 (patch)
tree2fe3371ce2d4266f40382a48428aebb3709aa38c /src
parent861db2f8238524ffa8e843270ea263fe9e567ccb (diff)
downloadmarquee-61a817c365ddfb646247b1a110607e4422801896.zip
marquee-61a817c365ddfb646247b1a110607e4422801896.tar.gz
marquee-61a817c365ddfb646247b1a110607e4422801896.tar.bz2
src/tab-chrome.c: Make tab history list icon stacks
Still doesn't quite work. The wrong child is visible on most stacks.
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 1d10bfa..c83e23e 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -52,17 +52,30 @@ back_forward_toggle_button_toggled(GtkToggleButton *toggle_button,
static GtkWidget *
back_forward_list_item_new(WebKitBackForwardListItem *list_item,
- GtkWidget *icon)
+ const gchar *type)
{
GtkWidget *label;
+ GtkWidget *icon_stack;
GtkWidget *box;
label = gtk_label_new(webkit_back_forward_list_item_get_title(
list_item));
gtk_widget_set_halign(label, GTK_ALIGN_START);
+ icon_stack = gtk_stack_new();
+ gtk_stack_add_named(GTK_STACK(icon_stack), gtk_radio_button_new(NULL),
+ "current");
+ gtk_stack_add_named(GTK_STACK(icon_stack),
+ gtk_image_new_from_icon_name("go-previous",
+ GTK_ICON_SIZE_BUTTON), "back");
+ gtk_stack_add_named(GTK_STACK(icon_stack),
+ gtk_image_new_from_icon_name("go-next",
+ GTK_ICON_SIZE_BUTTON), "forward");
+ gtk_stack_set_visible_child(GTK_STACK(icon_stack),
+ gtk_stack_get_child_by_name(GTK_STACK(icon_stack), type));
+
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(box), icon_stack, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
gtk_widget_set_tooltip_text(box,
webkit_back_forward_list_item_get_uri(list_item));
@@ -96,8 +109,7 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
gtk_list_box_insert(GTK_LIST_BOX(list_box), back_forward_list_item_new(
webkit_back_forward_list_get_current_item(
- back_forward_list), gtk_radio_button_new(NULL)),
- -1);
+ back_forward_list), "current"), -1);
gtk_list_box_select_row(GTK_LIST_BOX(list_box),
gtk_list_box_get_row_at_index(GTK_LIST_BOX(list_box), 0));
@@ -105,18 +117,16 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
back_forward_list);
for (; list_item; list_item = list_item->next) {
gtk_list_box_insert(GTK_LIST_BOX(list_box),
- back_forward_list_item_new(list_item->data,
- gtk_image_new_from_icon_name("go-previous",
- GTK_ICON_SIZE_BUTTON)), 0);
+ back_forward_list_item_new(list_item->data, "back"),
+ 0);
}
list_item = webkit_back_forward_list_get_forward_list(
back_forward_list);
for (; list_item; list_item = list_item->next) {
gtk_list_box_insert(GTK_LIST_BOX(list_box),
- back_forward_list_item_new(list_item->data,
- gtk_image_new_from_icon_name("go-next",
- GTK_ICON_SIZE_BUTTON)), -1);
+ back_forward_list_item_new(list_item->data, "forward"),
+ -1);
}
stack = gtk_stack_new();