Lines 134-139
Link Here
|
134 |
void *data); |
134 |
void *data); |
135 |
static void sp_recent_open(GtkRecentChooser *, gpointer); |
135 |
static void sp_recent_open(GtkRecentChooser *, gpointer); |
136 |
|
136 |
|
|
|
137 |
static void injectRenamedIcons(); |
138 |
|
137 |
SPActionEventVector menu_item_event_vector = { |
139 |
SPActionEventVector menu_item_event_vector = { |
138 |
{NULL}, |
140 |
{NULL}, |
139 |
NULL, |
141 |
NULL, |
Lines 408-413
Link Here
|
408 |
void |
410 |
void |
409 |
sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) |
411 |
sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) |
410 |
{ |
412 |
{ |
|
|
413 |
static bool iconsInjected = false; |
414 |
if ( !iconsInjected ) { |
415 |
iconsInjected = true; |
416 |
injectRenamedIcons(); |
417 |
} |
411 |
GtkWidget *icon; |
418 |
GtkWidget *icon; |
412 |
|
419 |
|
413 |
icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name ); |
420 |
icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name ); |
Lines 1595-1600
Link Here
|
1595 |
//a menu item in yet another way... |
1602 |
//a menu item in yet another way... |
1596 |
} |
1603 |
} |
1597 |
|
1604 |
|
|
|
1605 |
void injectRenamedIcons() |
1606 |
{ |
1607 |
Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default(); |
1608 |
|
1609 |
std::vector< std::pair<Glib::ustring, Glib::ustring> > renamed; |
1610 |
renamed.push_back(std::make_pair("gtk-file", "document-x-generic")); |
1611 |
renamed.push_back(std::make_pair("gtk-directory", "folder")); |
1612 |
|
1613 |
for ( std::vector< std::pair<Glib::ustring, Glib::ustring> >::iterator it = renamed.begin(); it < renamed.end(); ++it ) { |
1614 |
bool hasIcon = iconTheme->has_icon(it->first); |
1615 |
bool hasSecondIcon = iconTheme->has_icon(it->second); |
1616 |
|
1617 |
if ( !hasIcon && hasSecondIcon ) { |
1618 |
Glib::ArrayHandle<int> sizes = iconTheme->get_icon_sizes(it->second); |
1619 |
for ( Glib::ArrayHandle<int>::iterator it2 = sizes.begin(); it2 < sizes.end(); ++it2 ) { |
1620 |
Glib::RefPtr<Gdk::Pixbuf> pb = iconTheme->load_icon( it->second, *it2 ); |
1621 |
if ( pb ) { |
1622 |
// install a private copy of the pixbuf to avoid pinning a theme |
1623 |
Glib::RefPtr<Gdk::Pixbuf> pbCopy = pb->copy(); |
1624 |
Gtk::IconTheme::add_builtin_icon( it->first, *it2, pbCopy ); |
1625 |
} |
1626 |
} |
1627 |
} |
1628 |
} |
1629 |
} |
1630 |
|
1598 |
|
1631 |
|
1599 |
/* |
1632 |
/* |
1600 |
Local Variables: |
1633 |
Local Variables: |