From 70fce0bbb0712dc70a15c481c0b65d68a98a4ff7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 28 Jan 2009 22:28:57 +0000 Subject: When invoking Evolution with URIs on the command-line (e.g. mailto:), terminate after all the windows for those URIs have been closed. svn path=/branches/kill-bonobo/; revision=37157 --- mail/e-mail-browser.c | 7 +++++++ mail/e-mail-shell-module.c | 46 +++++++++++++++++++--------------------------- 2 files changed, 26 insertions(+), 27 deletions(-) (limited to 'mail') diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index ad736236cf..0bc40f13ab 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -27,6 +27,7 @@ #include "e-util/e-util.h" #include "e-util/gconf-bridge.h" +#include "shell/e-shell.h" #include "mail/e-mail-reader.h" #include "mail/e-mail-reader-utils.h" @@ -321,6 +322,8 @@ mail_browser_constructed (GObject *object) { EMailBrowserPrivate *priv; EMailReader *reader; + EShellModule *shell_module; + EShell *shell; GtkAccelGroup *accel_group; GtkActionGroup *action_group; GtkUIManager *ui_manager; @@ -337,6 +340,10 @@ mail_browser_constructed (GObject *object) e_mail_reader_init (reader); + shell_module = e_mail_reader_get_shell_module (reader); + shell = e_shell_module_get_shell (shell_module); + e_shell_watch_window (shell, GTK_WINDOW (object)); + action_group = priv->action_group; gtk_action_group_set_translation_domain (action_group, domain); gtk_action_group_add_actions ( diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 680c994aec..760eca6ab7 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -555,18 +555,6 @@ exit: return !camel_application_is_exiting; } -static void -mail_shell_module_event_new_editor_cb (EShell *shell, - GtkWindow *editor, - EShellModule *shell_module) -{ - if (!E_IS_MSG_COMPOSER (editor)) - return; - - /* Integrate the new composer into the mail module. */ - em_configure_new_composer (E_MSG_COMPOSER (editor)); -} - static void mail_shell_module_notify_online_mode_cb (EShell *shell, GParamSpec *pspec, @@ -702,13 +690,13 @@ mail_shell_module_prepare_for_offline_cb (EShell *shell, EActivity *activity, EShellModule *shell_module) { - GList *shell_windows; + GList *watched_windows; GtkWidget *parent = NULL; gboolean synchronize = FALSE; - shell_windows = e_shell_get_shell_windows (shell); - if (shell_windows != NULL) - parent = GTK_WIDGET (shell_windows->data); + watched_windows = e_shell_get_watched_windows (shell); + if (watched_windows != NULL) + parent = GTK_WIDGET (watched_windows->data); if (e_shell_get_network_available (shell)) synchronize = em_utils_prompt_user ( @@ -771,33 +759,42 @@ mail_shell_module_window_weak_notify_cb (EShell *shell, static void mail_shell_module_window_created_cb (EShell *shell, - EShellWindow *shell_window, + GtkWindow *window, EShellModule *shell_module) { static gboolean first_time = TRUE; const gchar *module_name; + if (E_IS_MSG_COMPOSER (window)) { + /* Integrate the new composer into the mail module. */ + em_configure_new_composer (E_MSG_COMPOSER (window)); + return; + } + + if (!E_IS_SHELL_WINDOW (window)) + return; + module_name = G_TYPE_MODULE (shell_module)->name; e_shell_window_register_new_item_actions ( - shell_window, module_name, + E_SHELL_WINDOW (window), module_name, item_entries, G_N_ELEMENTS (item_entries)); e_shell_window_register_new_source_actions ( - shell_window, module_name, + E_SHELL_WINDOW (window), module_name, source_entries, G_N_ELEMENTS (source_entries)); g_signal_connect_swapped ( shell, "event::mail-icon", - G_CALLBACK (mail_shell_module_mail_icon_cb), shell_window); + G_CALLBACK (mail_shell_module_mail_icon_cb), window); g_object_weak_ref ( - G_OBJECT (shell_window), (GWeakNotify) + G_OBJECT (window), (GWeakNotify) mail_shell_module_window_weak_notify_cb, shell); if (first_time) { g_signal_connect ( - shell_window, "map-event", + window, "map-event", G_CALLBACK (e_msg_composer_check_autosave), NULL); first_time = FALSE; } @@ -849,11 +846,6 @@ e_shell_module_init (GTypeModule *type_module) folder_tree_model = em_folder_tree_model_new (shell_module); - g_signal_connect ( - shell, "event::new-editor", - G_CALLBACK (mail_shell_module_event_new_editor_cb), - shell_module); - g_signal_connect ( shell, "notify::online-mode", G_CALLBACK (mail_shell_module_notify_online_mode_cb), -- cgit v1.2.3