summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c84ab4b)
raw | patch | inline | side by side (parent: c84ab4b)
author | joncruz <joncruz@users.sourceforge.net> | |
Wed, 11 Apr 2007 18:25:18 +0000 (18:25 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Wed, 11 Apr 2007 18:25:18 +0000 (18:25 +0000) |
src/ink-action.cpp | patch | blob | history |
diff --git a/src/ink-action.cpp b/src/ink-action.cpp
index 6f7ea76e33b17989f9dcc2f689c4c526c5fcf024..138adafd18f232f92463b84e0cc6507f8b8903a8 100644 (file)
--- a/src/ink-action.cpp
+++ b/src/ink-action.cpp
#include <gtk/gtktoolitem.h>
#include <gtk/gtktoggletoolbutton.h>
#include <gtk/gtkcheckmenuitem.h>
+#include <gtk/gtkimagemenuitem.h>
#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 <gtk/gtkstock.h>
+
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;
}