[gtk+/gtk-3-22] testheightforwidth: cleanups
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] testheightforwidth: cleanups
- Date: Tue, 7 Mar 2017 09:32:50 +0000 (UTC)
commit 5bdc85d34e89389cf8bbf53eda484014252f2c55
Author: Daniel Boles <dboles src gnome org>
Date: Tue Mar 7 09:17:29 2017 +0000
testheightforwidth: cleanups
tests/testheightforwidth.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/tests/testheightforwidth.c b/tests/testheightforwidth.c
index cb76f19..a27ad5c 100644
--- a/tests/testheightforwidth.c
+++ b/tests/testheightforwidth.c
@@ -926,7 +926,7 @@ static TestInterface interfaces[] = {
static void
test_clicked (GtkWidget *button,
- TestInterface *interface)
+ TestInterface *interface)
{
if (!interface->window)
{
@@ -948,8 +948,8 @@ test_clicked (GtkWidget *button,
interface->window = (GtkWidget *)gtk_builder_get_object (builder, "window");
- g_signal_connect (interface->window, "delete_event",
- G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+ g_signal_connect (interface->window, "delete_event",
+ G_CALLBACK (gtk_widget_hide_on_delete), NULL);
g_object_unref (builder);
}
@@ -969,7 +969,6 @@ create_window (void)
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
- gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (window), vbox);
for (i = 0; i < G_N_ELEMENTS (interfaces); i++)
@@ -978,28 +977,29 @@ create_window (void)
gtk_widget_set_tooltip_text (button, interfaces[i].tooltip);
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (test_clicked), &interfaces[i]);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (test_clicked), &interfaces[i]);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
}
return window;
}
-static void
+static gboolean
main_window_delete_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
- for (gsize i = 0; i < sizeof(interfaces) / sizeof(TestInterface); ++i)
+ for (gsize i = 0; i < G_N_ELEMENTS (interfaces); ++i)
{
if (interfaces[i].window)
- {
- gtk_widget_destroy (interfaces[i].window);
- }
+ gtk_widget_destroy (interfaces[i].window);
}
+ gtk_widget_destroy (widget);
+
gtk_main_quit ();
+
+ return TRUE;
}
int
@@ -1014,7 +1014,7 @@ main (int argc, char *argv[])
g_signal_connect (window, "delete-event",
G_CALLBACK (main_window_delete_cb), window);
- gtk_widget_show (window);
+ gtk_widget_show_all (window);
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]