From df85cb1b7a47f713cb775f648f735e642a1bb71b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 16 Dec 2011 06:34:13 -0500 Subject: EMailSession: Add "activity-added" signal. EMailBackend catches these signals and forwards the EActivity to e_shell_backend_add_activity(). --- mail/e-mail-backend.c | 10 +++++++++- mail/e-mail-session.c | 27 +++++++++++++++++++++++++++ mail/e-mail-session.h | 6 ++++++ 3 files changed, 42 insertions(+), 1 deletion(-) (limited to 'mail') diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 0640c7ff53..dee2027f08 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -776,13 +776,19 @@ mail_backend_constructed (GObject *object) camel_provider_init (); priv->session = e_mail_session_new (); - folder_cache = e_mail_session_get_folder_cache (priv->session); g_object_bind_property ( shell, "online", priv->session, "online", G_BINDING_SYNC_CREATE); + /* Propagate "activity-added" signals from + * the mail session to the shell backend. */ + g_signal_connect_swapped ( + priv->session, "activity-added", + G_CALLBACK (e_shell_backend_add_activity), + shell_backend); + g_signal_connect ( priv->session, "job-started", G_CALLBACK (mail_backend_job_started_cb), @@ -817,6 +823,8 @@ mail_backend_constructed (GObject *object) G_CALLBACK (mail_backend_quit_requested_cb), shell_backend); + folder_cache = e_mail_session_get_folder_cache (priv->session); + g_signal_connect ( folder_cache, "folder-deleted", G_CALLBACK (mail_backend_folder_deleted_cb), diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index ba4819d9e0..24fd0be3ef 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -117,6 +117,13 @@ enum { PROP_VFOLDER_STORE }; +enum { + ACTIVITY_ADDED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL]; + static const gchar *local_folder_names[E_MAIL_NUM_LOCAL_FOLDERS] = { N_("Inbox"), /* E_MAIL_LOCAL_FOLDER_INBOX */ N_("Drafts"), /* E_MAIL_LOCAL_FOLDER_DRAFTS */ @@ -1772,6 +1779,16 @@ e_mail_session_class_init (EMailSessionClass *class) CAMEL_TYPE_STORE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + signals[ACTIVITY_ADDED] = g_signal_new ( + "activity-added", + G_OBJECT_CLASS_TYPE (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMailSessionClass, activity_added), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + E_TYPE_ACTIVITY); } static void @@ -1826,6 +1843,16 @@ e_mail_session_new (void) NULL); } +void +e_mail_session_add_activity (EMailSession *session, + EActivity *activity) +{ + g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_ACTIVITY (activity)); + + g_signal_emit (session, signals[ACTIVITY_ADDED], 0, activity); +} + EMailAccountStore * e_mail_session_get_account_store (EMailSession *session) { diff --git a/mail/e-mail-session.h b/mail/e-mail-session.h index f810cf6c4a..ccba8263f4 100644 --- a/mail/e-mail-session.h +++ b/mail/e-mail-session.h @@ -26,6 +26,7 @@ #define E_MAIL_SESSION_H #include +#include #include #include #include @@ -66,10 +67,15 @@ struct _EMailSession { struct _EMailSessionClass { CamelSessionClass parent_class; + + void (*activity_added) (EMailSession *session, + EActivity *activity); }; GType e_mail_session_get_type (void); EMailSession * e_mail_session_new (void); +void e_mail_session_add_activity (EMailSession *session, + EActivity *activity); EMailAccountStore * e_mail_session_get_account_store (EMailSession *session); -- cgit