diff options
Reuse the tooltip and set the window title on tab switch
1 files changed, 12 insertions, 0 deletions
| -rw-r--r-- | badwolf.c | 12 |
@@ -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); |