diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2017-06-29 11:43:56 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2017-06-29 11:43:56 +0000 |
| commit | 22d06152d0fabc7fe50bb6829f00b2bac4ed1796 (patch) | |
| tree | 9c6a9e59aedecd67f2a5e1a83d3c6c0b8541069a /src/ui/widget | |
| parent | Revert "color wheel: Temp fix for Gtk+ style properties" (diff) | |
| download | inkscape-22d06152d0fabc7fe50bb6829f00b2bac4ed1796.tar.gz inkscape-22d06152d0fabc7fe50bb6829f00b2bac4ed1796.zip | |
Remove old icon handling code
Diffstat (limited to 'src/ui/widget')
| -rw-r--r-- | src/ui/widget/addtoicon.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/addtoicon.h | 2 | ||||
| -rw-r--r-- | src/ui/widget/anchor-selector.cpp | 6 | ||||
| -rw-r--r-- | src/ui/widget/clipmaskicon.cpp | 17 | ||||
| -rw-r--r-- | src/ui/widget/color-notebook.cpp | 1 | ||||
| -rw-r--r-- | src/ui/widget/dock-item.cpp | 4 | ||||
| -rw-r--r-- | src/ui/widget/highlight-picker.cpp | 1 | ||||
| -rw-r--r-- | src/ui/widget/imagetoggler.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/insertordericon.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/labelled.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/labelled.h | 3 | ||||
| -rw-r--r-- | src/ui/widget/layer-selector.cpp | 21 | ||||
| -rw-r--r-- | src/ui/widget/layertypeicon.cpp | 15 | ||||
| -rw-r--r-- | src/ui/widget/object-composite-settings.cpp | 1 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 4 | ||||
| -rw-r--r-- | src/ui/widget/random.cpp | 5 |
16 files changed, 53 insertions, 77 deletions
diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 70516ed00..e5119fc60 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -16,7 +16,6 @@ #include <gtkmm/icontheme.h> -#include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" #include "layertypeicon.h" @@ -33,7 +32,10 @@ AddToIcon::AddToIcon() : // _property_pixbuf_add(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_BUTTON); + + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_BUTTON, &width, &height); + phys = width; // Assumes that we have a square icon? // Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); // @@ -43,8 +45,6 @@ AddToIcon::AddToIcon() : // if (icon_theme->has_icon(_pixAddName)) { // _property_pixbuf_add = icon_theme->load_icon(_pixAddName, phys, (Gtk::IconLookupFlags)0); // } -// -// _property_pixbuf_add = Gtk::Widget:: set_pixbuf(); } @@ -104,8 +104,10 @@ void AddToIcon::set_pixbuf() { bool active = property_active().get_value(); - GdkPixbuf *pixbuf = sp_pixbuf_new(Inkscape::ICON_SIZE_BUTTON, active ? INKSCAPE_ICON("list-add") : INKSCAPE_ICON("edit-delete")); - property_pixbuf() = Glib::wrap(pixbuf); + auto icon_theme = Gtk::IconTheme::get_default(); + + property_pixbuf() = icon_theme->load_icon(active ? "list-add" : "edit-delete", + phys); } diff --git a/src/ui/widget/addtoicon.h b/src/ui/widget/addtoicon.h index 3b2228754..93d66c8d5 100644 --- a/src/ui/widget/addtoicon.h +++ b/src/ui/widget/addtoicon.h @@ -54,7 +54,7 @@ protected: private: - int phys; + int phys; ///< Physical size of the icon (px) // Glib::ustring _pixAddName; diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index 087e7375e..ddc25775d 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -8,15 +8,17 @@ */ #include "ui/widget/anchor-selector.h" -#include "widgets/icon.h" #include "ui/icon-names.h" +#include <gtkmm/image.h> + namespace Inkscape { namespace UI { namespace Widget { void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& button) { - Gtk::Widget* buttonIcon = Gtk::manage(sp_icon_get_icon(icon, Inkscape::ICON_SIZE_SMALL_TOOLBAR)); + Gtk::Image* buttonIcon = Gtk::manage(new Gtk::Image()); + buttonIcon->set_from_icon_name(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR); buttonIcon->show(); button.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index a1e3eaf82..c284c035c 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -15,7 +15,6 @@ #include <gtkmm/icontheme.h> -#include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" #include "layertypeicon.h" @@ -37,18 +36,12 @@ ClipMaskIcon::ClipMaskIcon() : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_DECORATION); - Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); - if (!icon_theme->has_icon(_pixClipName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixClipName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (!icon_theme->has_icon(_pixMaskName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixMaskName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (!icon_theme->has_icon(_pixBothName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixBothName.data()), Inkscape::ICON_SIZE_DECORATION ); - } + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + phys = width; + + Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); if (icon_theme->has_icon(_pixClipName)) { _property_pixbuf_clip = icon_theme->load_icon(_pixClipName, phys, (Gtk::IconLookupFlags)0); diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 33e22b59d..0c9402c99 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -19,7 +19,6 @@ #include "config.h" #endif -#include "widgets/icon.h" #include <glibmm/i18n.h> #include <gtkmm/label.h> #include <gtkmm/notebook.h> diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index d124854ae..d268be785 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -12,7 +12,6 @@ #include "desktop.h" #include "inkscape.h" #include "ui/icon-names.h" -#include "widgets/icon.h" #include <gtkmm/icontheme.h> #include <glibmm/exceptionhandler.h> @@ -43,9 +42,6 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l if (!icon_name.empty()) { Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default(); - if (!iconTheme->has_icon(icon_name)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(icon_name.data()), Inkscape::ICON_SIZE_MENU ); - } if ( iconTheme->has_icon(icon_name) ) { int width = 0; int height = 0; diff --git a/src/ui/widget/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp index 561c1332a..3d8ab50ea 100644 --- a/src/ui/widget/highlight-picker.cpp +++ b/src/ui/widget/highlight-picker.cpp @@ -13,7 +13,6 @@ #include "display/cairo-utils.h" #include "highlight-picker.h" -#include "widgets/icon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 987cc67bb..81d0edd47 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -13,7 +13,6 @@ #include <gtkmm/icontheme.h> -#include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" @@ -32,15 +31,12 @@ ImageToggler::ImageToggler( char const* on, char const* off) : _property_pixbuf_off(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - int phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_DECORATION); - Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); - if (!icon_theme->has_icon(_pixOnName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixOnName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (!icon_theme->has_icon(_pixOffName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixOffName.data()), Inkscape::ICON_SIZE_DECORATION ); - } + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + int phys = width; + + Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); if (icon_theme->has_icon(_pixOnName)) { diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index 7ed1ed2e2..26913ff98 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -11,7 +11,6 @@ #include <gtkmm/icontheme.h> -#include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" #include "layertypeicon.h" @@ -31,15 +30,12 @@ InsertOrderIcon::InsertOrderIcon() : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_DECORATION); - Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); - if (!icon_theme->has_icon(_pixTopName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixTopName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (!icon_theme->has_icon(_pixBottomName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixBottomName.data()), Inkscape::ICON_SIZE_DECORATION ); - } + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + phys=width; + + Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); if (icon_theme->has_icon(_pixTopName)) { _property_pixbuf_top = icon_theme->load_icon(_pixTopName, phys, (Gtk::IconLookupFlags)0); diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index 6e3652830..d3dc6210f 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -14,8 +14,7 @@ #include "labelled.h" -/* For getting the Gtkmmified Icon manager */ -#include "widgets/icon.h" +#include <gtkmm/image.h> #include <gtkmm/label.h> namespace Inkscape { @@ -33,8 +32,9 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, { g_assert(g_utf8_validate(icon.c_str(), -1, NULL)); if (icon != "") { - _icon = sp_icon_get_icon(icon.c_str(), Inkscape::ICON_SIZE_LARGE_TOOLBAR); - pack_start(*Gtk::manage(_icon), Gtk::PACK_SHRINK); + _icon = Gtk::manage(new Gtk::Image()); + _icon->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR); + pack_start(*_icon, Gtk::PACK_SHRINK); } pack_start(*Gtk::manage(_label), Gtk::PACK_EXPAND_WIDGET, 6); pack_start(*Gtk::manage(_widget), Gtk::PACK_SHRINK, 6); diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h index 88eb3ce19..824abf305 100644 --- a/src/ui/widget/labelled.h +++ b/src/ui/widget/labelled.h @@ -14,6 +14,7 @@ #include <gtkmm/box.h> namespace Gtk { +class Image; class Label; } @@ -64,7 +65,7 @@ protected: Gtk::Widget *_widget; Gtk::Label *_label; Gtk::Label *_suffix; - Gtk::Widget *_icon; + Gtk::Image *_icon; }; } // namespace Widget diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 4432a6e09..0332143b5 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -31,7 +31,6 @@ #include "util/filter-list.h" #include "util/reverse-list.h" #include "verbs.h" -#include "widgets/icon.h" #include "xml/node-event-vector.h" #include "widgets/gradient-vector.h" @@ -42,17 +41,19 @@ namespace { class AlternateIcons : public Gtk::HBox { public: - AlternateIcons(Inkscape::IconSize size, gchar const *a, gchar const *b) + AlternateIcons(Gtk::IconSize size, Glib::ustring const &a, Glib::ustring const &b) : _a(NULL), _b(NULL) { set_name("AlternateIcons"); - if (a) { - _a = Gtk::manage(sp_icon_get_icon(a, size)); + if (!a.empty()) { + _a = Gtk::manage(new Gtk::Image()); + _a->set_from_icon_name(a, size); _a->set_no_show_all(true); add(*_a); } - if (b) { - _b = Gtk::manage(sp_icon_get_icon(b, size)); + if (!b.empty()) { + _b = Gtk::manage(new Gtk::Image()); + _b->set_from_icon_name(b, size); _b->set_no_show_all(true); add(*_b); } @@ -80,8 +81,8 @@ public: } private: - Gtk::Widget *_a; - Gtk::Widget *_b; + Gtk::Image *_a; + Gtk::Image *_b; bool _state; }; @@ -98,7 +99,7 @@ LayerSelector::LayerSelector(SPDesktop *desktop) set_name("LayerSelector"); AlternateIcons *label; - label = Gtk::manage(new AlternateIcons(Inkscape::ICON_SIZE_DECORATION, + label = Gtk::manage(new AlternateIcons(Gtk::ICON_SIZE_MENU, INKSCAPE_ICON("object-visible"), INKSCAPE_ICON("object-hidden"))); _visibility_toggle.add(*label); _visibility_toggle.signal_toggled().connect( @@ -118,7 +119,7 @@ LayerSelector::LayerSelector(SPDesktop *desktop) _visibility_toggle.set_tooltip_text(_("Toggle current layer visibility")); pack_start(_visibility_toggle, Gtk::PACK_EXPAND_PADDING); - label = Gtk::manage(new AlternateIcons(Inkscape::ICON_SIZE_DECORATION, + label = Gtk::manage(new AlternateIcons(Gtk::ICON_SIZE_MENU, INKSCAPE_ICON("object-unlocked"), INKSCAPE_ICON("object-locked"))); _lock_toggle.add(*label); _lock_toggle.signal_toggled().connect( diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index df85f271a..679a95cd2 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -15,7 +15,6 @@ #include <gtkmm/icontheme.h> -#include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" @@ -37,19 +36,11 @@ LayerTypeIcon::LayerTypeIcon() : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - int phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_DECORATION); + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + int phys = width; Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); - if (!icon_theme->has_icon(_pixLayerName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixLayerName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (!icon_theme->has_icon(_pixGroupName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixGroupName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (!icon_theme->has_icon(_pixPathName)) { - Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixPathName.data()), Inkscape::ICON_SIZE_DECORATION ); - } - if (icon_theme->has_icon(_pixLayerName)) { _property_pixbuf_layer = icon_theme->load_icon(_pixLayerName, phys, (Gtk::IconLookupFlags)0); } diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 1727660c8..ca33a845c 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -24,7 +24,6 @@ #include "style.h" #include "svg/css-ostringstream.h" #include "verbs.h" -#include "widgets/icon.h" #include "display/sp-canvas.h" #include "ui/widget/style-subject.h" diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index dff92594b..9332fe0f9 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -46,7 +46,7 @@ static const int PANEL_SETTING_NEXTFREE = 5; void Panel::prep() { GtkIconSize sizes[] = { - Inkscape::getRegisteredIconSize(Inkscape::ICON_SIZE_DECORATION), + GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR, GTK_ICON_SIZE_BUTTON, @@ -270,7 +270,7 @@ void Panel::_init() gint height = 0; gtk_image_set_from_icon_name(_temp_arrow.gobj(), "pan-start-symbolic", - Inkscape::getRegisteredIconSize(Inkscape::ICON_SIZE_SMALL_TOOLBAR)); + GTK_ICON_SIZE_SMALL_TOOLBAR); _menu_popper.add(_temp_arrow); _menu_popper.signal_button_press_event().connect_notify(sigc::mem_fun(*this, &Panel::_popper)); } diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index ba3b025ba..237144c7c 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -15,11 +15,11 @@ #include "random.h" -#include "widgets/icon.h" #include <glibmm/i18n.h> #include <gtkmm/button.h> +#include <gtkmm/image.h> namespace Inkscape { namespace UI { @@ -70,7 +70,8 @@ void Random::setStartSeed(long newseed) void Random::addReseedButton() { - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "randomize", Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Image* pIcon = Gtk::manage(new Gtk::Image()); + pIcon->set_from_icon_name( "randomize", Gtk::ICON_SIZE_BUTTON); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); |
