From: tweenk Date: Sat, 25 Apr 2009 15:50:06 +0000 (+0000) Subject: Fix missing dock icons (bug #364075) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=068e06392acda58bcc914495a5af1aa1efd60795;p=inkscape.git Fix missing dock icons (bug #364075) --- diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 147bd818d..f718c669c 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -9,6 +9,9 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#include +#include + #include "dock-item.h" #include "desktop.h" #include "inkscape.h" @@ -16,11 +19,6 @@ #include "ui/widget/dock.h" #include "widgets/icon.h" -#include - -#include -#include - namespace Inkscape { namespace UI { namespace Widget { @@ -44,30 +42,12 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER); if (!icon_name.empty()) { - Gtk::Widget *icon = sp_icon_get_icon(icon_name, Inkscape::ICON_SIZE_MENU); - if (icon) { - // check icon type (inkscape, gtk, none) - if ( SP_IS_ICON(icon->gobj()) ) { - SPIcon* sp_icon = SP_ICON(icon->gobj()); - sp_icon_fetch_pixbuf(sp_icon); - _icon_pixbuf = Glib::wrap(sp_icon->pb, true); - } else if ( GTK_IS_IMAGE(icon->gobj()) ) { - GtkStockItem stock; - if ( gtk_stock_lookup( icon_name.c_str(), &stock ) ) { - _icon_pixbuf = Gtk::Invisible().render_icon( Gtk::StockID(icon_name), - Gtk::ICON_SIZE_MENU ); - } else { - // TODO re-work this properly. Anti-crasher "null" icon for the moment - _icon_pixbuf = Gtk::Invisible().render_icon( Gtk::StockID(GTK_STOCK_MISSING_IMAGE), - Gtk::ICON_SIZE_MENU ); - } - } - delete icon; - - _gdl_dock_item = - gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(), - _icon_pixbuf->gobj(), gdl_dock_behavior); - } + 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); + _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);