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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 7 11:20:15 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx     |   29 +++++++++++++++++++----------
 vcl/unx/gtk4/convert3to4.cxx |    4 ++++
 2 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 5933071ec7cb34c064206c8e81998a5f99d9aa8b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 7 10:56:09 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 7 13:19:55 2021 +0200

    gtk4: rework remove_id to extract a standalone find_id
    
    Change-Id: I08ce91b78a09ad2db1c8e1aa09abc50fd61e177d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118554
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 2f3c9f8da9bd..8495612b3c82 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -9370,7 +9370,7 @@ private:
         }
     }
 
-    bool remove_id(GMenuModel* pMenuModel, const OString& rId)
+    std::pair<GMenuModel*, int> find_id(GMenuModel* pMenuModel, const OString& rId)
     {
         for (int i = 0, nCount = g_menu_model_get_n_items(pMenuModel); i < nCount; ++i)
         {
@@ -9383,23 +9383,32 @@ private:
             }
 
             if (sTarget == rId)
-            {
-                g_menu_remove(G_MENU(pMenuModel), i);
-                return true;
-            }
+                return std::make_pair(pMenuModel, i);
 
             if (GMenuModel* pSectionModel = g_menu_model_get_item_link(pMenuModel, i, G_MENU_LINK_SECTION))
             {
-                if (remove_id(pSectionModel, rId))
-                    return true;
+                std::pair<GMenuModel*, int> aRet = find_id(pSectionModel, rId);
+                if (aRet.first)
+                    return aRet;
             }
             if (GMenuModel* pSubMenuModel = g_menu_model_get_item_link(pMenuModel, i, G_MENU_LINK_SUBMENU))
             {
-                if (remove_id(pSubMenuModel, rId))
-                    return true;
+                std::pair<GMenuModel*, int> aRet = find_id(pSubMenuModel, rId);
+                if (aRet.first)
+                    return aRet;
             }
         }
-        return false;
+
+        return std::make_pair(nullptr, -1);
+    }
+
+    bool remove_id(GMenuModel* pMenuModel, const OString& rId)
+    {
+        std::pair<GMenuModel*, int> aRes = find_id(pMenuModel, rId);
+        if (!aRes.first)
+            return false;
+        g_menu_remove(G_MENU(aRes.first), aRes.second);
+        return true;
     }
 
 #endif
commit 4c56e02c71cbd0aa374afb5b9f8e2540b0d1149e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 7 10:33:24 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 7 13:19:42 2021 +0200

    gtk4: convert GtkRadioToolButton to GtkCheckButton
    
    Change-Id: If09508de92aba82ea414cd2fb7b7029e96aaf2f9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118553
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx
index cf6ddef2e8a2..9d7fd36ae543 100644
--- a/vcl/unx/gtk4/convert3to4.cxx
+++ b/vcl/unx/gtk4/convert3to4.cxx
@@ -1163,6 +1163,10 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
             {
                 xClass->setNodeValue("GtkMenuButton");
             }
+            else if (sClass == "GtkRadioToolButton")
+            {
+                xClass->setNodeValue("GtkCheckButton");
+            }
             else if (sClass == "GtkToggleToolButton")
             {
                 xClass->setNodeValue("GtkToggleButton");


More information about the Libreoffice-commits mailing list