X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fink-action.cpp;h=138adafd18f232f92463b84e0cc6507f8b8903a8;hb=08ba57f80d0ea883ad6f55145241a9dec14054f8;hp=6f7ea76e33b17989f9dcc2f689c4c526c5fcf024;hpb=62c574a914923ef5608940459ae4d500d6968a3e;p=inkscape.git diff --git a/src/ink-action.cpp b/src/ink-action.cpp index 6f7ea76e3..138adafd1 100644 --- a/src/ink-action.cpp +++ b/src/ink-action.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "icon-size.h" #include "ink-action.h" @@ -182,9 +183,37 @@ void ink_action_set_property( GObject* obj, guint propId, const GValue *value, G } } +#include + static GtkWidget* ink_action_create_menu_item( GtkAction* action ) { - GtkWidget* item = gInkActionParentClass->create_menu_item( action ); + InkAction* act = INK_ACTION( action ); + GtkWidget* item = 0; + + if ( act->private_data->iconId ) { + gchar* label = 0; + g_object_get( G_OBJECT(act), "label", &label, NULL ); + + item = gtk_image_menu_item_new_with_mnemonic( label ); + GtkWidget* child = sp_icon_new( Inkscape::ICON_SIZE_MENU, act->private_data->iconId ); + // TODO this work-around is until SPIcon will live properly inside of a popup menu + if ( SP_IS_ICON(child) ) { + SPIcon* icon = SP_ICON(child); + sp_icon_fetch_pixbuf( icon ); + GdkPixbuf* target = gtk_action_is_sensitive(action) ? icon->pb : icon->pb_faded; + if ( target ) { + child = gtk_image_new_from_pixbuf( target ); + gtk_widget_destroy( GTK_WIDGET(icon) ); + } + } + gtk_widget_show_all( child ); + gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(item), child ); + + g_free( label ); + label = 0; + } else { + item = gInkActionParentClass->create_menu_item( action ); + } return item; }