vcl/unx/gtk3/gtkinst.cxx |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit e96554b67b17f9d3d91b0bb1f29ab0b9cdc43dcb
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jun 3 11:36:25 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jun 3 15:27:21 2021 +0200

    merge duplicate functions
    
    Change-Id: Icf0633ebfd668d19f5cbba5a07ec24ed5c65decc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116656
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index b251949ab2eb..b4bcfc994c6d 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4543,6 +4543,14 @@ namespace
 #endif
     }
 
+    void image_set_from_xgraphic(GtkImage* pImage, const 
css::uno::Reference<css::graphic::XGraphic>& rImage)
+    {
+        GdkPixbuf* pixbuf = getPixbuf(rImage);
+        gtk_image_set_from_pixbuf(pImage, pixbuf);
+        if (pixbuf)
+            g_object_unref(pixbuf);
+    }
+
 #if !GTK_CHECK_VERSION(4, 0, 0)
 class MenuHelper
 {
@@ -9400,14 +9408,7 @@ public:
     virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& 
rImage) override
     {
         ensure_image_widget();
-        GdkPixbuf* pixbuf = getPixbuf(rImage);
-        if (pixbuf)
-        {
-            gtk_image_set_from_pixbuf(m_pImage, pixbuf);
-            g_object_unref(pixbuf);
-        }
-        else
-            image_set_from_virtual_device(m_pImage, nullptr);
+        image_set_from_xgraphic(m_pImage, rImage);
     }
 
 #if GTK_CHECK_VERSION(4, 0, 0)
@@ -11079,10 +11080,7 @@ public:
 
     virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& 
rImage) override
     {
-        GdkPixbuf* pixbuf = getPixbuf(rImage);
-        gtk_image_set_from_pixbuf(m_pImage, pixbuf);
-        if (pixbuf)
-            g_object_unref(pixbuf);
+        image_set_from_xgraphic(m_pImage, rImage);
     }
 };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to