diff options
Diffstat (limited to 'e-util/e-action-combo-box.c')
-rw-r--r-- | e-util/e-action-combo-box.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/e-util/e-action-combo-box.c b/e-util/e-action-combo-box.c index 1b784b8ee8..33d678ab1e 100644 --- a/e-util/e-action-combo-box.c +++ b/e-util/e-action-combo-box.c @@ -104,10 +104,6 @@ action_combo_box_render_pixbuf (GtkCellLayout *layout, gboolean visible; gint width; - /* Do any of the actions have an icon? */ - if (!combo_box->priv->group_has_icons) - return; - gtk_tree_model_get (model, iter, COLUMN_ACTION, &action, -1); /* A NULL action means the row is a separator. */ @@ -122,8 +118,12 @@ action_combo_box_render_pixbuf (GtkCellLayout *layout, "visible", &visible, NULL); - /* Keep the pixbuf renderer a fixed size for proper alignment. */ - gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL); + /* If some action has an icon */ + if (combo_box->priv->group_has_icons) + /* Keep the pixbuf renderer a fixed size for proper alignment. */ + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL); + else + width = 0; /* We can't set both "icon-name" and "stock-id" because setting * one unsets the other. So pick the one that has a non-NULL @@ -245,13 +245,25 @@ action_combo_box_update_model (EActionComboBox *combo_box) GtkRadioAction *action = list->data; GtkTreePath *path; GtkTreeIter iter; - gchar *icon_name; - gchar *stock_id; + gchar *icon_name = NULL; + gchar *stock_id = NULL; + gboolean visible = FALSE; gint value; - g_object_get ( - action, "icon-name", &icon_name, - "stock-id", &stock_id, NULL); + g_object_get (action, + "icon-name", &icon_name, + "stock-id", &stock_id, + "visible", &visible, + NULL); + + if (!visible) { + g_free (icon_name); + g_free (stock_id); + + list = g_slist_next (list); + continue; + } + combo_box->priv->group_has_icons |= (icon_name != NULL || stock_id != NULL); g_free (icon_name); @@ -583,3 +595,11 @@ e_action_combo_box_add_separator_after (EActionComboBox *combo_box, GTK_LIST_STORE (model), &iter, COLUMN_ACTION, NULL, COLUMN_SORT, (gfloat) action_value + 0.5, -1); } + +void +e_action_combo_box_update_model (EActionComboBox *combo_box) +{ + g_return_if_fail (E_IS_ACTION_COMBO_BOX (combo_box)); + + action_combo_box_update_model (combo_box); +} |