aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-04-24 22:19:11 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-04-24 22:19:11 +0800
commit611ed0f3cfe8cfe29d8ed8e0830905cef96d9082 (patch)
tree3edbc279358c6face27e00efbea385340a69a1ba
parent8ea9f9377f071d4e8088e5c744e5470ccddb0fb1 (diff)
downloadgsoc2013-evolution-611ed0f3cfe8cfe29d8ed8e0830905cef96d9082.tar.gz
gsoc2013-evolution-611ed0f3cfe8cfe29d8ed8e0830905cef96d9082.tar.zst
gsoc2013-evolution-611ed0f3cfe8cfe29d8ed8e0830905cef96d9082.zip
Fix the "Recent Documents" menu in CompEditor.
-rw-r--r--calendar/gui/dialogs/comp-editor.c45
-rw-r--r--composer/e-composer-private.c7
2 files changed, 39 insertions, 13 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 9926b8cea2..65e5e71183 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -146,7 +146,7 @@ static const gchar *ui =
" <menu action='view-menu'/>"
" <menu action='insert-menu'>"
" <menuitem action='attach'/>"
-" <menuitem action='attach-recent'/>"
+" <placeholder name='recent-placeholder'/>"
" </menu>"
" <menu action='options-menu'/>"
" <menu action='help-menu'>"
@@ -1193,6 +1193,40 @@ static GtkToggleActionEntry coordinated_toggle_entries[] = {
};
static void
+comp_editor_setup_recent_menu (CompEditor *editor)
+{
+ EAttachmentView *view;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
+ GtkActionGroup *action_group;
+ const gchar *action_name;
+ const gchar *path;
+ guint merge_id;
+
+ ui_manager = editor->priv->manager;
+ view = E_ATTACHMENT_VIEW (editor->priv->attachment_view);
+ action_group = comp_editor_get_action_group (editor, "individual");
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ path = "/main-menu/insert-menu/recent-placeholder";
+ action_name = "recent-menu";
+
+ action = e_attachment_view_recent_action_new (
+ view, action_name, _("Recent _Documents"));
+
+ if (action != NULL) {
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, path,
+ action_name, action_name,
+ GTK_UI_MANAGER_AUTO, FALSE);
+ }
+
+ gtk_ui_manager_ensure_update (ui_manager);
+}
+
+static void
comp_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -1493,7 +1527,6 @@ static void
comp_editor_init (CompEditor *editor)
{
CompEditorPrivate *priv;
- EAttachmentView *view;
GtkActionGroup *action_group;
GtkAction *action;
GtkWidget *container;
@@ -1612,13 +1645,7 @@ comp_editor_init (CompEditor *editor)
priv->notebook = GTK_NOTEBOOK (widget);
gtk_widget_show (widget);
- /* Add a GtkRecentAction to the "individual" action group. */
- action_group = comp_editor_get_action_group (editor, "individual");
- view = E_ATTACHMENT_VIEW (priv->attachment_view);
- action = e_attachment_view_recent_action_new (
- view, "attach-recent", _("Recent _Documents"));
- gtk_action_group_add_action (action_group, action);
- g_object_unref (action);
+ comp_editor_setup_recent_menu (editor);
/* DND support */
gtk_drag_dest_set (GTK_WIDGET (editor), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE);
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index fd345d6410..a6fe8720f5 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -53,7 +53,7 @@ composer_setup_recent_menu (EMsgComposer *composer)
{
EAttachmentView *view;
GtkUIManager *manager;
- GtkAction *action = NULL;
+ GtkAction *action;
const gchar *action_name;
const gchar *path;
guint merge_id;
@@ -71,10 +71,9 @@ composer_setup_recent_menu (EMsgComposer *composer)
gtk_action_group_add_action (
composer->priv->composer_actions, action);
- gtk_ui_manager_add_ui (
+ gtk_ui_manager_add_ui (
manager, merge_id, path,
- action_name,
- action_name,
+ action_name, action_name,
GTK_UI_MANAGER_AUTO, FALSE);
}