[gtk+/wip/baedert/gtk-widget-destroy: 6/10] testpopover: Explicitly destroy window
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtk-widget-destroy: 6/10] testpopover: Explicitly destroy window
- Date: Tue, 26 Sep 2017 13:08:43 +0000 (UTC)
commit 53bb418aab79552c689b1e29c1ab6825a9e77b54
Author: Timm Bäder <mail baedert org>
Date: Tue Sep 26 12:56:13 2017 +0200
testpopover: Explicitly destroy window
And unref the GtkBuilder instances
tests/testpopover.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/tests/testpopover.c b/tests/testpopover.c
index 19eff54..3db184c 100644
--- a/tests/testpopover.c
+++ b/tests/testpopover.c
@@ -31,6 +31,16 @@ static GActionEntry entries[] = {
{ "action10", activate, NULL, NULL, NULL }
};
+static void
+destroy_and_quit (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ g_message ("%s: %d", __FUNCTION__, G_OBJECT (widget)->ref_count);
+ gtk_window_destroy (GTK_WINDOW (widget));
+ gtk_main_quit ();
+}
+
int
main (int argc, char *argv[])
{
@@ -100,6 +110,7 @@ main (int argc, char *argv[])
gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (button), TRUE);
popover = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button)));
+ g_object_unref (builder);
builder = gtk_builder_new_from_file ("popover2.ui");
popover2 = (GtkWidget *)gtk_builder_get_object (builder, "popover");
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button2), popover2);
@@ -156,10 +167,12 @@ main (int argc, char *argv[])
gtk_grid_attach (GTK_GRID (grid), combo, 2, 5, 1, 1);
- g_signal_connect (win, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (win, "delete-event", G_CALLBACK (destroy_and_quit), NULL);
gtk_widget_show (win);
gtk_main ();
+ g_object_unref (builder);
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]