[evolution-data-server/email-factory] Add Send/Receive API and signal to notify completion of Send/Receive.



commit 9f81b3f239472e70d9301dbc4f85c2300c2656ab
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Mon May 9 14:04:17 2011 +0530

    Add Send/Receive API and signal to notify completion of Send/Receive.

 mail/daemon/e-mail-data-session.c |   21 +++++++++++++++++++++
 mail/daemon/e-mail-data-session.h |    1 +
 mail/daemon/mail-send-recv.c      |    8 ++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/mail/daemon/e-mail-data-session.c b/mail/daemon/e-mail-data-session.c
index 80a6116..5323268 100644
--- a/mail/daemon/e-mail-data-session.c
+++ b/mail/daemon/e-mail-data-session.c
@@ -342,10 +342,21 @@ impl_Mail_addPassword (EGdbusSessionCS *object, GDBusMethodInvocation *invocatio
 	if (remember)
 		e_passwords_remember_password ("Mail", key);
 
+	egdbus_session_cs_complete_add_password (object, invocation);
+
 	return TRUE;
 }
 
+static gboolean
+impl_Mail_sendReceive (EGdbusSessionCS *object, GDBusMethodInvocation *invocation, EMailDataSession *msession)
+{
+	ipc(printf("Initiating Send/Receive\n"));
+
+	mail_send_receive (NULL);
 
+	egdbus_session_cs_complete_send_receive (object, invocation);
+	return TRUE;
+}
 
 static void
 e_mail_data_session_get_property (GObject *object, guint property_id,
@@ -405,6 +416,7 @@ e_mail_data_session_init (EMailDataSession *self)
 	g_signal_connect (priv->gdbus_object, "handle-get-local-folder", G_CALLBACK (impl_Mail_getLocalFolder), self);
 	g_signal_connect (priv->gdbus_object, "handle-get-folder-from-uri", G_CALLBACK (impl_Mail_getFolderFromUri), self);
 	g_signal_connect (priv->gdbus_object, "handle-add-password", G_CALLBACK (impl_Mail_addPassword), self);
+	g_signal_connect (priv->gdbus_object, "handle-send-receive", G_CALLBACK (impl_Mail_sendReceive), self);
 
 	priv->stores_lock = g_mutex_new ();
 	priv->stores = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -503,3 +515,12 @@ e_mail_session_emit_ask_password (EMailDataSession *msession, const char *title,
 	ipc(printf("Emitting for Ask Password: %s %s %s\n", title, prompt, key));
 	egdbus_session_cs_emit_get_password (priv->gdbus_object, title, prompt, key);
 }
+
+void
+e_mail_session_emit_send_receive_completed (EMailDataSession *msession)
+{
+	EMailDataSessionPrivate *priv = DATA_SESSION_PRIVATE(msession);
+	
+	ipc(printf("Emitting Send/Receive completed signal\n"));
+	egdbus_session_cs_emit_send_receive_complete (priv->gdbus_object);
+}
diff --git a/mail/daemon/e-mail-data-session.h b/mail/daemon/e-mail-data-session.h
index bf2b46a..6722bfd 100644
--- a/mail/daemon/e-mail-data-session.h
+++ b/mail/daemon/e-mail-data-session.h
@@ -47,6 +47,7 @@ void e_mail_data_session_release (EMailDataSession *session, GDBusConnection *co
 const char * e_mail_data_session_get_path_from_store (EMailDataSession *msession, gpointer store);
 CamelFolder * e_mail_session_get_folder_from_path (EMailDataSession *msession, const char *path);
 void e_mail_session_emit_ask_password (EMailDataSession *msession, const char *title, const gchar *prompt, const gchar *key);
+void e_mail_session_emit_send_receive_completed (EMailDataSession *msession);
 
 
 G_END_DECLS
diff --git a/mail/daemon/mail-send-recv.c b/mail/daemon/mail-send-recv.c
index 28177a3..0ffe7de 100644
--- a/mail/daemon/mail-send-recv.c
+++ b/mail/daemon/mail-send-recv.c
@@ -41,6 +41,7 @@
 #include "mail-send-recv.h"
 #include "mail-session.h"
 #include "mail-tools.h"
+#include "e-mail-data-session.h"
 
 #define d(x) x
 
@@ -53,6 +54,9 @@
 /* Prefix for window size GConf keys */
 #define GCONF_KEY_PREFIX "/apps/evolution/mail/send_recv"
 
+/* Data Session for IPC stuffs */
+extern EMailDataSession *data_session;
+
 /* send/receive email */
 
 /* ********************************************************************** */
@@ -787,6 +791,7 @@ receive_done (const gchar *uri, gpointer data)
 	info->data->infos = g_list_remove(info->data->infos, info);
 
 	if (g_hash_table_size(info->data->active) == 0) {
+		e_mail_session_emit_send_receive_completed (data_session);
 		if (info->data->gd)
 			gtk_widget_destroy((GtkWidget *)info->data->gd);
 		free_send_data();
@@ -983,10 +988,13 @@ mail_send_receive (GtkWindow *parent)
 	EAccount *account;
 	GList *scan;
 
+	
 	if (send_recv_dialog != NULL) {
+#if 0		
 		if (parent != NULL && gtk_widget_get_realized (send_recv_dialog)) {
 			gtk_window_present (GTK_WINDOW (send_recv_dialog));
 		}
+#endif		
 		return send_recv_dialog;
 	}
 



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