commit: c55a5d9413ccbe4c861d6d9256366ef31b7fa9d8
parent: 25f7403ecc0f90d89eb87435d65dfca5b612672b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 12 Mar 2019 06:13:01 +0100
Revert "badwolf.c: Move close-tab button to the toolbar"
This reverts commit d99a4249b78a0097043618a4ca39453044e42045.
Diffstat:
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -23,7 +23,6 @@ struct Client
GtkWidget *javascript;
GtkWidget *location;
GtkWidget *search;
- GtkWidget *close;
GtkWidget *statusbar;
WebKitWebView *webView;
@@ -109,6 +108,7 @@ GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser)
{
(void)browser;
GtkWidget *tab_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ GtkWidget *close = gtk_button_new_from_icon_name("window-close", GTK_ICON_SIZE_SMALL_TOOLBAR);
GtkWidget *label = gtk_label_new(title);
GtkWidget *playing =
gtk_image_new_from_icon_name("media-playback-start-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
@@ -119,6 +119,11 @@ GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser)
gtk_box_pack_start(GTK_BOX(tab_box), playing, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(tab_box), label, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(tab_box), close, TRUE, TRUE, 0);
+
+ gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);
+
+ g_signal_connect(close, "clicked", G_CALLBACK(closeCb_clicked), browser);
gtk_widget_set_tooltip_text(tab_box, title);
@@ -299,7 +304,6 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
browser->location = gtk_entry_new();
browser->search = gtk_search_entry_new();
browser->javascript = gtk_check_button_new();
- browser->close = gtk_button_new_from_icon_name("window-close", GTK_ICON_SIZE_SMALL_TOOLBAR);
browser->statusbar = gtk_label_new(NULL);
if(related_web_view == NULL)
@@ -321,13 +325,11 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
browser->webView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_related_view(related_web_view));
}
- gtk_widget_set_tooltip_text(browser->close, "Close current tab");
gtk_widget_set_tooltip_text(browser->javascript, "Toggle javascript");
gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->javascript), FALSE, FALSE, BADWOLF_TOOLBAR_PADDING);
gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->location), TRUE, TRUE, BADWOLF_TOOLBAR_PADDING);
gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->search), FALSE, FALSE, BADWOLF_TOOLBAR_PADDING);
- gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->close), FALSE, FALSE, BADWOLF_TOOLBAR_PADDING);
gtk_box_pack_start(GTK_BOX(browser->box), GTK_WIDGET(browser->toolbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
gtk_box_pack_start(GTK_BOX(browser->box), GTK_WIDGET(browser->webView), TRUE, TRUE, BADWOLF_BOX_PADDING);
@@ -346,7 +348,6 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
g_signal_connect(browser->location, "activate", G_CALLBACK(locationCb_activate), browser);
g_signal_connect(browser->javascript, "toggled", G_CALLBACK(javascriptCb_toggled), browser);
- g_signal_connect(browser->close, "clicked", G_CALLBACK(closeCb_clicked), browser);
g_signal_connect(browser->webView,
"web-process-terminated",
@@ -432,9 +433,13 @@ void closeCb_clicked(GtkButton *close, gpointer user_data)
(void)close;
struct Client *browser = (struct Client *)user_data;
GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook);
+ GValue *position;
+
+ gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", position);
- gtk_notebook_remove_page(notebook, gtk_notebook_get_current_page(notebook));
+ gint *page_pos = (gint *)g_value_peek_pointer(position);
+ gtk_notebook_remove_page(notebook, *page_pos);
free(browser);
}