From 05f2e3cabd68bf13c68ecd39946e058b01420d8a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 6 Jul 2017 12:43:23 +0200 Subject: Remove more checks if icon exists in default theme. --- src/ui/widget/clipmaskicon.cpp | 13 +++---------- src/ui/widget/dock-item.cpp | 10 ++++------ src/ui/widget/insertordericon.cpp | 9 ++------- src/ui/widget/layertypeicon.cpp | 14 ++++---------- 4 files changed, 13 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index c284c035c..eceff13ca 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -42,16 +42,9 @@ ClipMaskIcon::ClipMaskIcon() : phys = width; Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - - if (icon_theme->has_icon(_pixClipName)) { - _property_pixbuf_clip = icon_theme->load_icon(_pixClipName, phys, (Gtk::IconLookupFlags)0); - } - if (icon_theme->has_icon(_pixMaskName)) { - _property_pixbuf_mask = icon_theme->load_icon(_pixMaskName, phys, (Gtk::IconLookupFlags)0); - } - if (icon_theme->has_icon(_pixBothName)) { - _property_pixbuf_both = icon_theme->load_icon(_pixBothName, phys, (Gtk::IconLookupFlags)0); - } + _property_pixbuf_clip = icon_theme->load_icon(_pixClipName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_mask = icon_theme->load_icon(_pixMaskName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_both = icon_theme->load_icon(_pixBothName, phys, (Gtk::IconLookupFlags)0); property_pixbuf() = Glib::RefPtr(0); } diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 60ea03fb7..18ab70eb4 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -42,12 +42,10 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l if (!icon_name.empty()) { Glib::RefPtr iconTheme = Gtk::IconTheme::get_default(); - if ( iconTheme->has_icon(icon_name) ) { - int width = 0; - int height = 0; - Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height); - _icon_pixbuf = iconTheme->load_icon(icon_name, width); - } + int width = 0; + int height = 0; + Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height); + _icon_pixbuf = iconTheme->load_icon(icon_name, width); } if ( _icon_pixbuf ) { diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index 26913ff98..5d1f64a54 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -36,13 +36,8 @@ InsertOrderIcon::InsertOrderIcon() : phys=width; Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - - if (icon_theme->has_icon(_pixTopName)) { - _property_pixbuf_top = icon_theme->load_icon(_pixTopName, phys, (Gtk::IconLookupFlags)0); - } - if (icon_theme->has_icon(_pixBottomName)) { - _property_pixbuf_bottom = icon_theme->load_icon(_pixBottomName, phys, (Gtk::IconLookupFlags)0); - } + _property_pixbuf_top = icon_theme->load_icon(_pixTopName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_bottom = icon_theme->load_icon(_pixBottomName, phys, (Gtk::IconLookupFlags)0); property_pixbuf() = Glib::RefPtr(0); } diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 679a95cd2..3a8ffab44 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -39,17 +39,11 @@ LayerTypeIcon::LayerTypeIcon() : gint width, height; gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); int phys = width; - Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - if (icon_theme->has_icon(_pixLayerName)) { - _property_pixbuf_layer = icon_theme->load_icon(_pixLayerName, phys, (Gtk::IconLookupFlags)0); - } - if (icon_theme->has_icon(_pixGroupName)) { - _property_pixbuf_group = icon_theme->load_icon(_pixGroupName, phys, (Gtk::IconLookupFlags)0); - } - if (icon_theme->has_icon(_pixPathName)) { - _property_pixbuf_path = icon_theme->load_icon(_pixPathName, phys, (Gtk::IconLookupFlags)0); - } + Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); + _property_pixbuf_layer = icon_theme->load_icon(_pixLayerName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_group = icon_theme->load_icon(_pixGroupName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_path = icon_theme->load_icon(_pixPathName, phys, (Gtk::IconLookupFlags)0); property_pixbuf() = _property_pixbuf_path.get_value(); } -- cgit v1.2.3