From fe975a9b3c5603fe2b2d0491de3bbfe1e4bf0233 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Tue, 12 Apr 2016 17:01:58 +0100 Subject: Fork GtkImageMenuItem and remove show_image boolean because we always want to show menu. (bzr r14800) --- src/widgets/ink-action.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/widgets/ink-action.cpp') diff --git a/src/widgets/ink-action.cpp b/src/widgets/ink-action.cpp index 5941c31e4..01aa4957a 100644 --- a/src/widgets/ink-action.cpp +++ b/src/widgets/ink-action.cpp @@ -1,12 +1,20 @@ #include "widgets/icon.h" #include "icon-size.h" #include -#include + #include "widgets/ink-action.h" #include "widgets/button.h" +#include + +#if GTK_CHECK_VERSION(3,0,0) + // Fork of gtk-imagemenuitem to continue support + #include "widgets/imagemenuitem.h" + +#endif + static void ink_action_finalize( GObject* obj ); static void ink_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec ); static void ink_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec ); @@ -158,7 +166,12 @@ static GtkWidget* ink_action_create_menu_item( GtkAction* action ) gchar* label = 0; g_object_get( G_OBJECT(act), "label", &label, NULL ); +#if GTK_CHECK_VERSION(3,0,0) + item = image_menu_item_new_with_mnemonic( label ); +#else item = gtk_image_menu_item_new_with_mnemonic( label ); +#endif + 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) ) { @@ -172,7 +185,12 @@ static GtkWidget* ink_action_create_menu_item( GtkAction* action ) } } gtk_widget_show_all( child ); + +#if GTK_CHECK_VERSION(3,0,0) + image_menu_item_set_image( IMAGE_MENU_ITEM(item), child ); +#else gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(item), child ); +#endif g_free( label ); label = 0; -- cgit v1.2.3