diff options
| author | Martin Owens <doctormo@gmail.com> | 2018-11-10 08:40:25 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-02-20 15:35:31 +0000 |
| commit | 1469a7d3feb671a3e246b2aebda3e26bb9ca5858 (patch) | |
| tree | cde2489ac1e1bef13644f970fa2250a4e8dd7817 /src | |
| parent | Fix use of Gtk::Widget vs. GtkWidget in new symbolic icon getting code (diff) | |
| download | inkscape-1469a7d3feb671a3e246b2aebda3e26bb9ca5858.tar.gz inkscape-1469a7d3feb671a3e246b2aebda3e26bb9ca5858.zip | |
Store pixbufs instead of names to reduce calls to sp_get_icon_pixbuf
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/widget/iconrenderer.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/iconrenderer.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/widget/iconrenderer.cpp b/src/ui/widget/iconrenderer.cpp index a2e6bdb12..4ca250ef2 100644 --- a/src/ui/widget/iconrenderer.cpp +++ b/src/ui/widget/iconrenderer.cpp @@ -91,17 +91,17 @@ bool IconRenderer::activate_vfunc(GdkEvent* /*event*/, void IconRenderer::add_icon(Glib::ustring name) { - _icons.push_back(name); + _icons.push_back(sp_get_icon_pixbuf(name.c_str(), GTK_ICON_SIZE_BUTTON)); } void IconRenderer::set_pixbuf() { int icon_index = property_icon().get_value(); - auto icon_name = Glib::ustring("image-missing"); if(icon_index >= 0 && icon_index < _icons.size()) { - icon_name = _icons[icon_index]; + property_pixbuf() = _icons[icon_index]; + } else { + property_pixbuf() = sp_get_icon_pixbuf("image-missing", GTK_ICON_SIZE_BUTTON); } - property_pixbuf() = sp_get_icon_pixbuf(icon_name.c_str(), GTK_ICON_SIZE_BUTTON); } diff --git a/src/ui/widget/iconrenderer.h b/src/ui/widget/iconrenderer.h index 568d211ba..662ce5b19 100644 --- a/src/ui/widget/iconrenderer.h +++ b/src/ui/widget/iconrenderer.h @@ -59,7 +59,7 @@ protected: private: Glib::Property<int> _property_icon; - std::vector<Glib::ustring> _icons; + std::vector<Glib::RefPtr<Gdk::Pixbuf>> _icons; void set_pixbuf(); }; |
