[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 19 07:46:06 UTC 2021
vcl/unx/gtk3/gtkinst.cxx | 74 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 64 insertions(+), 10 deletions(-)
New commits:
commit 1815aa9472080b9dac263d393b9c922dd16351fe
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 18 20:44:56 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 19 09:45:26 2021 +0200
GtkCheckButton no longer inherits from GtkToggleButton
Change-Id: If99a65b19ec04ba4be69730b2c60f53edac9c684
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115771
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 0a5d191e3833..dc3fa90f7dec 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8115,11 +8115,7 @@ public:
virtual bool get_inconsistent() const override
{
-#if !GTK_CHECK_VERSION(4, 0, 0)
return gtk_toggle_button_get_inconsistent(m_pToggleButton);
-#else
- return false;
-#endif
}
virtual void disable_notify_events() override
@@ -9822,20 +9818,78 @@ public:
}
};
-class GtkInstanceRadioButton : public GtkInstanceToggleButton, public virtual weld::RadioButton
+class GtkInstanceCheckButton : public GtkInstanceButton, public virtual weld::CheckButton
{
+private:
+ GtkCheckButton* m_pCheckButton;
+ gulong m_nSignalId;
+
+ static void signalToggled(void*, gpointer widget)
+ {
+ GtkInstanceCheckButton* pThis = static_cast<GtkInstanceCheckButton*>(widget);
+ SolarMutexGuard aGuard;
+ pThis->signal_toggled();
+ }
+
public:
- GtkInstanceRadioButton(GtkRadioButton* pButton, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
- : GtkInstanceToggleButton(GTK_TOGGLE_BUTTON(pButton), pBuilder, bTakeOwnership)
+ GtkInstanceCheckButton(GtkCheckButton* pButton, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : GtkInstanceButton(GTK_BUTTON(pButton), pBuilder, bTakeOwnership)
+ , m_pCheckButton(pButton)
+ , m_nSignalId(g_signal_connect(m_pCheckButton, "toggled", G_CALLBACK(signalToggled), this))
+ {
+ }
+
+ virtual void set_active(bool active) override
+ {
+ disable_notify_events();
+#if GTK_CHECK_VERSION(4, 0, 0)
+ gtk_check_button_set_inconsistent(m_pCheckButton, false);
+ gtk_check_button_set_active(m_pCheckButton, active);
+#else
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(m_pCheckButton), false);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pCheckButton), active);
+#endif
+ enable_notify_events();
+ }
+
+ virtual bool get_active() const override
{
+#if GTK_CHECK_VERSION(4, 0, 0)
+ return gtk_check_button_get_active(m_pCheckButton);
+#else
+ return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_pCheckButton));
+#endif
+ }
+
+ virtual void set_inconsistent(bool inconsistent) override
+ {
+#if GTK_CHECK_VERSION(4, 0, 0)
+ gtk_check_button_set_inconsistent(m_pCheckButton, inconsistent);
+#else
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(m_pCheckButton), inconsistent);
+#endif
+ }
+
+ virtual bool get_inconsistent() const override
+ {
+#if GTK_CHECK_VERSION(4, 0, 0)
+ return gtk_check_button_get_inconsistent(m_pCheckButton);
+#else
+ return gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON(m_pCheckButton));
+#endif
+ }
+
+ virtual ~GtkInstanceCheckButton() override
+ {
+ g_signal_handler_disconnect(m_pCheckButton, m_nSignalId);
}
};
-class GtkInstanceCheckButton : public GtkInstanceToggleButton, public virtual weld::CheckButton
+class GtkInstanceRadioButton : public GtkInstanceCheckButton, public virtual weld::RadioButton
{
public:
- GtkInstanceCheckButton(GtkCheckButton* pButton, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
- : GtkInstanceToggleButton(GTK_TOGGLE_BUTTON(pButton), pBuilder, bTakeOwnership)
+ GtkInstanceRadioButton(GtkRadioButton* pButton, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : GtkInstanceCheckButton(GTK_CHECK_BUTTON(pButton), pBuilder, bTakeOwnership)
{
}
};
More information about the Libreoffice-commits
mailing list