demo: Fix "Expander" demonstration

The expander window is not a dialog anymore, so attempting connecting to
its "response" is invalid and throws a critical:
  signal 'response' is invalid for instance '<PTR>' of type 'GtkWindow'
This commit is contained in:
Florian "sp1rit"​ 2024-10-31 08:59:49 +01:00
parent ac37d66bd5
commit 56f0735e2b
No known key found for this signature in database
GPG Key ID: B1F4055D8460CE34

View File

@ -12,11 +12,13 @@
static GtkWidget *window = NULL;
static void
response_cb (GtkDialog *dialog, int response_id)
static gboolean
close_request_cb (GtkWidget *win, gpointer user_data)
{
gtk_window_destroy (GTK_WINDOW (window));
g_assert (window == win);
gtk_window_destroy ((GtkWindow *)window);
window = NULL;
return TRUE;
}
static void
@ -117,7 +119,7 @@ do_expander (GtkWidget *do_widget)
g_signal_connect (expander, "notify::expanded",
G_CALLBACK (expander_cb), window);
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
g_signal_connect (window, "close-request", G_CALLBACK (close_request_cb), NULL);
}
if (!gtk_widget_get_visible (window))