diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-09-19 02:00:01 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-09-19 02:00:01 (EDT) |
commit | bcbd5b2759c8d4ad7221d6abfaf586a56b9c0da8 (patch) | |
tree | 1614fce65ffe06d4995059b5fd8d8f31365a388c /src | |
parent | 43772f9dae00572d94d6ffe9e331513724dc5dda (diff) | |
download | marquee-bcbd5b2759c8d4ad7221d6abfaf586a56b9c0da8.zip marquee-bcbd5b2759c8d4ad7221d6abfaf586a56b9c0da8.tar.gz marquee-bcbd5b2759c8d4ad7221d6abfaf586a56b9c0da8.tar.bz2 |
src/tab-chrome.c: Add tab history text view
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-chrome.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c index c9b7dca..9326ca0 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -114,6 +114,9 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, { WebKitBackForwardList *back_forward_list; GtkWidget *list_box; + GtkWidget *text_view; + GtkTextBuffer *text_buffer; + GtkTextIter text_iter; GList *list_item; GtkWidget *stack; GtkWidget *toggle_button; @@ -137,12 +140,22 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, g_signal_connect(list_box, "row-activated", G_CALLBACK(back_forward_list_box_row_activated_cb), chrome); + /* Set up the text view. */ + text_view = gtk_text_view_new(); + text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view)); + gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view), FALSE); + /* Insert the current item. */ gtk_list_box_insert(GTK_LIST_BOX(list_box), back_forward_list_item_new( webkit_back_forward_list_get_current_item( 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)); + gtk_text_buffer_get_start_iter(text_buffer, &text_iter); + gtk_text_buffer_insert(text_buffer, &text_iter, + webkit_back_forward_list_item_get_uri( + webkit_back_forward_list_get_current_item( + back_forward_list)), -1); /* Insert back list items. */ list_item = webkit_back_forward_list_get_back_list( @@ -151,6 +164,11 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, 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_text_buffer_get_start_iter(text_buffer, &text_iter); + gtk_text_buffer_insert(text_buffer, &text_iter, + g_strdup_printf("%s\n", + webkit_back_forward_list_item_get_uri( + list_item->data)), -1); ++chrome->back_items; } @@ -160,12 +178,17 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, 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); + gtk_text_buffer_insert(text_buffer, &text_iter, + g_strdup_printf("\n%s", + webkit_back_forward_list_item_get_uri( + list_item->data)), -1); } /* Set up the stack. */ stack = gtk_stack_new(); gtk_stack_add_named(GTK_STACK(stack), list_box, "list"); - gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("Text"), "text"); + gtk_stack_add_named(GTK_STACK(stack), text_view, "text"); /* Set up the toggle button. */ toggle_button = gtk_toggle_button_new(); |