summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tab-chrome.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 5331d34..1fc1e92 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -50,6 +50,21 @@ back_forward_toggle_button_toggled(GtkToggleButton *toggle_button,
"text" : "list"));
}
+static GtkWidget *
+back_forward_list_item_new(WebKitBackForwardListItem *list_item,
+ GtkWidget *icon)
+{
+ GtkWidget *list_item_box;
+
+ list_item_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_box_pack_start(GTK_BOX(list_item_box), icon, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(list_item_box), gtk_label_new(
+ webkit_back_forward_list_item_get_title(
+ list_item)), TRUE, TRUE, 0);
+
+ return list_item_box;
+}
+
static gboolean
back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
MqTabChrome *chrome)
@@ -57,7 +72,6 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
WebKitBackForwardList *back_forward_list;
GtkWidget *list_box;
GList *list_item;
- GtkWidget *list_item_box;
GtkWidget *stack;
GtkWidget *toggle_button;
GtkWidget *box;
@@ -85,27 +99,19 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
list_item = webkit_back_forward_list_get_back_list(
back_forward_list);
for (; list_item; list_item = list_item->next) {
- list_item_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start(GTK_BOX(list_item_box),
- gtk_image_new_from_icon_name("go-previous",
- GTK_ICON_SIZE_BUTTON), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(list_item_box), gtk_label_new(
- webkit_back_forward_list_item_get_title(
- list_item->data)), TRUE, TRUE, 0);
- gtk_list_box_insert(GTK_LIST_BOX(list_box), list_item_box, 0);
+ 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);
}
list_item = webkit_back_forward_list_get_forward_list(
back_forward_list);
for (; list_item; list_item = list_item->next) {
- list_item_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start(GTK_BOX(list_item_box),
- gtk_image_new_from_icon_name("go-next",
- GTK_ICON_SIZE_BUTTON), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(list_item_box), gtk_label_new(
- webkit_back_forward_list_item_get_title(
- list_item->data)), TRUE, TRUE, 0);
- gtk_list_box_insert(GTK_LIST_BOX(list_box), list_item_box, -1);
+ 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);
}
stack = gtk_stack_new();