[gimp/gtk3-port: 337/460] app: kill all except one GtkAlignment, the tag popup one is a bit tricky



commit b73a758e564a9007ee9ac89fd235b4f21d00147d
Author: Michael Natterer <mitch gimp org>
Date:   Fri May 4 12:58:22 2018 +0200

    app: kill all except one GtkAlignment, the tag popup one is a bit tricky

 app/dialogs/resize-dialog.c                 |    8 +---
 app/display/gimpdisplayshell-layer-select.c |   10 +---
 app/widgets/gimpbuffersourcebox.c           |    8 +---
 app/widgets/gimptoolbox.c                   |   66 +++++++++++++++------------
 4 files changed, 42 insertions(+), 50 deletions(-)
---
diff --git a/app/dialogs/resize-dialog.c b/app/dialogs/resize-dialog.c
index 7472ecd..f37c284 100644
--- a/app/dialogs/resize-dialog.c
+++ b/app/dialogs/resize-dialog.c
@@ -113,7 +113,6 @@ resize_dialog_new (GimpViewable       *viewable,
   GtkWidget     *dialog;
   GtkWidget     *main_vbox;
   GtkWidget     *vbox;
-  GtkWidget     *abox;
   GtkWidget     *frame;
   GtkWidget     *button;
   GtkWidget     *spinbutton;
@@ -276,13 +275,10 @@ resize_dialog_new (GimpViewable       *viewable,
                     G_CALLBACK (offset_center_clicked),
                     private);
 
-  abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
-  gtk_widget_show (abox);
-
   frame = gtk_frame_new (NULL);
+  gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (abox), frame);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
   private->area = gimp_offset_area_new (width, height);
diff --git a/app/display/gimpdisplayshell-layer-select.c b/app/display/gimpdisplayshell-layer-select.c
index 023bf1d..e118699 100644
--- a/app/display/gimpdisplayshell-layer-select.c
+++ b/app/display/gimpdisplayshell-layer-select.c
@@ -116,7 +116,6 @@ layer_select_new (GimpDisplayShell *shell,
   GtkWidget   *frame1;
   GtkWidget   *frame2;
   GtkWidget   *hbox;
-  GtkWidget   *alignment;
 
   layer_select = g_slice_new0 (LayerSelect);
 
@@ -151,11 +150,7 @@ layer_select_new (GimpDisplayShell *shell,
   gtk_container_add (GTK_CONTAINER (frame2), hbox);
   gtk_widget_show (hbox);
 
-  /*  The view  */
-  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
-  gtk_widget_show (alignment);
-
+  /*  the view  */
   layer_select->view =
     gimp_view_new_by_types (gimp_get_user_context (image->gimp),
                             GIMP_TYPE_VIEW,
@@ -165,9 +160,8 @@ layer_select_new (GimpDisplayShell *shell,
                                        gimp_display_shell_get_color_config (shell));
   gimp_view_set_viewable (GIMP_VIEW (layer_select->view),
                           GIMP_VIEWABLE (layer));
-  gtk_container_add (GTK_CONTAINER (alignment), layer_select->view);
+  gtk_box_pack_start (GTK_BOX (hbox), layer_select->view, FALSE, FALSE, 0);
   gtk_widget_show (layer_select->view);
-  gtk_widget_show (alignment);
 
   /*  the layer name label */
   layer_select->label = gtk_label_new (gimp_object_get_name (layer));
diff --git a/app/widgets/gimpbuffersourcebox.c b/app/widgets/gimpbuffersourcebox.c
index 2f9f483..056d068 100644
--- a/app/widgets/gimpbuffersourcebox.c
+++ b/app/widgets/gimpbuffersourcebox.c
@@ -145,16 +145,12 @@ static void
 gimp_buffer_source_box_constructed (GObject *object)
 {
   GimpBufferSourceBox *box = GIMP_BUFFER_SOURCE_BOX (object);
-  GtkWidget           *alignment;
-
-  alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
-  gtk_box_pack_start (GTK_BOX (box), alignment, FALSE, FALSE, 0);
-  gtk_widget_show (alignment);
 
   box->priv->toggle = gtk_check_button_new_with_mnemonic (box->priv->name);
+  gtk_widget_set_valign (box->priv->toggle, GTK_ALIGN_CENTER);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->priv->toggle),
                                 box->priv->enabled);
-  gtk_container_add (GTK_CONTAINER (alignment), box->priv->toggle);
+  gtk_box_pack_start (GTK_BOX (box), box->priv->toggle, FALSE, FALSE, 0);
   gtk_widget_show (box->priv->toggle);
 
   g_signal_connect_object (box->priv->toggle, "toggled",
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index dbd09bc..f32543f 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -645,57 +645,63 @@ static GtkWidget *
 toolbox_create_color_area (GimpToolbox *toolbox,
                            GimpContext *context)
 {
-  GtkWidget *alignment;
   GtkWidget *col_area;
 
-  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_container_set_border_width (GTK_CONTAINER (alignment), 2);
-
-  gimp_help_set_help_data (alignment, NULL, GIMP_HELP_TOOLBOX_COLOR_AREA);
-
   col_area = gimp_toolbox_color_area_create (toolbox, 54, 42);
-  gtk_container_add (GTK_CONTAINER (alignment), col_area);
-  gtk_widget_show (col_area);
-
-  return alignment;
+  g_object_set (col_area,
+                "halign",        GTK_ALIGN_CENTER,
+                "valign",        GTK_ALIGN_CENTER,
+                "margin-left",   2,
+                "margin-right",  2,
+                "margin-top",    2,
+                "margin-bottom", 2,
+                NULL);
+
+  gimp_help_set_help_data (col_area, NULL, GIMP_HELP_TOOLBOX_COLOR_AREA);
+
+  return col_area;
 }
 
 static GtkWidget *
 toolbox_create_foo_area (GimpToolbox *toolbox,
                          GimpContext *context)
 {
-  GtkWidget *alignment;
   GtkWidget *foo_area;
 
-  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_container_set_border_width (GTK_CONTAINER (alignment), 2);
-
-  gimp_help_set_help_data (alignment, NULL, GIMP_HELP_TOOLBOX_INDICATOR_AREA);
-
   foo_area = gimp_toolbox_indicator_area_create (toolbox);
-  gtk_container_add (GTK_CONTAINER (alignment), foo_area);
-  gtk_widget_show (foo_area);
-
-  return alignment;
+  g_object_set (foo_area,
+                "halign",        GTK_ALIGN_CENTER,
+                "valign",        GTK_ALIGN_CENTER,
+                "margin-left",   2,
+                "margin-right",  2,
+                "margin-top",    2,
+                "margin-bottom", 2,
+                NULL);
+
+  gimp_help_set_help_data (foo_area, NULL, GIMP_HELP_TOOLBOX_INDICATOR_AREA);
+
+  return foo_area;
 }
 
 static GtkWidget *
 toolbox_create_image_area (GimpToolbox *toolbox,
                            GimpContext *context)
 {
-  GtkWidget *alignment;
   GtkWidget *image_area;
 
-  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_container_set_border_width (GTK_CONTAINER (alignment), 2);
-
-  gimp_help_set_help_data (alignment, NULL, GIMP_HELP_TOOLBOX_IMAGE_AREA);
-
   image_area = gimp_toolbox_image_area_create (toolbox, 52, 42);
-  gtk_container_add (GTK_CONTAINER (alignment), image_area);
-  gtk_widget_show (image_area);
-
-  return alignment;
+  g_object_set (image_area,
+                "halign",        GTK_ALIGN_CENTER,
+                "valign",        GTK_ALIGN_CENTER,
+                "margin-left",   2,
+                "margin-right",  2,
+                "margin-top",    2,
+                "margin-bottom", 2,
+                NULL);
+
+  gimp_help_set_help_data (image_area, NULL, GIMP_HELP_TOOLBOX_IMAGE_AREA);
+
+  return image_area;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]