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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 7 19:33:57 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx     |    1 +
 vcl/unx/gtk4/convert3to4.cxx |   31 ++++++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit f9b721bb6fb243465029273265b757288cf391c9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 6 21:28:40 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jun 7 21:33:14 2021 +0200

    gtk4: convert pack-type to child type
    
    Change-Id: Id72572b1b97917b9cf3816b1abaa1e412ed028a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116766
    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 533e2628cf6f..470ada586aa2 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22059,6 +22059,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
         rUIFile != "sfx/ui/printeroptionsdialog.ui" &&
         rUIFile != "sfx/ui/securityinfopage.ui" &&
         rUIFile != "sfx/ui/singletabdialog.ui" &&
+        rUIFile != "sfx/ui/templatecategorydlg.ui" &&
         rUIFile != "sfx/ui/templatedlg.ui" &&
         rUIFile != "svt/ui/addresstemplatedialog.ui" &&
         rUIFile != "svt/ui/datewindow.ui" &&
diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx
index 51649c981503..78e2f0dd7314 100644
--- a/vcl/unx/gtk4/convert3to4.cxx
+++ b/vcl/unx/gtk4/convert3to4.cxx
@@ -631,8 +631,6 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
                                     if (sPropName == "icon-name")
                                     {
                                         OUString sIconName(xProp->getFirstChild()->getNodeValue());
-                                        fprintf(stderr, "icon name is %s\n",
-                                                sIconName.toUtf8().getStr());
                                         auto xIconName
                                             = CreateProperty(xDoc, "icon-name", sIconName);
                                         xObjectCandidate->insertBefore(xIconName, xChild);
@@ -678,8 +676,10 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
                     bContentArea = true;
                 }
                 else if (sName == "accessible")
-                    xRemoveList.push_back(
-                        xChild); // Yikes!, what's the replacement for this going to be
+                {
+                    // TODO what's the replacement for this going to be?
+                    xRemoveList.push_back(xChild);
+                }
             }
 
             if (bContentArea)
@@ -759,6 +759,26 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
                             xParent, css::uno::UNO_QUERY_THROW);
                         xElem->setAttributeNode(xTypeStart);
                     }
+                    else if (sName == "pack-type")
+                    {
+                        // turn parent tag of <child> into <child type="start">
+                        auto xParent = xChild->getParentNode();
+
+                        css::uno::Reference<css::xml::dom::XNamedNodeMap> xParentMap
+                            = xParent->getAttributes();
+                        css::uno::Reference<css::xml::dom::XNode> xParentType
+                            = xParentMap->getNamedItem("type");
+                        assert(!xParentType || xParentType->getNodeValue() == "titlebar");
+                        if (!xParentType)
+                        {
+                            css::uno::Reference<css::xml::dom::XAttr> xTypeStart
+                                = xDoc->createAttribute("type");
+                            xTypeStart->setValue(xCurrent->getFirstChild()->getNodeValue());
+                            css::uno::Reference<css::xml::dom::XElement> xElem(
+                                xParent, css::uno::UNO_QUERY_THROW);
+                            xElem->setAttributeNode(xTypeStart);
+                        }
+                    }
                 }
                 xNew->appendChild(xChild->removeChild(xCurrent));
             }
@@ -1036,7 +1056,8 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
                 xChild->appendChild(CreateProperty(xDoc, "visible", "False"));
             }
 
-            if (bChildAlwaysShowImage)
+            // only create the child box for GtkButton/GtkToggleButton
+            if (bChildAlwaysShowImage && sClass != "GtkMenuButton")
             {
                 auto xImageCandidateNode = xChild->getLastChild();
                 if (xImageCandidateNode && xImageCandidateNode->getNodeName() != "child")


More information about the Libreoffice-commits mailing list