diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-09-19 00:23:15 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-09-19 00:23:15 (EDT) |
commit | e88f951d4587c166d527ec6726625cf11cc96eb2 (patch) | |
tree | 2d79c1da8c5137c538b7dce9a1feed95e4704c62 /src | |
parent | 61a817c365ddfb646247b1a110607e4422801896 (diff) | |
download | marquee-e88f951d4587c166d527ec6726625cf11cc96eb2.zip marquee-e88f951d4587c166d527ec6726625cf11cc96eb2.tar.gz marquee-e88f951d4587c166d527ec6726625cf11cc96eb2.tar.bz2 |
src/tab-chrome.c: Fix tab history list icon stacks
This is rather hackish, but oh well.
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-chrome.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c index c83e23e..e828b39 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -52,7 +52,7 @@ back_forward_toggle_button_toggled(GtkToggleButton *toggle_button, static GtkWidget * back_forward_list_item_new(WebKitBackForwardListItem *list_item, - const gchar *type) + gint type) { GtkWidget *label; GtkWidget *icon_stack; @@ -63,16 +63,29 @@ back_forward_list_item_new(WebKitBackForwardListItem *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)); + switch (type) { + case 0: + 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"); + break; + case -1: + 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_radio_button_new(NULL), "current"); + break; + case 1: + gtk_stack_add_named(GTK_STACK(icon_stack), + gtk_image_new_from_icon_name("go-next", + GTK_ICON_SIZE_BUTTON), "forward"); + gtk_stack_add_named(GTK_STACK(icon_stack), + gtk_radio_button_new(NULL), "current"); + break; + } box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), icon_stack, FALSE, FALSE, 0); @@ -109,7 +122,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), "current"), -1); + back_forward_list), 0), -1); gtk_list_box_select_row(GTK_LIST_BOX(list_box), gtk_list_box_get_row_at_index(GTK_LIST_BOX(list_box), 0)); @@ -117,16 +130,14 @@ 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, "back"), - 0); + back_forward_list_item_new(list_item->data, -1), 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, "forward"), - -1); + back_forward_list_item_new(list_item->data, 1), -1); } stack = gtk_stack_new(); |