From 13b4500f52c42256259bdaaa3e8056026fb9441c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Jul 2015 11:58:38 -0400 Subject: [PATCH] widget-factory: hook up callbacks to the tab close buttons Just to show that buttons in notebook tabs work. --- demos/widget-factory/widget-factory.c | 15 +++++++++++++++ demos/widget-factory/widget-factory.ui | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index 76bc11f714..f17894d47d 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -1226,6 +1226,20 @@ open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button gtk_widget_set_sensitive (button, strlen (text) > 0); } +static gboolean +show_page_again (gpointer data) +{ + gtk_widget_show (GTK_WIDGET (data)); + return G_SOURCE_REMOVE; +} + +static void +tab_close_cb (GtkWidget *page) +{ + gtk_widget_hide (page); + g_timeout_add (2500, show_page_again, page); +} + static void activate (GApplication *app) { @@ -1274,6 +1288,7 @@ activate (GApplication *app) gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed); gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed); gtk_builder_add_callback_symbol (builder, "osd_frame_button_press", (GCallback)osd_frame_button_press); + gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb); gtk_builder_connect_signals (builder, NULL); diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui index a0b78d3c22..fc6459dda7 100644 --- a/demos/widget-factory/widget-factory.ui +++ b/demos/widget-factory/widget-factory.ui @@ -3476,7 +3476,7 @@ microphone-sensitivity-medium-symbolic True False - + True 120 @@ -3498,6 +3498,7 @@ microphone-sensitivity-medium-symbolic True none False + @@ -3516,7 +3517,7 @@ microphone-sensitivity-medium-symbolic - + True True @@ -3538,6 +3539,7 @@ microphone-sensitivity-medium-symbolic True none False +