diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-03-10 09:06:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-03-10 09:06:18 +0800 |
commit | 7a92d9cc82b7775a0f5cb1fde233119d435a79b6 (patch) | |
tree | 0bf446e28f6068a36dc3164725d3c37b05db4f6c /widgets/misc/e-attachment-bar.c | |
parent | f963cc39a7d21f64f578dae50fd08c44181a3bf6 (diff) | |
download | gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.tar gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.tar.gz gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.tar.bz2 gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.tar.lz gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.tar.xz gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.tar.zst gsoc2013-evolution-7a92d9cc82b7775a0f5cb1fde233119d435a79b6.zip |
Add e_lookup_action() and e_lookup_action_group() to e-util, so
I don't have to keep writing the algorithm over and over again.
Add EFileActivity, which provides a GCancellable for GIO operations.
Cancelling the activity cancels the GIO operation, and vice versa.
Also provides a handy GFileProgressCallback function which updates
the activity's "percent" property.
svn path=/branches/kill-bonobo/; revision=37396
Diffstat (limited to 'widgets/misc/e-attachment-bar.c')
-rw-r--r-- | widgets/misc/e-attachment-bar.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c index 4608d77b9d..5a1a6359de 100644 --- a/widgets/misc/e-attachment-bar.c +++ b/widgets/misc/e-attachment-bar.c @@ -1261,11 +1261,9 @@ attachment_bar_key_press_event (GtkWidget *widget, editable = e_attachment_bar_get_editable (attachment_bar); if (editable && event->keyval == GDK_Delete) { - GtkActionGroup *action_group; GtkAction *action; - action_group = attachment_bar->priv->editable_actions; - action = gtk_action_group_get_action (action_group, "remove"); + action = e_attachment_bar_get_action (attachment_bar, "remove"); gtk_action_activate (action); } @@ -1375,27 +1373,22 @@ attachment_bar_update_actions (EAttachmentBar *attachment_bar) is_image = e_attachment_is_image (attachment); } - ui_manager = e_attachment_bar_get_ui_manager (attachment_bar); - - action_group = attachment_bar->priv->standard_actions; + action = e_attachment_bar_get_action (attachment_bar, "properties"); + gtk_action_set_visible (action, n_selected == 1); - action = gtk_action_group_get_action (action_group, "save-as"); + action = e_attachment_bar_get_action (attachment_bar, "remove"); gtk_action_set_visible (action, n_selected > 0); - action = gtk_action_group_get_action (action_group, "set-background"); - gtk_action_set_visible (action, is_image); - - action_group = attachment_bar->priv->editable_actions; - - action = gtk_action_group_get_action (action_group, "properties"); - gtk_action_set_visible (action, n_selected == 1); - - action = gtk_action_group_get_action (action_group, "remove"); + action = e_attachment_bar_get_action (attachment_bar, "save-as"); gtk_action_set_visible (action, n_selected > 0); - action_group = attachment_bar->priv->open_actions; + action = e_attachment_bar_get_action (attachment_bar, "set-background"); + gtk_action_set_visible (action, is_image); + /* Clear out the "open" action group. */ merge_id = attachment_bar->priv->merge_id; + action_group = attachment_bar->priv->open_actions; + ui_manager = e_attachment_bar_get_ui_manager (attachment_bar); gtk_ui_manager_remove_ui (ui_manager, merge_id); e_action_group_remove_all_actions (action_group); @@ -2218,3 +2211,31 @@ e_attachment_bar_get_ui_manager (EAttachmentBar *attachment_bar) return attachment_bar->priv->ui_manager; } + +GtkAction * +e_attachment_bar_get_action (EAttachmentBar *attachment_bar, + const gchar *action_name) +{ + GtkUIManager *ui_manager; + + g_return_val_if_fail (E_IS_ATTACHMENT_BAR (attachment_bar), NULL); + g_return_val_if_fail (action_name != NULL, NULL); + + ui_manager = e_attachment_bar_get_ui_manager (attachment_bar); + + return e_lookup_action (ui_manager, action_name); +} + +GtkActionGroup * +e_attachment_bar_get_action_group (EAttachmentBar *attachment_bar, + const gchar *group_name) +{ + GtkUIManager *ui_manager; + + g_return_val_if_fail (E_IS_ATTACHMENT_BAR (attachment_bar), NULL); + g_return_val_if_fail (group_name != NULL, NULL); + + ui_manager = e_attachment_bar_get_ui_manager (attachment_bar); + + return e_lookup_action_group (ui_manager, group_name); +} |