[evolution] EMailShellBackend: Fix an EAlertSink runtime warning.



commit 75ecbc91bdc043517df8f45413499de6f53bc266
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jul 18 17:43:24 2012 -0400

    EMailShellBackend: Fix an EAlertSink runtime warning.

 modules/mail/e-mail-shell-backend.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index a07a79f..6fab84b 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -472,12 +472,13 @@ mail_shell_backend_changes_committed_cb (EMailConfigWindow *window,
                                          EMailShellBackend *mail_shell_backend)
 {
 	EMailSession *session;
+	EShell *shell;
 	EShellBackend *shell_backend;
 	ESource *original_source;
 	CamelService *service;
 	EActivity *activity;
 	GCancellable *cancellable;
-	GtkWindow *parent;
+	GList *list, *link;
 	const gchar *uid;
 
 	session = e_mail_config_window_get_session (window);
@@ -489,12 +490,20 @@ mail_shell_backend_changes_committed_cb (EMailConfigWindow *window,
 
 	shell_backend = E_SHELL_BACKEND (mail_shell_backend);
 
+	shell = e_shell_backend_get_shell (shell_backend);
+	list = gtk_application_get_windows (GTK_APPLICATION (shell));
+
 	activity = e_activity_new ();
 
-	/* XXX Can we be sure the parent window will always implement
-	 *     EAlertSink?  May need some kind of fallback behavior. */
-	parent = gtk_window_get_transient_for (GTK_WINDOW (window));
-	e_activity_set_alert_sink (activity, E_ALERT_SINK (parent));
+	/* Find an EShellWindow to serve as an EAlertSink. */
+	for (link = list; link != NULL; link = g_list_next (link)) {
+		GtkWindow *window = GTK_WINDOW (link->data);
+
+		if (E_IS_SHELL_WINDOW (window)) {
+			EAlertSink *alert_sink = E_ALERT_SINK (window);
+			e_activity_set_alert_sink (activity, alert_sink);
+		}
+	}
 
 	cancellable = camel_operation_new ();
 	e_activity_set_cancellable (activity, cancellable);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]