From 61a817c365ddfb646247b1a110607e4422801896 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Sep 2017 23:41:27 -0400 Subject: src/tab-chrome.c: Make tab history list icon stacks Still doesn't quite work. The wrong child is visible on most stacks. --- (limited to 'src') 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(); -- cgit v0.9.1