[gtk+/wip/baedert/gtk-widget-destroy: 7/10] gtkswitch: Explicitly destroy toplevel
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtk-widget-destroy: 7/10] gtkswitch: Explicitly destroy toplevel
- Date: Tue, 26 Sep 2017 13:08:49 +0000 (UTC)
commit 76f1ec7c2a00faa2fd1b05ed287c349a6da84cbe
Author: Timm Bäder <mail baedert org>
Date: Tue Sep 26 12:57:21 2017 +0200
gtkswitch: Explicitly destroy toplevel
tests/testswitch.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/tests/testswitch.c b/tests/testswitch.c
index 4c80d36..00f53fc 100644
--- a/tests/testswitch.c
+++ b/tests/testswitch.c
@@ -147,6 +147,16 @@ make_delayed_switch (gboolean is_on,
return hbox;
}
+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[])
{
GtkWidget *window;
@@ -184,6 +194,7 @@ int main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox);
+ g_signal_connect (window, "delete-event", G_CALLBACK (destroy_and_quit), NULL);
gtk_main ();
return EXIT_SUCCESS;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]