[evolution-data-server/email-factory] Add signal for account added/removed/changed.



commit a9725fb4f3ed110e126cd119a31eee68715d64ba
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Tue May 31 18:09:52 2011 +0530

    Add signal for account added/removed/changed.

 mail/daemon/e-mail-data-session.c     |   30 ++++++
 mail/daemon/e-mail-data-session.h     |    3 +
 mail/daemon/e-mail-data-session.xml   |    9 ++
 mail/daemon/mail-send-recv.c          |    4 +
 mail/libegdbus/e-gdbus-emailsession.c |  186 +++++++++++++++++++++++++++++++++
 mail/libegdbus/e-gdbus-emailsession.h |   24 ++++
 6 files changed, 256 insertions(+), 0 deletions(-)
---
diff --git a/mail/daemon/e-mail-data-session.c b/mail/daemon/e-mail-data-session.c
index b5f2f0b..d1fca27 100644
--- a/mail/daemon/e-mail-data-session.c
+++ b/mail/daemon/e-mail-data-session.c
@@ -537,3 +537,33 @@ e_mail_session_emit_send_receive_completed (EMailDataSession *msession)
 	ipc(printf("Emitting Send/Receive completed signal\n"));
 	egdbus_session_cs_emit_send_receive_complete (priv->gdbus_object);
 }
+
+void
+e_mail_session_emit_account_added (EMailDataSession *msession, const char *uid)
+{
+	EMailDataSessionPrivate *priv = DATA_SESSION_PRIVATE(msession);
+	
+	ipc(printf("Emitting Account added signal\n"));
+	egdbus_session_cs_emit_account_added (priv->gdbus_object, uid);
+}
+
+void
+e_mail_session_emit_account_removed (EMailDataSession *msession, const char *uid)
+{
+	EMailDataSessionPrivate *priv = DATA_SESSION_PRIVATE(msession);
+	
+	ipc(printf("Emitting Account removed signal\n"));
+	egdbus_session_cs_emit_account_removed (priv->gdbus_object, uid);
+}
+
+void
+e_mail_session_emit_account_changed (EMailDataSession *msession, const char *uid)
+{
+	EMailDataSessionPrivate *priv = DATA_SESSION_PRIVATE(msession);
+	
+	ipc(printf("Emitting Account changed signal\n"));
+	egdbus_session_cs_emit_account_changed (priv->gdbus_object, uid);
+}
+
+
+
diff --git a/mail/daemon/e-mail-data-session.h b/mail/daemon/e-mail-data-session.h
index 6722bfd..05c6f33 100644
--- a/mail/daemon/e-mail-data-session.h
+++ b/mail/daemon/e-mail-data-session.h
@@ -48,6 +48,9 @@ const char * e_mail_data_session_get_path_from_store (EMailDataSession *msession
 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);
+void e_mail_session_emit_account_added (EMailDataSession *msession, const char *uid);
+void e_mail_session_emit_account_removed (EMailDataSession *msession, const char *uid);
+void e_mail_session_emit_account_changed (EMailDataSession *msession, const char *uid);
 
 
 G_END_DECLS
diff --git a/mail/daemon/e-mail-data-session.xml b/mail/daemon/e-mail-data-session.xml
index 04f71ae..c578195 100644
--- a/mail/daemon/e-mail-data-session.xml
+++ b/mail/daemon/e-mail-data-session.xml
@@ -46,6 +46,15 @@
     </method>    
     <signal name="sendReceiveComplete">
     </signal>
+    <signal name="AccountAdded">
+      <arg name="uid" type="s"/>
+    </signal>
+    <signal name="AccountRemoved">
+      <arg name="uid" type="s"/>    
+    </signal>
+    <signal name="AccountChanged">
+      <arg name="uid" type="s"/>    
+    </signal>
 
     <signal name="GetPassword">
       <arg name="title" type="s"/>
diff --git a/mail/daemon/mail-send-recv.c b/mail/daemon/mail-send-recv.c
index 0ffe7de..fee6511 100644
--- a/mail/daemon/mail-send-recv.c
+++ b/mail/daemon/mail-send-recv.c
@@ -1082,6 +1082,7 @@ auto_account_removed(EAccountList *eal, EAccount *ea, gpointer dummy)
 		g_source_remove(info->timeout_id);
 		info->timeout_id = 0;
 	}
+	e_mail_session_emit_account_removed (data_session, ea->uid);
 }
 
 static void
@@ -1125,6 +1126,8 @@ auto_account_added(EAccountList *eal, EAccount *ea, gpointer dummy)
 		G_OBJECT (ea), "mail-autoreceive", info,
 		(GDestroyNotify) auto_account_finalised);
 	auto_account_commit (info);
+	if (data_session)
+		e_mail_session_emit_account_added (data_session, ea->uid);
 }
 
 static void
@@ -1135,6 +1138,7 @@ auto_account_changed(EAccountList *eal, EAccount *ea, gpointer dummy)
 	g_return_if_fail(info != NULL);
 
 	auto_account_commit(info);
+	e_mail_session_emit_account_changed (data_session, ea->uid);
 }
 
 static void
diff --git a/mail/libegdbus/e-gdbus-emailsession.c b/mail/libegdbus/e-gdbus-emailsession.c
index 5f8a0b2..98c9fb0 100644
--- a/mail/libegdbus/e-gdbus-emailsession.c
+++ b/mail/libegdbus/e-gdbus-emailsession.c
@@ -597,6 +597,90 @@ static const _ExtendedGDBusSignalInfo _egdbus_session_cs_signal_info_send_receiv
   "send-receive-complete"
 };
 
+static const _ExtendedGDBusArgInfo _egdbus_session_cs_signal_info_account_added_ARG_uid =
+{
+  {
+    -1,
+    "uid",
+    "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _egdbus_session_cs_signal_info_account_added_ARG_pointers[] =
+{
+  &_egdbus_session_cs_signal_info_account_added_ARG_uid,
+  NULL
+};
+
+static const _ExtendedGDBusSignalInfo _egdbus_session_cs_signal_info_account_added =
+{
+  {
+    -1,
+    "AccountAdded",
+    (GDBusArgInfo **) &_egdbus_session_cs_signal_info_account_added_ARG_pointers,
+    NULL
+  },
+  "account-added"
+};
+
+static const _ExtendedGDBusArgInfo _egdbus_session_cs_signal_info_account_removed_ARG_uid =
+{
+  {
+    -1,
+    "uid",
+    "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _egdbus_session_cs_signal_info_account_removed_ARG_pointers[] =
+{
+  &_egdbus_session_cs_signal_info_account_removed_ARG_uid,
+  NULL
+};
+
+static const _ExtendedGDBusSignalInfo _egdbus_session_cs_signal_info_account_removed =
+{
+  {
+    -1,
+    "AccountRemoved",
+    (GDBusArgInfo **) &_egdbus_session_cs_signal_info_account_removed_ARG_pointers,
+    NULL
+  },
+  "account-removed"
+};
+
+static const _ExtendedGDBusArgInfo _egdbus_session_cs_signal_info_account_changed_ARG_uid =
+{
+  {
+    -1,
+    "uid",
+    "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _egdbus_session_cs_signal_info_account_changed_ARG_pointers[] =
+{
+  &_egdbus_session_cs_signal_info_account_changed_ARG_uid,
+  NULL
+};
+
+static const _ExtendedGDBusSignalInfo _egdbus_session_cs_signal_info_account_changed =
+{
+  {
+    -1,
+    "AccountChanged",
+    (GDBusArgInfo **) &_egdbus_session_cs_signal_info_account_changed_ARG_pointers,
+    NULL
+  },
+  "account-changed"
+};
+
 static const _ExtendedGDBusArgInfo _egdbus_session_cs_signal_info_get_password_ARG_title =
 {
   {
@@ -652,6 +736,9 @@ static const _ExtendedGDBusSignalInfo _egdbus_session_cs_signal_info_get_passwor
 static const _ExtendedGDBusSignalInfo * const _egdbus_session_cs_signal_info_pointers[] =
 {
   &_egdbus_session_cs_signal_info_send_receive_complete,
+  &_egdbus_session_cs_signal_info_account_added,
+  &_egdbus_session_cs_signal_info_account_removed,
+  &_egdbus_session_cs_signal_info_account_changed,
   &_egdbus_session_cs_signal_info_get_password,
   NULL
 };
@@ -781,6 +868,36 @@ egdbus_session_cs_default_init (EGdbusSessionCSIface *iface)
     G_TYPE_NONE,
     0);
 
+  g_signal_new ("account-added",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (EGdbusSessionCSIface, account_added),
+    NULL,
+    NULL,
+    _cclosure_marshal_generic,
+    G_TYPE_NONE,
+    1, G_TYPE_STRING);
+
+  g_signal_new ("account-removed",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (EGdbusSessionCSIface, account_removed),
+    NULL,
+    NULL,
+    _cclosure_marshal_generic,
+    G_TYPE_NONE,
+    1, G_TYPE_STRING);
+
+  g_signal_new ("account-changed",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (EGdbusSessionCSIface, account_changed),
+    NULL,
+    NULL,
+    _cclosure_marshal_generic,
+    G_TYPE_NONE,
+    1, G_TYPE_STRING);
+
   g_signal_new ("get-password",
     G_TYPE_FROM_INTERFACE (iface),
     G_SIGNAL_RUN_LAST,
@@ -806,6 +923,30 @@ egdbus_session_cs_emit_send_receive_complete (
 }
 
 void
+egdbus_session_cs_emit_account_added (
+    EGdbusSessionCS *object,
+    const gchar *uid)
+{
+  g_signal_emit_by_name (object, "account-added", uid);
+}
+
+void
+egdbus_session_cs_emit_account_removed (
+    EGdbusSessionCS *object,
+    const gchar *uid)
+{
+  g_signal_emit_by_name (object, "account-removed", uid);
+}
+
+void
+egdbus_session_cs_emit_account_changed (
+    EGdbusSessionCS *object,
+    const gchar *uid)
+{
+  g_signal_emit_by_name (object, "account-changed", uid);
+}
+
+void
 egdbus_session_cs_emit_get_password (
     EGdbusSessionCS *object,
     const gchar *title,
@@ -1784,6 +1925,48 @@ _egdbus_session_cs_on_signal_send_receive_complete (
 }
 
 static void
+_egdbus_session_cs_on_signal_account_added (
+    EGdbusSessionCS *object,
+    const gchar *uid)
+{
+  EGdbusSessionCSStub *stub = EGDBUS_SESSION_CS_STUB (object);
+  if (stub->priv->connection == NULL)
+    return;
+  g_dbus_connection_emit_signal (stub->priv->connection,
+    NULL, stub->priv->object_path, "org.gnome.evolution.dataserver.mail.Session", "AccountAdded",
+    g_variant_new ("(s)",
+                   uid), NULL);
+}
+
+static void
+_egdbus_session_cs_on_signal_account_removed (
+    EGdbusSessionCS *object,
+    const gchar *uid)
+{
+  EGdbusSessionCSStub *stub = EGDBUS_SESSION_CS_STUB (object);
+  if (stub->priv->connection == NULL)
+    return;
+  g_dbus_connection_emit_signal (stub->priv->connection,
+    NULL, stub->priv->object_path, "org.gnome.evolution.dataserver.mail.Session", "AccountRemoved",
+    g_variant_new ("(s)",
+                   uid), NULL);
+}
+
+static void
+_egdbus_session_cs_on_signal_account_changed (
+    EGdbusSessionCS *object,
+    const gchar *uid)
+{
+  EGdbusSessionCSStub *stub = EGDBUS_SESSION_CS_STUB (object);
+  if (stub->priv->connection == NULL)
+    return;
+  g_dbus_connection_emit_signal (stub->priv->connection,
+    NULL, stub->priv->object_path, "org.gnome.evolution.dataserver.mail.Session", "AccountChanged",
+    g_variant_new ("(s)",
+                   uid), NULL);
+}
+
+static void
 _egdbus_session_cs_on_signal_get_password (
     EGdbusSessionCS *object,
     const gchar *title,
@@ -1805,6 +1988,9 @@ static void
 egdbus_session_cs_stub_iface_init (EGdbusSessionCSIface *iface)
 {
   iface->send_receive_complete = _egdbus_session_cs_on_signal_send_receive_complete;
+  iface->account_added = _egdbus_session_cs_on_signal_account_added;
+  iface->account_removed = _egdbus_session_cs_on_signal_account_removed;
+  iface->account_changed = _egdbus_session_cs_on_signal_account_changed;
   iface->get_password = _egdbus_session_cs_on_signal_get_password;
 }
 
diff --git a/mail/libegdbus/e-gdbus-emailsession.h b/mail/libegdbus/e-gdbus-emailsession.h
index 1f102e0..9cd1d5e 100644
--- a/mail/libegdbus/e-gdbus-emailsession.h
+++ b/mail/libegdbus/e-gdbus-emailsession.h
@@ -72,6 +72,18 @@ struct _EGdbusSessionCSIface
   void (*send_receive_complete) (
     EGdbusSessionCS *object);
 
+  void (*account_added) (
+    EGdbusSessionCS *object,
+    const gchar *uid);
+
+  void (*account_removed) (
+    EGdbusSessionCS *object,
+    const gchar *uid);
+
+  void (*account_changed) (
+    EGdbusSessionCS *object,
+    const gchar *uid);
+
   void (*get_password) (
     EGdbusSessionCS *object,
     const gchar *title,
@@ -124,6 +136,18 @@ void egdbus_session_cs_complete_cancel_operations (
 void egdbus_session_cs_emit_send_receive_complete (
     EGdbusSessionCS *object);
 
+void egdbus_session_cs_emit_account_added (
+    EGdbusSessionCS *object,
+    const gchar *uid);
+
+void egdbus_session_cs_emit_account_removed (
+    EGdbusSessionCS *object,
+    const gchar *uid);
+
+void egdbus_session_cs_emit_account_changed (
+    EGdbusSessionCS *object,
+    const gchar *uid);
+
 void egdbus_session_cs_emit_get_password (
     EGdbusSessionCS *object,
     const gchar *title,



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