aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/templates
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-01-23 00:46:34 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-01-23 00:46:34 +0800
commit48462592cb67d956cf8b4a69eba00153d585c462 (patch)
treee23046a3bcadc5b27457c85b13ec3a2c9460741c /plugins/templates
parent97ec849ee54387df954ee461ae371c3054443bfa (diff)
downloadgsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.tar
gsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.tar.gz
gsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.tar.bz2
gsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.tar.lz
gsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.tar.xz
gsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.tar.zst
gsoc2013-evolution-48462592cb67d956cf8b4a69eba00153d585c462.zip
Add a EShellWindow::shell-view-created signal.
The signal uses the name of the newly created shell view as the detail, so for example "shell-view-created::mail" is emitted when the "mail" view is created. Also, add e_shell_window_peek_shell_view() to obtain a shell view if it exists but without instantiating it. Using these new tools, teach the templates plugin to wait for the user to switch to the "mail" view before connecting to its "update-actions" signal. Previously is was instantiating the "mail" view itself.
Diffstat (limited to 'plugins/templates')
-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;
}