[Libreoffice-commits] core.git: vcl/inc vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 12 14:31:23 UTC 2021
vcl/inc/unx/gtk/gtkdata.hxx | 11 +++++++++++
vcl/unx/gtk3/gtkinst.cxx | 4 +---
2 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 59ab855cdac009ea3b52fbdbabf110658e89c16d
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 12 14:07:12 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 12 16:30:41 2021 +0200
gtk4: wrap gtk_image_get_icon_name for different version args
Change-Id: I38f2c11309965b08a5c85f543127f3c8b6720e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115484
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index da1d871e50b8..d12138298b43 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -77,6 +77,17 @@ inline GtkWidget* widget_get_root(GtkWidget* pWidget)
#endif
}
+inline const char * image_get_icon_name(GtkImage *pImage)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+ return gtk_image_get_icon_name(pImage);
+#else
+ const gchar* icon_name;
+ gtk_image_get_icon_name(pImage, &icon_name, nullptr);
+ return icon_name;
+#endif
+}
+
class GtkSalTimer final : public SalTimer
{
struct SalGtkTimeoutSource *m_pTimeout;
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 906c94e8966d..29804f5677c3 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17538,9 +17538,7 @@ private:
if (GTK_IS_IMAGE(pWidget))
{
GtkImage* pImage = GTK_IMAGE(pWidget);
- const gchar* icon_name;
- gtk_image_get_icon_name(pImage, &icon_name, nullptr);
- if (icon_name)
+ if (const gchar* icon_name = image_get_icon_name(pImage))
{
OUString aIconName(icon_name, strlen(icon_name), RTL_TEXTENCODING_UTF8);
if (!IsAllowedBuiltInIcon(aIconName))
More information about the Libreoffice-commits
mailing list