diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-20 12:52:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-20 18:13:25 +0200 |
commit | 1c52d39970de2daeac565165491ba82122ce299c (patch) | |
tree | 4c622ccb7cae70e48f17fb844b42a092c7286ea3 /vcl/unx | |
parent | f6ab12d5dae1212b0ad4e82ca3325f3dd4c974b6 (diff) |
weld SwWrapTabPage
Change-Id: I76e4a8e557ae6c92ad16dc9b6cf88a6c6ca59e4e
Reviewed-on: https://gerrit.libreoffice.org/60812
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 2abff266abe6..0f64c2edad45 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2751,6 +2751,34 @@ public: } }; +namespace +{ + GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang) + { + GdkPixbuf* pixbuf = nullptr; + auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang); + if (xMemStm) + { + GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new(); + gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()), + xMemStm->Seek(STREAM_SEEK_TO_END), nullptr); + gdk_pixbuf_loader_close(pixbuf_loader, nullptr); + pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader); + if (pixbuf) + g_object_ref(pixbuf); + g_object_unref(pixbuf_loader); + } + return pixbuf; + } + + GdkPixbuf* load_icon_by_name(const OUString& rIconName) + { + OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); + OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); + return load_icon_by_name(rIconName, sIconTheme, sUILang); + } +} + class GtkInstanceButton : public GtkInstanceContainer, public virtual weld::Button { private: @@ -2788,6 +2816,15 @@ public: gtk_button_set_image(m_pButton, nullptr); } + virtual void set_from_icon_name(const OUString& rIconName) override + { + GdkPixbuf* pixbuf = load_icon_by_name(rIconName); + if (!pixbuf) + return; + gtk_button_set_image(m_pButton, gtk_image_new_from_pixbuf(pixbuf)); + g_object_unref(pixbuf); + } + virtual OUString get_label() const override { return ::get_label(m_pButton); @@ -3313,27 +3350,6 @@ public: } }; -namespace -{ - GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang) - { - GdkPixbuf* pixbuf = nullptr; - auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang); - if (xMemStm) - { - GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new(); - gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()), - xMemStm->Seek(STREAM_SEEK_TO_END), nullptr); - gdk_pixbuf_loader_close(pixbuf_loader, nullptr); - pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader); - if (pixbuf) - g_object_ref(pixbuf); - g_object_unref(pixbuf_loader); - } - return pixbuf; - } -} - class GtkInstanceImage : public GtkInstanceWidget, public virtual weld::Image { private: @@ -3348,9 +3364,7 @@ public: virtual void set_from_icon_name(const OUString& rIconName) override { - OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); - OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); - GdkPixbuf* pixbuf = load_icon_by_name(rIconName, sIconTheme, sUILang); + GdkPixbuf* pixbuf = load_icon_by_name(rIconName); if (!pixbuf) return; gtk_image_set_from_pixbuf(m_pImage, pixbuf); |