From 9ea66998c1041c1ca5b4a19b976f17fb5e57d7ff Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 19 Sep 2017 00:29:01 -0400 Subject: src/tab-chrome.c: Add some comments --- (limited to 'src') diff --git a/src/tab-chrome.c b/src/tab-chrome.c index e828b39..d628473 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -108,24 +108,30 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, GtkWidget *box; GtkWidget *popover; + /* Make sure this is a mouse button press event. Either the middle or + * right button is OK. */ if (event->type != GDK_BUTTON_PRESS) { return FALSE; } + /* Get the back/forward list for the Web view. */ back_forward_list = webkit_web_view_get_back_forward_list( chrome->web_view); + /* Set up the list box. */ 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); + /* 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)); + /* Insert back list items. */ list_item = webkit_back_forward_list_get_back_list( back_forward_list); for (; list_item; list_item = list_item->next) { @@ -133,6 +139,7 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, back_forward_list_item_new(list_item->data, -1), 0); } + /* Insert forward list items. */ list_item = webkit_back_forward_list_get_forward_list( back_forward_list); for (; list_item; list_item = list_item->next) { @@ -140,10 +147,12 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, back_forward_list_item_new(list_item->data, 1), -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"); + /* Set up the toggle button. */ toggle_button = gtk_toggle_button_new(); gtk_button_set_image(GTK_BUTTON(toggle_button), gtk_image_new_from_icon_name("edit-select-all", @@ -153,10 +162,12 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, G_CALLBACK(back_forward_toggle_button_toggled), GTK_STACK(stack)); + /* Set up the containing box. */ box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(box), toggle_button, TRUE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), stack, TRUE, FALSE, 0); + /* Set up the popover. */ popover = gtk_popover_new(widget); gtk_container_add(GTK_CONTAINER(popover), box); -- cgit v0.9.1