commit: cb24140774805c6133d352d52a325bcd21b79b28
parent f14db688dc911b2720d030becb7482ddd2fcdff4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 29 Mar 2019 17:19:18 +0100
Reuse the tooltip and set the window title on tab switch
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -456,6 +456,17 @@ void closeCb_clicked(GtkButton *close, gpointer user_data)
webkit_web_view_try_close(browser->webView);
}
+static void
+notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data)
+{
+ (void)page_num;
+ struct Window *window = (struct Window *)user_data;
+ GtkWidget *label = gtk_notebook_get_tab_label(notebook, page);
+
+ // TODO: Maybe find a better way to store the title
+ gtk_window_set_title(GTK_WINDOW(window->main_window), gtk_widget_get_tooltip_text(label));
+}
+
int main(int argc, char *argv[])
{
struct Window *window = g_malloc(sizeof(struct Client));
@@ -497,6 +508,7 @@ int main(int argc, char *argv[])
g_signal_connect(window->main_window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(window->new_tab, "clicked", G_CALLBACK(new_tabCb_clicked), window);
+ g_signal_connect(window->notebook, "switch-page", G_CALLBACK(notebookCb_switch__page), window);
gtk_widget_show(window->new_tab);
gtk_widget_show_all(window->main_window);