From 8b38d1895c166cf93a3c2150f452b3d8277dc4ed Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 5 Sep 2020 22:54:16 -0400 Subject: [PATCH] gtk-demo: Simplify the constraints demos Give them all a close button in the header. --- demos/gtk-demo/constraints.c | 12 +----------- demos/gtk-demo/constraints2.c | 12 +----------- demos/gtk-demo/constraints3.c | 12 +----------- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/demos/gtk-demo/constraints.c b/demos/gtk-demo/constraints.c index fc6eb5d72b..6f842008fb 100644 --- a/demos/gtk-demo/constraints.c +++ b/demos/gtk-demo/constraints.c @@ -254,15 +254,11 @@ do_constraints (GtkWidget *do_widget) if (!window) { - GtkWidget *header, *box, *grid, *button; + GtkWidget *box, *grid; window = gtk_window_new (); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Constraints"); - - header = gtk_header_bar_new (); - gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE); - gtk_window_set_titlebar (GTK_WINDOW (window), header); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); @@ -272,12 +268,6 @@ do_constraints (GtkWidget *do_widget) gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE); gtk_box_append (GTK_BOX (box), grid); - - button = gtk_button_new_with_label ("Close"); - gtk_box_append (GTK_BOX (box), button); - gtk_widget_set_hexpand (grid, TRUE); - g_signal_connect_swapped (button, "clicked", - G_CALLBACK (gtk_window_destroy), window); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/constraints2.c b/demos/gtk-demo/constraints2.c index 01c898f24b..8e804592ed 100644 --- a/demos/gtk-demo/constraints2.c +++ b/demos/gtk-demo/constraints2.c @@ -210,15 +210,11 @@ do_constraints2 (GtkWidget *do_widget) if (!window) { - GtkWidget *header, *box, *grid, *button; + GtkWidget *box, *grid; window = gtk_window_new (); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Constraints"); - - header = gtk_header_bar_new (); - gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE); - gtk_window_set_titlebar (GTK_WINDOW (window), header); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); @@ -228,12 +224,6 @@ do_constraints2 (GtkWidget *do_widget) gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE); gtk_box_append (GTK_BOX (box), grid); - - button = gtk_button_new_with_label ("Close"); - gtk_box_append (GTK_BOX (box), button); - gtk_widget_set_hexpand (grid, TRUE); - g_signal_connect_swapped (button, "clicked", - G_CALLBACK (gtk_window_destroy), window); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/constraints3.c b/demos/gtk-demo/constraints3.c index 64d484abb6..0cb9b97702 100644 --- a/demos/gtk-demo/constraints3.c +++ b/demos/gtk-demo/constraints3.c @@ -130,15 +130,11 @@ do_constraints3 (GtkWidget *do_widget) if (!window) { - GtkWidget *header, *box, *grid, *button; + GtkWidget *box, *grid; window = gtk_window_new (); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Constraints"); - - header = gtk_header_bar_new (); - gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE); - gtk_window_set_titlebar (GTK_WINDOW (window), header); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); @@ -148,12 +144,6 @@ do_constraints3 (GtkWidget *do_widget) gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE); gtk_box_append (GTK_BOX (box), grid); - - button = gtk_button_new_with_label ("Close"); - gtk_box_append (GTK_BOX (box), button); - gtk_widget_set_hexpand (grid, TRUE); - g_signal_connect_swapped (button, "clicked", - G_CALLBACK (gtk_window_destroy), window); } if (!gtk_widget_get_visible (window))