summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-20 14:25:21 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-20 14:30:20 (EDT)
commit38930768973a8311b12d63a540577d5cc200ec79 (patch)
treeca26bc1d3b5164301a85d07bd3367314b3668b80 /src
parent6dca6f6e6765f1ecc1e7c397f27f116e3cd77cfc (diff)
downloadmarquee-38930768973a8311b12d63a540577d5cc200ec79.zip
marquee-38930768973a8311b12d63a540577d5cc200ec79.tar.gz
marquee-38930768973a8311b12d63a540577d5cc200ec79.tar.bz2
src/tab-chrome.c: Fix order of forward list items
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index e724809..83bb37c 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -124,8 +124,8 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
GtkWidget *list_box;
GtkWidget *text_view;
GtkTextBuffer *text_buffer;
- GtkTextIter text_iter;
GList *list_item;
+ GtkTextIter text_iter;
gchar *str;
GtkWidget *stack;
GtkWidget *toggle_button;
@@ -154,10 +154,25 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view));
gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view), FALSE);
+ /* Insert forward list items. */
+ /* The forward list is backwards, so we need to prepend each item to our
+ * list box and text buffer. */
+ list_item = webkit_back_forward_list_get_forward_list(
+ back_forward_list);
+ for (; list_item; list_item = list_item->next) {
+ gtk_list_box_prepend(GTK_LIST_BOX(list_box),
+ back_forward_list_item_new(list_item->data, 1));
+ gtk_text_buffer_get_start_iter(text_buffer, &text_iter);
+ str = g_strdup_printf("\n%s",
+ webkit_back_forward_list_item_get_uri(list_item->data));
+ gtk_text_buffer_insert(text_buffer, &text_iter, str, -1);
+ g_free(str);
+ }
+
/* Insert the current item. */
- gtk_list_box_insert(GTK_LIST_BOX(list_box), back_forward_list_item_new(
+ gtk_list_box_prepend(GTK_LIST_BOX(list_box), back_forward_list_item_new(
webkit_back_forward_list_get_current_item(
- back_forward_list), 0), -1);
+ back_forward_list), 0));
gtk_list_box_select_row(GTK_LIST_BOX(list_box),
gtk_list_box_get_row_at_index(GTK_LIST_BOX(list_box), 0));
gtk_text_buffer_get_start_iter(text_buffer, &text_iter);
@@ -171,8 +186,8 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
back_forward_list);
chrome->back_items = 0;
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, -1), 0);
+ gtk_list_box_prepend(GTK_LIST_BOX(list_box),
+ back_forward_list_item_new(list_item->data, -1));
gtk_text_buffer_get_start_iter(text_buffer, &text_iter);
str = g_strdup_printf("%s\n",
webkit_back_forward_list_item_get_uri(list_item->data));
@@ -181,19 +196,6 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
++chrome->back_items;
}
- /* Insert forward list items. */
- 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, 1), -1);
- gtk_text_buffer_get_end_iter(text_buffer, &text_iter);
- str = g_strdup_printf("\n%s",
- webkit_back_forward_list_item_get_uri(list_item->data));
- gtk_text_buffer_insert(text_buffer, &text_iter, str, -1);
- g_free(str);
- }
-
/* Set up the stack. */
stack = gtk_stack_new();
gtk_stack_add_named(GTK_STACK(stack), list_box, "list");