summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-18 18:50:50 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-18 18:50:50 (EDT)
commita015433bb66697c11c2163ab3e0cca7bdb00d0fe (patch)
treeee1ce0499a1f5478502b2979365403c9f49297d9 /src
parent9b4f934fde6bf75a32fedf98fcaf51870112d9ca (diff)
downloadmarquee-a015433bb66697c11c2163ab3e0cca7bdb00d0fe.zip
marquee-a015433bb66697c11c2163ab3e0cca7bdb00d0fe.tar.gz
marquee-a015433bb66697c11c2163ab3e0cca7bdb00d0fe.tar.bz2
src/tab-chrome.c: Implement basic tab history list
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 7a9aba9..2d8fb8f 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -54,17 +54,51 @@ static gboolean
back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
MqTabChrome *chrome)
{
- GtkWidget *stack;
- GtkWidget *toggle_button;
- GtkWidget *box;
- GtkWidget *popover;
+ WebKitBackForwardList *back_forward_list;
+ GtkWidget *list_box;
+ GList *list_item;
+ GtkWidget *stack;
+ GtkWidget *toggle_button;
+ GtkWidget *box;
+ GtkWidget *popover;
if (event->type != GDK_BUTTON_PRESS) {
return FALSE;
}
+ back_forward_list = webkit_web_view_get_back_forward_list(
+ chrome->web_view);
+
+ list_box = gtk_list_box_new();
+ gtk_list_box_set_selection_mode(GTK_LIST_BOX(list_box),
+ GTK_SELECTION_BROWSE);
+ gtk_list_box_set_activate_on_single_click(GTK_LIST_BOX(list_box), TRUE);
+
+ gtk_list_box_insert(GTK_LIST_BOX(list_box), gtk_label_new(
+ webkit_back_forward_list_item_get_title(
+ webkit_back_forward_list_get_current_item(
+ back_forward_list))), -1);
+ gtk_list_box_select_row(GTK_LIST_BOX(list_box),
+ gtk_list_box_get_row_at_index(GTK_LIST_BOX(list_box), 0));
+
+ list_item = webkit_back_forward_list_get_back_list(
+ back_forward_list);
+ for (; list_item; list_item = list_item->next) {
+ gtk_list_box_insert(GTK_LIST_BOX(list_box), gtk_label_new(
+ webkit_back_forward_list_item_get_title(
+ list_item->data)), 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), gtk_label_new(
+ webkit_back_forward_list_item_get_title(
+ list_item->data)), -1);
+ }
+
stack = gtk_stack_new();
- gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("List"), "list");
+ gtk_stack_add_named(GTK_STACK(stack), list_box, "list");
gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("Text"), "text");
toggle_button = gtk_toggle_button_new();