diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-24 05:09:24 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:19 +0800 |
commit | 7050475f84247fb15e24aa1bb31502106c18815d (patch) | |
tree | 60e500f221d5f97b241045b10806c5c4ddbcc7c1 /mail/em-vfolder-context.c | |
parent | a98cb0a9820d2119bf10c317e5f6a9d56dd9073c (diff) | |
download | gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.tar gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.tar.gz gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.tar.bz2 gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.tar.lz gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.tar.xz gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.tar.zst gsoc2013-evolution-7050475f84247fb15e24aa1bb31502106c18815d.zip |
EMFolderTree: Store an EMailBackend instead of an EMailSession.
All this so EMFolderTree can submit EActivity instances for async ops.
You can obtain an EMailSession from an EMailBackend, but not vice versa.
Creates lots of pretty ripples in the mail code, but ultimately reduces
complexity. So it's a code cleanup of sorts.
Diffstat (limited to 'mail/em-vfolder-context.c')
-rw-r--r-- | mail/em-vfolder-context.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c index ebad8f2bac..371914c886 100644 --- a/mail/em-vfolder-context.c +++ b/mail/em-vfolder-context.c @@ -36,12 +36,12 @@ #include "em-filter-folder-element.h" struct _EMVFolderContextPrivate { - EMailSession *session; + EMailBackend *backend; }; enum { PROP_0, - PROP_SESSION + PROP_BACKEND }; G_DEFINE_TYPE ( @@ -50,13 +50,13 @@ G_DEFINE_TYPE ( E_TYPE_RULE_CONTEXT) static void -vfolder_context_set_session (EMVFolderContext *context, - EMailSession *session) +vfolder_context_set_backend (EMVFolderContext *context, + EMailBackend *backend) { - g_return_if_fail (E_IS_MAIL_SESSION (session)); - g_return_if_fail (context->priv->session == NULL); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); + g_return_if_fail (context->priv->backend == NULL); - context->priv->session = g_object_ref (session); + context->priv->backend = g_object_ref (backend); } static void @@ -66,8 +66,8 @@ vfolder_context_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SESSION: - vfolder_context_set_session ( + case PROP_BACKEND: + vfolder_context_set_backend ( EM_VFOLDER_CONTEXT (object), g_value_get_object (value)); return; @@ -83,10 +83,10 @@ vfolder_context_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SESSION: + case PROP_BACKEND: g_value_set_object ( value, - em_vfolder_context_get_session ( + em_vfolder_context_get_backend ( EM_VFOLDER_CONTEXT (object))); return; } @@ -101,9 +101,9 @@ vfolder_context_dispose (GObject *object) priv = EM_VFOLDER_CONTEXT (object)->priv; - if (priv->session != NULL) { - g_object_unref (priv->session); - priv->session = NULL; + if (priv->backend != NULL) { + g_object_unref (priv->backend); + priv->backend = NULL; } /* Chain up to parent's dispose() method. */ @@ -125,11 +125,11 @@ vfolder_context_new_element (ERuleContext *context, return e_filter_int_new_type("score", -3, 3); if (strcmp (type, "folder") == 0) - return em_filter_folder_element_new (priv->session); + return em_filter_folder_element_new (priv->backend); /* XXX Legacy type name. Same as "folder" now. */ if (strcmp (type, "folder-curi") == 0) - return em_filter_folder_element_new (priv->session); + return em_filter_folder_element_new (priv->backend); return E_RULE_CONTEXT_CLASS (em_vfolder_context_parent_class)-> new_element (context, type); @@ -153,12 +153,12 @@ em_vfolder_context_class_init (EMVFolderContextClass *class) g_object_class_install_property ( object_class, - PROP_SESSION, + PROP_BACKEND, g_param_spec_object ( - "session", + "backend", NULL, NULL, - E_TYPE_MAIL_SESSION, + E_TYPE_MAIL_BACKEND, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } @@ -184,18 +184,18 @@ em_vfolder_context_init (EMVFolderContext *context) } EMVFolderContext * -em_vfolder_context_new (EMailSession *session) +em_vfolder_context_new (EMailBackend *backend) { - g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); + g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL); return g_object_new ( - EM_TYPE_VFOLDER_CONTEXT, "session", session, NULL); + EM_TYPE_VFOLDER_CONTEXT, "backend", backend, NULL); } -EMailSession * -em_vfolder_context_get_session (EMVFolderContext *context) +EMailBackend * +em_vfolder_context_get_backend (EMVFolderContext *context) { g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL); - return context->priv->session; + return context->priv->backend; } |