[Libreoffice-commits] core.git: vcl/unx

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 22 09:19:45 UTC 2020


 vcl/unx/gtk3/gtk3gtkinst.cxx |   32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

New commits:
commit b218b29b8a9e6cd283b51755496cf4ac70afe56d
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Mon Dec 21 09:48:13 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 22 10:19:00 2020 +0100

    Use gtk_box_pack_start/gtk_grid_attach (vcl/gtk3gtkinst)
    
    Change-Id: I2b6552e9fcd896a2d9552f81e3b730c82ff3878f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108078
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7c9bc451cc10..c01b376c3695 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1817,28 +1817,22 @@ namespace
         }
         g_list_free(pLabels);
 
-        gtk_container_add(GTK_CONTAINER(pParent), pReplacement);
 
         if (GTK_IS_GRID(pParent))
         {
-            gtk_container_child_set(GTK_CONTAINER(pParent), pReplacement,
-                    "left-attach", nTopAttach,
-                    "top-attach", nLeftAttach,
-                    "width", nWidth,
-                    "height", nHeight,
-                    nullptr);
+            gtk_grid_attach(GTK_GRID(pParent), pReplacement, nLeftAttach, nTopAttach, nWidth, nHeight);
         }
 
-        if (GTK_IS_BOX(pParent))
+        else if (GTK_IS_BOX(pParent))
         {
+            gtk_box_pack_start(GTK_BOX(pParent), pReplacement, bExpand, bFill, nPadding);
             gtk_container_child_set(GTK_CONTAINER(pParent), pReplacement,
-                    "expand", bExpand,
-                    "fill", bFill,
                     "pack-type", ePackType,
-                    "padding", nPadding,
                     "position", nPosition,
                     nullptr);
         }
+        else
+            gtk_container_add(GTK_CONTAINER(pParent), pReplacement);
 
         if (gtk_widget_get_hexpand_set(pWidget))
             gtk_widget_set_hexpand(pReplacement, gtk_widget_get_hexpand(pWidget));
@@ -3545,12 +3539,12 @@ public:
         GtkWidget *pItem;
         if (pImage)
         {
-            GtkWidget *pBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
+            GtkBox *pBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6));
             GtkWidget *pLabel = gtk_label_new_with_mnemonic(MapToGtkAccelerator(rStr).getStr());
             pItem = eCheckRadioFalse != TRISTATE_INDET ? gtk_check_menu_item_new() : gtk_menu_item_new();
-            gtk_container_add(GTK_CONTAINER(pBox), pImage);
-            gtk_container_add(GTK_CONTAINER(pBox), pLabel);
-            gtk_container_add(GTK_CONTAINER(pItem), pBox);
+            gtk_box_pack_start(pBox, pImage, true, true, 0);
+            gtk_box_pack_start(pBox, pLabel, true, true, 0);
+            gtk_container_add(GTK_CONTAINER(pItem), GTK_WIDGET(pBox));
             gtk_widget_show_all(pItem);
         }
         else
@@ -8264,12 +8258,12 @@ public:
         GtkWidget *pItem;
         if (pImage)
         {
-            GtkWidget *pBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
+            GtkBox *pBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6));
             GtkWidget *pLabel = gtk_label_new_with_mnemonic(MapToGtkAccelerator(rStr).getStr());
             pItem = eCheckRadioFalse != TRISTATE_INDET ? gtk_check_menu_item_new() : gtk_menu_item_new();
-            gtk_container_add(GTK_CONTAINER(pBox), pImage);
-            gtk_container_add(GTK_CONTAINER(pBox), pLabel);
-            gtk_container_add(GTK_CONTAINER(pItem), pBox);
+            gtk_box_pack_start(pBox, pImage, true, true, 0);
+            gtk_box_pack_start(pBox, pLabel, true, true, 0);
+            gtk_container_add(GTK_CONTAINER(pItem), GTK_WIDGET(pBox));
             gtk_widget_show_all(pItem);
         }
         else


More information about the Libreoffice-commits mailing list