summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/dock-item.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-12-15 16:19:28 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-12-15 16:19:28 +0000
commit70201e92aa1e700d49279871f2b84082750b8ed8 (patch)
tree1886fcdf8ad20d73b92bf4f4bfd3ab1406ba4c66 /src/ui/widget/dock-item.cpp
parentFix mask luminance calculation, so the coeffs add up to 1 (diff)
parentWin32 post-GSoC fixups. (diff)
downloadinkscape-70201e92aa1e700d49279871f2b84082750b8ed8.tar.gz
inkscape-70201e92aa1e700d49279871f2b84082750b8ed8.zip
Merge from trunk (again)
(bzr r9508.1.72)
Diffstat (limited to 'src/ui/widget/dock-item.cpp')
-rw-r--r--src/ui/widget/dock-item.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp
index 026eac8e0..72a20c385 100644
--- a/src/ui/widget/dock-item.cpp
+++ b/src/ui/widget/dock-item.cpp
@@ -42,15 +42,27 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER);
if (!icon_name.empty()) {
- int width = 0, height = 0;
- Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height);
- _icon_pixbuf = Gtk::IconTheme::get_default()->load_icon(icon_name, width, (Gtk::IconLookupFlags) 0);
- _gdl_dock_item =
- gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(),
- _icon_pixbuf->gobj(), gdl_dock_behavior);
+ Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default();
+ // Icon might be in the icon theme, or might be a stock item. Check the proper source:
+ 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);
+ } else {
+ Gtk::StockItem item;
+ Gtk::StockID stockId(icon_name);
+ if ( Gtk::StockItem::lookup(stockId, item) ) {
+ _icon_pixbuf = _dock.getWidget().render_icon( stockId, Gtk::ICON_SIZE_MENU );
+ }
+ }
+ }
+
+ if ( _icon_pixbuf ) {
+ _gdl_dock_item = gdl_dock_item_new_with_pixbuf_icon( name.c_str(), long_name.c_str(),
+ _icon_pixbuf->gobj(), gdl_dock_behavior );
} else {
- _gdl_dock_item =
- gdl_dock_item_new(name.c_str(), long_name.c_str(), gdl_dock_behavior);
+ _gdl_dock_item = gdl_dock_item_new(name.c_str(), long_name.c_str(), gdl_dock_behavior);
}
_frame.set_shadow_type(Gtk::SHADOW_IN);