diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-25 06:44:51 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-12-25 06:44:51 +0800 |
commit | e3735c74444e3fdc35d1677c3cdf68dfc174ce10 (patch) | |
tree | e596d9a07f05380efe8c336f5f1e97758162c324 /mail | |
parent | 563a326b133b8e86db1ec4d2d8191cf0ab1c3516 (diff) | |
download | gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.tar gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.tar.gz gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.tar.bz2 gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.tar.lz gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.tar.xz gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.tar.zst gsoc2013-evolution-e3735c74444e3fdc35d1677c3cdf68dfc174ce10.zip |
Move EMailLabelListStore to EMailSession.
Access the EMailLabelListStore through EMailSession instead of
EShellSettings, which was a quick hack of mine during kill-bonobo.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-session.c | 34 | ||||
-rw-r--r-- | mail/e-mail-session.h | 3 | ||||
-rw-r--r-- | mail/message-list.c | 24 |
3 files changed, 42 insertions, 19 deletions
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 042a71abf7..70631bd0bb 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -81,6 +81,7 @@ typedef struct _SourceContext SourceContext; struct _EMailSessionPrivate { EMailAccountStore *account_store; MailFolderCache *folder_cache; + EMailLabelListStore *label_store; EAccountList *account_list; gulong account_added_handler_id; @@ -118,6 +119,7 @@ enum { PROP_ACCOUNT_STORE, PROP_FOLDER_CACHE, PROP_JUNK_FILTER_NAME, + PROP_LABEL_STORE, PROP_LOCAL_STORE, PROP_VFOLDER_STORE }; @@ -959,6 +961,13 @@ mail_session_get_property (GObject *object, E_MAIL_SESSION (object))); return; + case PROP_LABEL_STORE: + g_value_set_object ( + value, + e_mail_session_get_label_store ( + E_MAIL_SESSION (object))); + return; + case PROP_LOCAL_STORE: g_value_set_object ( value, @@ -995,6 +1004,11 @@ mail_session_dispose (GObject *object) priv->folder_cache = NULL; } + if (priv->label_store != NULL) { + g_object_unref (priv->label_store); + priv->label_store = NULL; + } + if (priv->account_list != NULL) { g_signal_handler_disconnect ( priv->account_list, @@ -1813,6 +1827,17 @@ e_mail_session_class_init (EMailSessionClass *class) g_object_class_install_property ( object_class, + PROP_LABEL_STORE, + g_param_spec_object ( + "label-store", + "Label Store", + "Mail label store", + E_TYPE_MAIL_LABEL_LIST_STORE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, PROP_LOCAL_STORE, g_param_spec_object ( "local-store", @@ -1855,6 +1880,7 @@ e_mail_session_init (EMailSession *session) (GEqualFunc) g_str_equal); session->priv = E_MAIL_SESSION_GET_PRIVATE (session); + session->priv->label_store = e_mail_label_list_store_new (); session->priv->junk_filters = junk_filters; session->priv->proxy = e_proxy_new (); @@ -1926,6 +1952,14 @@ e_mail_session_get_folder_cache (EMailSession *session) return session->priv->folder_cache; } +EMailLabelListStore * +e_mail_session_get_label_store (EMailSession *session) +{ + g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); + + return session->priv->label_store; +} + CamelStore * e_mail_session_get_local_store (EMailSession *session) { diff --git a/mail/e-mail-session.h b/mail/e-mail-session.h index ccba8263f4..7f5f22de27 100644 --- a/mail/e-mail-session.h +++ b/mail/e-mail-session.h @@ -29,6 +29,7 @@ #include <e-util/e-activity.h> #include <mail/e-mail-enums.h> #include <mail/e-mail-account-store.h> +#include <mail/e-mail-label-list-store.h> #include <mail/mail-folder-cache.h> /* Standard GObject macros */ @@ -81,6 +82,8 @@ EMailAccountStore * (EMailSession *session); MailFolderCache * e_mail_session_get_folder_cache (EMailSession *session); +EMailLabelListStore * + e_mail_session_get_label_store (EMailSession *session); CamelStore * e_mail_session_get_local_store (EMailSession *session); CamelStore * e_mail_session_get_vfolder_store (EMailSession *session); diff --git a/mail/message-list.c b/mail/message-list.c index b2fb46e9e1..fd153e3e01 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1509,21 +1509,6 @@ add_all_labels_foreach (ETreeModel *etm, return FALSE; } -static EMailLabelListStore * -ml_get_label_list_store (MessageList *message_list) -{ - EShell *shell; - EShellSettings *shell_settings; - - /* FIXME This should be a GObject property on MessageList. */ - - shell = e_shell_get_default (); - shell_settings = e_shell_get_shell_settings (shell); - - return e_shell_settings_get_object ( - shell_settings, "mail-label-list-store"); -} - static const gchar * get_trimmed_subject (CamelMessageInfo *info) { @@ -1594,9 +1579,12 @@ ml_tree_value_at_ex (ETreeModel *etm, CamelMessageInfo *msg_info, MessageList *message_list) { + EMailSession *session; const gchar *str; guint32 flags; + session = message_list_get_session (message_list); + g_return_val_if_fail (msg_info != NULL, NULL); switch (col) { @@ -1721,7 +1709,7 @@ ml_tree_value_at_ex (ETreeModel *etm, /* Get all applicable labels. */ struct LabelsData ld; - ld.store = ml_get_label_list_store (message_list); + ld.store = e_mail_session_get_label_store (session); ld.labels_tag2iter = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) gtk_tree_iter_free); for_node_and_subtree_if_collapsed (message_list, path, msg_info, add_all_labels_foreach, &ld); @@ -1752,7 +1740,6 @@ ml_tree_value_at_ex (ETreeModel *etm, } g_hash_table_destroy (ld.labels_tag2iter); - g_object_unref (ld.store); } return (gpointer) colour; @@ -1804,7 +1791,7 @@ ml_tree_value_at_ex (ETreeModel *etm, struct LabelsData ld; GString *result = g_string_new (""); - ld.store = ml_get_label_list_store (message_list); + ld.store = e_mail_session_get_label_store (session); ld.labels_tag2iter = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) gtk_tree_iter_free); for_node_and_subtree_if_collapsed (message_list, path, msg_info, add_all_labels_foreach, &ld); @@ -1830,7 +1817,6 @@ ml_tree_value_at_ex (ETreeModel *etm, } g_hash_table_destroy (ld.labels_tag2iter); - g_object_unref (ld.store); return (gpointer) g_string_free (result, FALSE); } default: |