[gimp/gtk3-port: 247/454] Get rid of using GtkMisc API globally



commit 2314537394d765cb002161f1ecd6925ac26ae49f
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 29 01:51:36 2018 +0200

    Get rid of using GtkMisc API globally

 app/dialogs/preferences-dialog-utils.c |    7 +++++-
 app/dialogs/preferences-dialog.c       |    5 +++-
 app/dialogs/tips-dialog.c              |    2 +-
 app/propgui/gimppropgui.c              |    5 +++-
 app/tools/gimpfiltertool.c             |    7 +++++-
 app/tools/gimpgegltool.c               |    5 +++-
 app/widgets/gimpcriticaldialog.c       |    8 +++---
 app/widgets/gimpmessagebox.c           |    5 +--
 app/widgets/gimppanedbox.c             |    8 +++++-
 app/widgets/gimpviewablebox.c          |    2 +-
 app/widgets/gimpviewabledialog.c       |    2 +-
 app/widgets/gimpwidgets-utils.c        |    2 +-
 libgimp/gimpexport.c                   |    4 +-
 libgimpwidgets/gimpenumwidgets.c       |   33 +++++++++++++++++--------------
 libgimpwidgets/gimpquerybox.c          |    2 +-
 libgimpwidgets/gimpwidgets.c           |    5 +++-
 plug-ins/common/file-png.c             |    2 +-
 plug-ins/flame/flame.c                 |    6 +++-
 plug-ins/map-object/map-object-ui.c    |    5 +++-
 plug-ins/screenshot/screenshot.c       |    4 +-
 plug-ins/script-fu/script-fu-console.c |    5 +++-
 21 files changed, 80 insertions(+), 44 deletions(-)
---
diff --git a/app/dialogs/preferences-dialog-utils.c b/app/dialogs/preferences-dialog-utils.c
index a55dab1..e653164 100644
--- a/app/dialogs/preferences-dialog-utils.c
+++ b/app/dialogs/preferences-dialog-utils.c
@@ -160,7 +160,12 @@ prefs_check_button_add_with_icon (GObject      *config,
   gtk_widget_show (hbox);
 
   image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
-  gtk_misc_set_padding (GTK_MISC (image), 2, 2);
+  g_object_set (image,
+                "margin-start",  2,
+                "margin-end",    2,
+                "margin-top",    2,
+                "margin-bottom", 2,
+                NULL);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index ab8fb88..abf2c37 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -2631,7 +2631,10 @@ prefs_dialog_new (Gimp       *gimp,
 
   calibrate_button = gtk_button_new_with_mnemonic (_("C_alibrate..."));
   label = gtk_bin_get_child (GTK_BIN (calibrate_button));
-  gtk_misc_set_padding (GTK_MISC (label), 4, 0);
+  g_object_set (label,
+                "margin-start", 4,
+                "margin-end",   4,
+                NULL);
   gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0);
   gtk_widget_show (calibrate_button);
   gtk_widget_set_sensitive (calibrate_button,
diff --git a/app/dialogs/tips-dialog.c b/app/dialogs/tips-dialog.c
index 8d8df28..8963a31 100644
--- a/app/dialogs/tips-dialog.c
+++ b/app/dialogs/tips-dialog.c
@@ -171,7 +171,7 @@ tips_dialog_create (Gimp *gimp)
 
   image = gtk_image_new_from_icon_name (GIMP_ICON_DIALOG_INFORMATION,
                                         GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 
diff --git a/app/propgui/gimppropgui.c b/app/propgui/gimppropgui.c
index 5f63fc7..c7899af 100644
--- a/app/propgui/gimppropgui.c
+++ b/app/propgui/gimppropgui.c
@@ -521,7 +521,10 @@ gimp_prop_gui_new (GObject                  *config,
       gimp_label_set_attributes (GTK_LABEL (gui),
                                  PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
                                  -1);
-      gtk_misc_set_padding (GTK_MISC (gui), 0, 4);
+      g_object_set (gui,
+                    "margin-top",    4,
+                    "margin-bottom", 4,
+                    NULL);
     }
 
   return gui;
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 7b04949..44d61fc 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -1628,7 +1628,12 @@ gimp_filter_tool_add_color_picker (GimpFilterTool     *filter_tool,
                          NULL);
 
   image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
-  gtk_misc_set_padding (GTK_MISC (image), 2, 2);
+  g_object_set (image,
+                "margin-start",  2,
+                "margin-end",    2,
+                "margin-top",    2,
+                "margin-bottom", 2,
+                NULL);
   gtk_container_add (GTK_CONTAINER (button), image);
   gtk_widget_show (image);
 
diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c
index 3729317..366765e 100644
--- a/app/tools/gimpgegltool.c
+++ b/app/tools/gimpgegltool.c
@@ -487,7 +487,10 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
   gimp_label_set_attributes (GTK_LABEL (options_gui),
                              PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
                              -1);
-  gtk_misc_set_padding (GTK_MISC (options_gui), 0, 4);
+  g_object_set (options_gui,
+                "margin-top",    4,
+                "margin-bottom", 4,
+                NULL);
   gtk_container_add (GTK_CONTAINER (options_box), options_gui);
   g_object_unref (options_box);
   g_weak_ref_set (&o_tool->options_gui_ref, options_gui);
diff --git a/app/widgets/gimpcriticaldialog.c b/app/widgets/gimpcriticaldialog.c
index 3eb2cbb..dc51df8 100644
--- a/app/widgets/gimpcriticaldialog.c
+++ b/app/widgets/gimpcriticaldialog.c
@@ -99,7 +99,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
   gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 
-  vbox = gtk_vbox_new (FALSE, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
   gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                       vbox, TRUE, TRUE, 0);
@@ -107,7 +107,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
 
   /* The error label. */
   dialog->top_label = gtk_label_new (NULL);
-  gtk_misc_set_alignment (GTK_MISC (dialog->top_label), 0.0, 0.5);
+  gtk_widget_set_halign (dialog->top_label, GTK_ALIGN_START);
   gtk_label_set_ellipsize (GTK_LABEL (dialog->top_label), PANGO_ELLIPSIZE_END);
   gtk_label_set_selectable (GTK_LABEL (dialog->top_label), TRUE);
   gtk_box_pack_start (GTK_BOX (vbox), dialog->top_label,
@@ -144,7 +144,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
   dialog->bottom_label = gtk_label_new (text);
   g_free (text);
 
-  gtk_misc_set_alignment (GTK_MISC (dialog->bottom_label), 0.0, 0.5);
+  gtk_widget_set_halign (dialog->bottom_label, GTK_ALIGN_START);
   gtk_label_set_selectable (GTK_LABEL (dialog->bottom_label), TRUE);
   gtk_box_pack_start (GTK_BOX (vbox), dialog->bottom_label,
                       FALSE, FALSE, 0);
@@ -153,7 +153,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
   widget = gtk_label_new (_("You can also close the dialog directly but "
                             "reporting bugs is the best way to make your "
                             "software awesome."));
-  gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+  gtk_widget_set_halign (widget, GTK_ALIGN_START);
   gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
 
   attrs = pango_attr_list_new ();
diff --git a/app/widgets/gimpmessagebox.c b/app/widgets/gimpmessagebox.c
index 5affdee..03c9bb9 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -167,12 +167,11 @@ gimp_message_box_constructed (GObject *object)
 
   if (box->icon_name)
     {
-      gtk_widget_push_composite_child ();
       box->image = gtk_image_new_from_icon_name (box->icon_name,
                                                  GTK_ICON_SIZE_DIALOG);
-      gtk_widget_pop_composite_child ();
 
-      gtk_misc_set_alignment (GTK_MISC (box->image), 0.0, 0.0);
+      gtk_widget_set_halign (box->image, GTK_ALIGN_START);
+      gtk_widget_set_valign (box->image, GTK_ALIGN_START);
       gtk_widget_set_parent (box->image, GTK_WIDGET (box));
       gtk_widget_show (box->image);
     }
diff --git a/app/widgets/gimppanedbox.c b/app/widgets/gimppanedbox.c
index 2f9efb5..8ec6d08 100644
--- a/app/widgets/gimppanedbox.c
+++ b/app/widgets/gimppanedbox.c
@@ -142,8 +142,12 @@ gimp_paned_box_init (GimpPanedBox *paned_box)
    * doesn't contribute to the minimum height of the toolbox.
    */
   paned_box->p->instructions = gtk_label_new (INSTRUCTIONS_TEXT);
-  gtk_misc_set_padding (GTK_MISC (paned_box->p->instructions),
-                        INSTRUCTIONS_TEXT_PADDING, INSTRUCTIONS_TEXT_PADDING);
+  g_object_set (paned_box->p->instructions,
+                "margin-start",  INSTRUCTIONS_TEXT_PADDING,
+                "margin-end",    INSTRUCTIONS_TEXT_PADDING,
+                "margin-top",    INSTRUCTIONS_TEXT_PADDING,
+                "margin-bottom", INSTRUCTIONS_TEXT_PADDING,
+                NULL);
   gtk_label_set_line_wrap (GTK_LABEL (paned_box->p->instructions), TRUE);
   gtk_label_set_justify (GTK_LABEL (paned_box->p->instructions),
                          GTK_JUSTIFY_CENTER);
diff --git a/app/widgets/gimpviewablebox.c b/app/widgets/gimpviewablebox.c
index a85a6f0..856a19a 100644
--- a/app/widgets/gimpviewablebox.c
+++ b/app/widgets/gimpviewablebox.c
@@ -684,7 +684,7 @@ gimp_viewable_box_new (GimpContainer *container,
 
       image = gtk_image_new_from_icon_name (GIMP_ICON_EDIT,
                                             GTK_ICON_SIZE_BUTTON);
-      gtk_misc_set_alignment (GTK_MISC (image), 0.5, 1.0);
+      gtk_widget_set_valign (image, GTK_ALIGN_END);
       gtk_container_add (GTK_CONTAINER (edit_button), image);
       gtk_widget_show (image);
 
diff --git a/app/widgets/gimpviewabledialog.c b/app/widgets/gimpviewabledialog.c
index 8a517c1..93d5225 100644
--- a/app/widgets/gimpviewabledialog.c
+++ b/app/widgets/gimpviewabledialog.c
@@ -118,7 +118,7 @@ gimp_viewable_dialog_init (GimpViewableDialog *dialog)
   gtk_widget_show (hbox);
 
   dialog->icon = gtk_image_new ();
-  gtk_misc_set_alignment (GTK_MISC (dialog->icon), 0.5, 0.0);
+  gtk_widget_set_valign (dialog->icon, GTK_ALIGN_START);
   gtk_box_pack_start (GTK_BOX (hbox), dialog->icon, FALSE, FALSE, 0);
   gtk_widget_show (dialog->icon);
 
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index fa79687..6bc3cb1 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -226,7 +226,7 @@ gimp_table_attach_icon (GtkTable    *table,
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
-  gtk_misc_set_alignment (GTK_MISC (image), 1.0, 0.5);
+  gtk_widget_set_halign (image, GTK_ALIGN_END);
   gtk_table_attach (table, image, 0, 1, row, row + 1,
                     GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (image);
diff --git a/libgimp/gimpexport.c b/libgimp/gimpexport.c
index af9f4da..243aa8c 100644
--- a/libgimp/gimpexport.c
+++ b/libgimp/gimpexport.c
@@ -465,7 +465,7 @@ confirm_save_dialog (const gchar *message,
 
   image = gtk_image_new_from_icon_name ("dialog-warning",
                                         GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 
@@ -548,7 +548,7 @@ export_dialog (GSList      *actions,
 
   image = gtk_image_new_from_icon_name ("dialog-information",
                                         GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 
diff --git a/libgimpwidgets/gimpenumwidgets.c b/libgimpwidgets/gimpenumwidgets.c
index 9c6c190..1270f80 100644
--- a/libgimpwidgets/gimpenumwidgets.c
+++ b/libgimpwidgets/gimpenumwidgets.c
@@ -271,7 +271,7 @@ gimp_enum_radio_frame_new_with_range (GType       enum_type,
  * icon name for each icon is created by appending the enum_value's
  * nick to the given @icon_prefix.
  *
- * Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
+ * Return value: a new horizontal #GtkBox holding a group of #GtkRadioButtons.
  *
  * Since: 2.10
  **/
@@ -318,7 +318,7 @@ gimp_enum_icon_box_new (GType         enum_type,
  * of radio buttons, but additionally it supports limiting the range
  * of available enum values.
  *
- * Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
+ * Return value: a new horizontal #GtkBox holding a group of #GtkRadioButtons.
  *
  * Since: 2.10
  **/
@@ -423,19 +423,22 @@ gimp_enum_icon_box_set_child_padding (GtkWidget *icon_box,
   for (list = children; list; list = g_list_next (list))
     {
       GtkWidget *child = gtk_bin_get_child (GTK_BIN (list->data));
-
-      if (GTK_IS_MISC (child))
-        {
-          GtkMisc *misc = GTK_MISC (child);
-          gint     misc_xpad;
-          gint     misc_ypad;
-
-          gtk_misc_get_padding (misc, &misc_xpad, &misc_ypad);
-
-          gtk_misc_set_padding (misc,
-                                xpad < 0 ? misc_xpad : xpad,
-                                ypad < 0 ? misc_ypad : ypad);
-        }
+      gint       start, end;
+      gint       top, bottom;
+
+      g_object_get (child,
+                    "margin-start",  &start,
+                    "margin-end",    &end,
+                    "margin-top",    &top,
+                    "margin-bottom", &bottom,
+                    NULL);
+
+      g_object_set (child,
+                    "margin-start",  xpad < 0 ? start  : xpad,
+                    "margin-end",    xpad < 0 ? end    : xpad,
+                    "margin-top",    ypad < 0 ? top    : ypad,
+                    "margin-bottom", ypad < 0 ? bottom : ypad,
+                    NULL);
     }
 
   g_list_free (children);
diff --git a/libgimpwidgets/gimpquerybox.c b/libgimpwidgets/gimpquerybox.c
index 7fe8060..2024118 100644
--- a/libgimpwidgets/gimpquerybox.c
+++ b/libgimpwidgets/gimpquerybox.c
@@ -190,7 +190,7 @@ create_query_box (const gchar   *title,
       gtk_widget_show (hbox);
 
       image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
-      gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+      gtk_widget_set_valign (image, GTK_ALIGN_START);
       gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
       gtk_widget_show (image);
     }
diff --git a/libgimpwidgets/gimpwidgets.c b/libgimpwidgets/gimpwidgets.c
index 08ceddb..bd8fe74 100644
--- a/libgimpwidgets/gimpwidgets.c
+++ b/libgimpwidgets/gimpwidgets.c
@@ -519,7 +519,10 @@ gimp_random_seed_new (guint    *seed,
                              "given \"random\" operation"), NULL);
 
   button = gtk_button_new_with_mnemonic (_("_New Seed"));
-  gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))), 2, 0);
+  g_object_set (gtk_bin_get_child (GTK_BIN (button)),
+                "margin-start", 2,
+                "margin-end",   2,
+                NULL);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 5a64954..2f380a0 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -1426,7 +1426,7 @@ offsets_dialog (gint offset_x,
 
   image = gtk_image_new_from_icon_name (GIMP_ICON_DIALOG_QUESTION,
                                         GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 
diff --git a/plug-ins/flame/flame.c b/plug-ins/flame/flame.c
index 4795012..02020e4 100644
--- a/plug-ins/flame/flame.c
+++ b/plug-ins/flame/flame.c
@@ -733,8 +733,10 @@ edit_callback (GtkWidget *widget,
       gtk_widget_show (hbox);
 
       button = gtk_button_new_with_mnemonic( _("_Randomize"));
-      gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))),
-                            2, 0);
+      g_object_set (gtk_bin_get_child (GTK_BIN (button)),
+                    "margin-start", 2,
+                    "margin-end",   2,
+                    NULL);
       gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
       gtk_widget_show (button);
 
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index 8a8c076..a9b4c95 100644
--- a/plug-ins/map-object/map-object-ui.c
+++ b/plug-ins/map-object/map-object-ui.c
@@ -1384,7 +1384,10 @@ main_dialog (GimpDrawable *drawable)
   gtk_widget_show (hbox);
 
   button = gtk_button_new_with_mnemonic (_("_Preview!"));
-  gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))), 2, 0);
+  g_object_set (gtk_bin_get_child (GTK_BIN (button)),
+                "margin-start", 2,
+                "margin-end",   2,
+                NULL);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
diff --git a/plug-ins/screenshot/screenshot.c b/plug-ins/screenshot/screenshot.c
index b5d5278..1d1f50f 100644
--- a/plug-ins/screenshot/screenshot.c
+++ b/plug-ins/screenshot/screenshot.c
@@ -700,7 +700,7 @@ shoot_dialog (GdkScreen **screen)
   label = gtk_label_new (_("seconds"));
   gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
                     GTK_EXPAND | GTK_FILL, GTK_SHRINK, 1.0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.1, 0.5);
+  gtk_widget_set_halign (label, GTK_ALIGN_START);
   gtk_widget_show (label);
 
   /*  Selection delay hints  */
@@ -763,7 +763,7 @@ shoot_dialog (GdkScreen **screen)
   label = gtk_label_new (_("seconds"));
   gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
                     GTK_EXPAND | GTK_FILL, GTK_SHRINK, 1.0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.1, 0.5);
+  gtk_widget_set_halign (label, GTK_ALIGN_START);
   gtk_widget_show (label);
 
   /*  Screenshot delay hints  */
diff --git a/plug-ins/script-fu/script-fu-console.c b/plug-ins/script-fu/script-fu-console.c
index 20d8565..3864906 100644
--- a/plug-ins/script-fu/script-fu-console.c
+++ b/plug-ins/script-fu/script-fu-console.c
@@ -230,7 +230,10 @@ script_fu_console_interface (void)
                     &console);
 
   button = gtk_button_new_with_mnemonic (_("_Browse..."));
-  gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))), 2, 0);
+  g_object_set (gtk_bin_get_child (GTK_BIN (button)),
+                "margin-start", 2,
+                "margin-end",   2,
+                NULL);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
 


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