diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-09-09 13:33:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-09-09 21:06:43 +0200 |
commit | 6ca8cf32d2f879dbead2f402eeef60edd3f0266e (patch) | |
tree | e687a68063255da822e7c2a71076ccbf68fbd49f /sfx2 | |
parent | cea35086310d16f3f53f83fc18c1b8f26bae19da (diff) |
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.mcnamara@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.hxx | 3 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/startcenter.ui | 47 |
3 files changed, 59 insertions, 9 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 3c90d1ea2ade..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); // icon first needed on gtk3 to apply the label + 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> |