From d9e8223b038d5a865c7752cc162706f1cccac080 Mon Sep 17 00:00:00 2001 From: nana-4 Date: Fri, 7 Aug 2020 00:54:42 +0900 Subject: [PATCH] gtk-demo: Avoid double borders in the panes demo Using frames for the children of the panes looks bad. --- demos/gtk-demo/panes.c | 46 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c index 134d3bea97..e6312054f1 100644 --- a/demos/gtk-demo/panes.c +++ b/demos/gtk-demo/panes.c @@ -61,10 +61,6 @@ create_pane_options (GtkPaned *paned, child2 = gtk_paned_get_end_child (paned); frame = gtk_frame_new (frame_label); - gtk_widget_set_margin_start (frame, 4); - gtk_widget_set_margin_end (frame, 4); - gtk_widget_set_margin_top (frame, 4); - gtk_widget_set_margin_bottom (frame, 4); table = gtk_grid_new (); gtk_frame_set_child (GTK_FRAME (frame), table); @@ -110,6 +106,7 @@ do_panes (GtkWidget *do_widget) GtkWidget *vpaned; GtkWidget *button; GtkWidget *vbox; + GtkWidget *box; if (!window) { @@ -120,33 +117,42 @@ do_panes (GtkWidget *do_widget) gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets"); - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); + gtk_widget_set_margin_start (vbox, 8); + gtk_widget_set_margin_end (vbox, 8); + gtk_widget_set_margin_top (vbox, 8); + gtk_widget_set_margin_bottom (vbox, 8); gtk_window_set_child (GTK_WINDOW (window), vbox); + frame = gtk_frame_new (NULL); + gtk_box_append (GTK_BOX (vbox), frame); + vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_widget_set_margin_start (vpaned, 5); - gtk_widget_set_margin_end (vpaned, 5); - gtk_widget_set_margin_top (vpaned, 5); - gtk_widget_set_margin_bottom (vpaned, 5); - gtk_box_append (GTK_BOX (vbox), vpaned); + gtk_frame_set_child (GTK_FRAME (frame), vpaned); hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned); - frame = gtk_frame_new (NULL); - gtk_widget_set_size_request (frame, 60, 60); - gtk_paned_set_start_child (GTK_PANED (hpaned), frame); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_size_request (box, 60, 60); + gtk_paned_set_start_child (GTK_PANED (hpaned), box); button = gtk_button_new_with_mnemonic ("_Hi there"); - gtk_frame_set_child (GTK_FRAME (frame), button); + gtk_widget_set_margin_start (button, 4); + gtk_widget_set_margin_end (button, 4); + gtk_widget_set_margin_top (button, 4); + gtk_widget_set_margin_bottom (button, 4); + gtk_widget_set_hexpand (button, TRUE); + gtk_widget_set_vexpand (button, TRUE); + gtk_box_append (GTK_BOX (box), button); - frame = gtk_frame_new (NULL); - gtk_widget_set_size_request (frame, 80, 60); - gtk_paned_set_end_child (GTK_PANED (hpaned), frame); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_size_request (box, 80, 60); + gtk_paned_set_end_child (GTK_PANED (hpaned), box); - frame = gtk_frame_new (NULL); - gtk_widget_set_size_request (frame, 60, 80); - gtk_paned_set_end_child (GTK_PANED (vpaned), frame); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_size_request (box, 60, 80); + gtk_paned_set_end_child (GTK_PANED (vpaned), box); /* Now create toggle buttons to control sizing */