diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-chrome.c | 38 |
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"); |