diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/egg/egg-editable-toolbar.c | 23 | ||||
-rwxr-xr-x | lib/egg/egg-toolbars-model.c | 11 | ||||
-rwxr-xr-x | lib/egg/egg-toolbars-model.h | 5 | ||||
-rw-r--r-- | lib/egg/eggtoolbar.c | 2 |
4 files changed, 40 insertions, 1 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index bf32c54ff..99726faf5 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -366,6 +366,27 @@ create_item (EggEditableToolbar *t, } static void +toolbar_changed_cb (EggToolbarsModel *model, + int position, + EggEditableToolbar *t) +{ + GtkWidget *toolbar; + EggTbModelFlags flags; + + flags = egg_toolbars_model_get_flags (model, position); + toolbar = get_toolbar_nth (t, position); + + if (flags & EGG_TB_MODEL_ICONS_ONLY) + { + egg_toolbar_set_style (EGG_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); + } + else + { + egg_toolbar_unset_style (EGG_TOOLBAR (toolbar)); + } +} + +static void toolbar_added_cb (EggToolbarsModel *model, int position, EggEditableToolbar *t) @@ -444,6 +465,8 @@ egg_editable_toolbar_set_model (EggEditableToolbar *t, G_CALLBACK (toolbar_added_cb), t, 0); g_signal_connect_object (model, "toolbar_removed", G_CALLBACK (toolbar_removed_cb), t, 0); + g_signal_connect_object (model, "toolbar_changed", + G_CALLBACK (toolbar_changed_cb), t, 0); } static void diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index 94a89ba27..8d8829dcf 100755 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -31,6 +31,7 @@ enum ITEM_ADDED, ITEM_REMOVED, TOOLBAR_ADDED, + TOOLBAR_CHANGED, TOOLBAR_REMOVED, LAST_SIGNAL }; @@ -213,6 +214,9 @@ egg_toolbars_model_set_flags (EggToolbarsModel *t, toolbar = toolbar_node->data; toolbar->flags = flags; + + g_signal_emit (G_OBJECT (t), egg_toolbars_model_signals[TOOLBAR_CHANGED], + 0, toolbar_position); } void @@ -398,6 +402,13 @@ egg_toolbars_model_class_init (EggToolbarsModelClass *klass) G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_removed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + egg_toolbars_model_signals[TOOLBAR_CHANGED] = + g_signal_new ("toolbar_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_changed), + NULL, NULL, g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); } static void diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h index 1440468fc..5d79787b9 100755 --- a/lib/egg/egg-toolbars-model.h +++ b/lib/egg/egg-toolbars-model.h @@ -39,7 +39,8 @@ typedef struct EggToolbarsModelPrivate EggToolbarsModelPrivate; typedef enum { - EGG_TB_MODEL_NOT_REMOVABLE = 1 + EGG_TB_MODEL_NOT_REMOVABLE = 1, + EGG_TB_MODEL_ICONS_ONLY = 2 } EggTbModelFlags; struct EggToolbarsModel @@ -61,6 +62,8 @@ struct EggToolbarsModelClass int position); void (* toolbar_added) (EggToolbarsModel *group, int position); + void (* toolbar_changed) (EggToolbarsModel *group, + int position); void (* toolbar_removed) (EggToolbarsModel *group, int position); diff --git a/lib/egg/eggtoolbar.c b/lib/egg/eggtoolbar.c index 79344f7d9..6ae9ff4b6 100644 --- a/lib/egg/eggtoolbar.c +++ b/lib/egg/eggtoolbar.c @@ -2594,6 +2594,8 @@ egg_toolbar_internal_insert_element (EggToolbar *toolbar, break; } + gtk_widget_show (GTK_WIDGET (item)); + if (type == EGG_TOOLBAR_CHILD_BUTTON || type == EGG_TOOLBAR_CHILD_RADIOBUTTON || type == EGG_TOOLBAR_CHILD_TOGGLEBUTTON) |