From 62c574a914923ef5608940459ae4d500d6968a3e Mon Sep 17 00:00:00 2001 From: joncruz Date: Tue, 10 Apr 2007 05:28:21 +0000 Subject: [PATCH] Updating incon when property changes --- src/ink-action.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ink-action.cpp b/src/ink-action.cpp index ecdc8e63c..6f7ea76e3 100644 --- a/src/ink-action.cpp +++ b/src/ink-action.cpp @@ -230,6 +230,8 @@ static void ink_toggle_action_set_property( GObject* obj, guint propId, const GV static GtkWidget* ink_toggle_action_create_menu_item( GtkAction* action ); static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action ); +static void ink_toggle_action_update_icon( InkToggleAction* action ); + static GtkToggleActionClass* gInkToggleActionParentClass = 0; struct _InkToggleActionPrivate @@ -368,6 +370,8 @@ void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *v gchar* tmp = action->private_data->iconId; action->private_data->iconId = g_value_dup_string( value ); g_free( tmp ); + + ink_toggle_action_update_icon( action ); } break; @@ -416,6 +420,26 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action ) } +static void ink_toggle_action_update_icon( InkToggleAction* action ) +{ + if ( action ) { + GSList* proxies = gtk_action_get_proxies( GTK_ACTION(action) ); + while ( proxies ) { + if ( GTK_IS_TOOL_ITEM(proxies->data) ) { + if ( GTK_IS_TOOL_BUTTON(proxies->data) ) { + GtkToolButton* button = GTK_TOOL_BUTTON(proxies->data); + + GtkWidget* child = sp_icon_new( action->private_data->iconSize, action->private_data->iconId ); + gtk_widget_show_all( child ); + gtk_tool_button_set_icon_widget( button, child ); + } + } + + proxies = g_slist_next( proxies ); + } + } +} + /* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */ -- 2.30.2