sfx2/source/dialog/backingwindow.cxx |   18 +++++++------
 sfx2/source/dialog/backingwindow.hxx |    3 +-
 sfx2/uiconfig/ui/startcenter.ui      |   47 +++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 9 deletions(-)

New commits:
commit 2f5a28d70cab9e9b1c89545dfe658c1c9d119904
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Sep 9 13:33:47 2024 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Fri Sep 13 08:34:14 2024 +0200

    tdf#162732 force centered alignment for donate button text
    
    bit of a bodge, gtk defaults to baseline alignment here, so force
    what we want instead in a separate "Donate" button.
    
    Change-Id: Iac7044c37f2e4c0e48b769c52612a3f5a2dfd350
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173077
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173242
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sfx2/source/dialog/backingwindow.cxx 
b/sfx2/source/dialog/backingwindow.cxx
index 599f2fc28c83..b16a0abce44a 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -170,6 +170,7 @@ BackingWindow::BackingWindow(vcl::Window* i_pParent)
     , mxBrandImageWeld(new weld::CustomWeld(*m_xBuilder, u"daBrand"_ustr, 
*mxBrandImage))
     , mxHelpButton(m_xBuilder->weld_button(u"help"_ustr))
     , mxExtensionsButton(m_xBuilder->weld_button(u"extensions"_ustr))
+    , mxDonateButton(m_xBuilder->weld_button(u"donate"_ustr))
     , mxAllButtonsBox(m_xBuilder->weld_container(u"all_buttons_box"_ustr))
     , mxButtonsBox(m_xBuilder->weld_container(u"buttons_box"_ustr))
     , mxSmallButtonsBox(m_xBuilder->weld_container(u"small_buttons_box"_ustr))
@@ -193,17 +194,19 @@ BackingWindow::BackingWindow(vcl::Window* i_pParent)
     mxHelpButton->set_label(mxAltHelpLabel->get_label());
     mxHelpButton->connect_clicked(LINK(this, BackingWindow, ClickHelpHdl));
 
-    // tdf#161796 make the extension button show the donation page
+    // tdf#161796 replace the extension button with a donate button
     if (officecfg::Office::Common::Misc::ShowDonation::get())
     {
-        mxExtensionsButton->set_from_icon_name(BMP_DONATE);
+        mxExtensionsButton->hide();
+        mxDonateButton->show();
+        mxDonateButton->set_from_icon_name(BMP_DONATE);
         OUString sDonate(SfxResId(STR_DONATE_BUTTON));
         if (sDonate.getLength() > 8)
         {
-            mxExtensionsButton->set_tooltip_text(sDonate);
+            mxDonateButton->set_tooltip_text(sDonate);
             sDonate = OUString::Concat(sDonate.subView(0, 7)) + "...";
         }
-        mxExtensionsButton->set_label(sDonate);
+        mxDonateButton->set_label(sDonate);
     }
 
     mxDropTarget = mxAllRecentThumbnails->GetDropTarget();
@@ -266,6 +269,7 @@ void BackingWindow::dispose()
     mxBrandImageWeld.reset();
     mxBrandImage.reset();
     mxHelpButton.reset();
+    mxDonateButton.reset();
     mxExtensionsButton.reset();
     mxAllButtonsBox.reset();
     mxButtonsBox.reset();
@@ -321,6 +325,7 @@ void BackingWindow::initControls()
     checkInstalledModules();
 
     mxExtensionsButton->connect_clicked(LINK(this, BackingWindow, 
ExtLinkClickHdl));
+    mxDonateButton->connect_clicked(LINK(this, BackingWindow, 
ExtLinkClickHdl));
 
     mxOpenButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
 
@@ -543,11 +548,8 @@ void BackingWindow::setOwningFrame( const 
css::uno::Reference< css::frame::XFram
         xFramesSupplier->setActiveFrame(mxFrame);
 }
 
-IMPL_LINK(BackingWindow, ExtLinkClickHdl, weld::Button&, rButton,void)
+IMPL_STATIC_LINK_NOARG(BackingWindow, ExtLinkClickHdl, weld::Button&, void)
 {
-    if (&rButton != mxExtensionsButton.get())
-       return;
-
     try
     {
         OUString sURL;
diff --git a/sfx2/source/dialog/backingwindow.hxx 
b/sfx2/source/dialog/backingwindow.hxx
index 9fda28572c92..e8ac74f6a143 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -68,6 +68,7 @@ class BackingWindow : public InterimItemWindow
 
     std::unique_ptr<weld::Button> mxHelpButton;
     std::unique_ptr<weld::Button> mxExtensionsButton;
+    std::unique_ptr<weld::Button> mxDonateButton;
 
     std::unique_ptr<weld::Container> mxAllButtonsBox;
     std::unique_ptr<weld::Container> mxButtonsBox;
@@ -95,7 +96,7 @@ class BackingWindow : public InterimItemWindow
     DECL_LINK(ClickHdl, weld::Button&, void);
     DECL_LINK(ClickHelpHdl, weld::Button&, void);
     DECL_LINK(MenuSelectHdl, const OUString&, void);
-    DECL_LINK(ExtLinkClickHdl, weld::Button&, void);
+    DECL_STATIC_LINK(BackingWindow, ExtLinkClickHdl, weld::Button&, void);
     DECL_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void);
     DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
     DECL_LINK(EditTemplateHdl, ThumbnailViewItem*, void);
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 657b1984006f..ea407c1a2df8 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -444,6 +444,53 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkButton" id="donate">
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">True</property>
+                        <property name="no-show-all">True</property>
+                        <property name="relief">none</property>
+                        <property name="use-underline">True</property>
+                        <property name="always-show-image">True</property>
+                        <child>
+                          <object class="GtkBox">
+                            <property name="visible">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <object class="GtkImage" id="donate_image">
+                                <property name="visible">True</property>
+                                <property name="can-focus">False</property>
+                                <property 
name="icon-name">res/donate.png</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can-focus">False</property>
+                                <property name="label" comments="Translated 
via STR_DONATE_BUTTON">Donate</property>
+                                <property name="use-underline">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>

Reply via email to