summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/addtoicon.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2015-02-22 03:47:34 +0000
committerLiam P. White <inkscapebrony@gmail.com>2015-02-22 03:47:34 +0000
commita33a36719093519fe33ef7792903fbc136ff4262 (patch)
treec91d316b02191c2f3bc6857a15753f90f8f0d98d /src/ui/widget/addtoicon.cpp
parentFix for the performance loss in ungrouping observed by Tavmjong in rev 13933 (diff)
downloadinkscape-a33a36719093519fe33ef7792903fbc136ff4262.tar.gz
inkscape-a33a36719093519fe33ef7792903fbc136ff4262.zip
Make icon creation more consistent - use sp_icon_new where possible
(bzr r13936)
Diffstat (limited to 'src/ui/widget/addtoicon.cpp')
-rw-r--r--src/ui/widget/addtoicon.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp
index 0798d1c98..f15d7abf7 100644
--- a/src/ui/widget/addtoicon.cpp
+++ b/src/ui/widget/addtoicon.cpp
@@ -23,6 +23,7 @@
#include "widgets/icon.h"
#include "widgets/toolbox.h"
#include "ui/icon-names.h"
+#include "preferences.h"
#include "layertypeicon.h"
#include "addtoicon.h"
@@ -39,6 +40,7 @@ AddToIcon::AddToIcon() :
{
property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_BUTTON);
+
// Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
//
// if (!icon_theme->has_icon(_pixAddName)) {
@@ -50,7 +52,8 @@ AddToIcon::AddToIcon() :
//
// _property_pixbuf_add = Gtk::Widget::
- property_stock_id() = GTK_STOCK_ADD;
+ //property_stock_id() = GTK_STOCK_ADD;
+ set_pixbuf();
}
@@ -118,7 +121,7 @@ void AddToIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
Gtk::CellRendererState flags )
#endif
{
- property_stock_id() = property_active().get_value() ? GTK_STOCK_ADD : GTK_STOCK_DELETE;
+ set_pixbuf();
#if WITH_GTKMM_3_0
Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags );
@@ -137,6 +140,14 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/,
return false;
}
+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);
+}
+
} // namespace Widget
} // namespace UI
@@ -152,5 +163,3 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/,
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
-
-