aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/templates/templates.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/templates/templates.c')
-rw-r--r--plugins/templates/templates.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 1ed02dd22d..b88e26d29d 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -767,6 +767,15 @@ init_composer_actions (GtkUIManager *ui_manager,
return TRUE;
}
+static void
+mail_shell_view_created_cb (EShellWindow *shell_window,
+ EShellView *shell_view)
+{
+ g_signal_connect (
+ shell_view, "update-actions",
+ G_CALLBACK (update_actions_cb), NULL);
+}
+
gboolean
init_shell_actions (GtkUIManager *ui_manager,
EShellWindow *shell_window)
@@ -775,8 +784,6 @@ init_shell_actions (GtkUIManager *ui_manager,
GtkActionGroup *action_group;
guint merge_id;
- shell_view = e_shell_window_get_shell_view (shell_window, "mail");
-
/* This is where we keep dynamically-built menu items. */
e_shell_window_add_action_group (shell_window, "templates");
action_group = e_lookup_action_group (ui_manager, "templates");
@@ -787,9 +794,14 @@ init_shell_actions (GtkUIManager *ui_manager,
G_OBJECT (action_group), "merge-id",
GUINT_TO_POINTER (merge_id));
- g_signal_connect (
- shell_view, "update-actions",
- G_CALLBACK (update_actions_cb), NULL);
+ /* Be careful not to instantiate the mail view ourselves. */
+ shell_view = e_shell_window_peek_shell_view (shell_window, "mail");
+ if (shell_view != NULL)
+ mail_shell_view_created_cb (shell_window, shell_view);
+ else
+ g_signal_connect (
+ shell_window, "shell-view-created::mail",
+ G_CALLBACK (mail_shell_view_created_cb), NULL);
return TRUE;
}