diff options
author | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-12 01:51:55 +0800 |
---|---|---|
committer | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-16 04:16:09 +0800 |
commit | 0eef4618ca677cd11d54ce0ae8804b5b1ededf3b (patch) | |
tree | 0672e4006fe079420010fa34bd7ab46ae55af1c5 /mail/mail-vfolder.c | |
parent | 6e73a7a8f31c3b890ad900960a24b930cfeb13ed (diff) | |
download | gsoc2013-evolution-0eef4618ca677cd11d54ce0ae8804b5b1ededf3b.tar.gz gsoc2013-evolution-0eef4618ca677cd11d54ce0ae8804b5b1ededf3b.tar.zst gsoc2013-evolution-0eef4618ca677cd11d54ce0ae8804b5b1ededf3b.zip |
Remove mail-config, vfolder, and filter deps from mail-folder-cache
Instead of pushing the updates to the right places, the folder cache simply
emits the appropriate signals and other objects are responsible for listening
and handling them appropriately. This allows us to cut down the dependencies of
MailFolderCache significantly, which is a huge step towards allowing us to split
it off for the backend.
Another nice thing about this is that it allows us to trim a lot of 'public' api
from the filter, vfolder, and config classes that were only used by the cache.
Now that stuff can all be internal since they're pulling changes rather than
having the changes pushed.
The last remaining problematic dependency in MailFolderCache is
EmFolderTreeModel. That is next on the chopping block.
https://bugzilla.gnome.org/show_bug.cgi?id=604627
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r-- | mail/mail-vfolder.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 9380922d26..b4a8330776 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -550,7 +550,7 @@ done: * uri. This function has a transient effect and does not permanently modify * the vfolder filter rules on disk. */ -void +static void mail_vfolder_notify_uri_available (CamelStore *store, const gchar *uri) { mail_vfolder_add_uri (store, uri, FALSE); @@ -565,7 +565,7 @@ mail_vfolder_notify_uri_available (CamelStore *store, const gchar *uri) * uri. This function has a transient effect and does not permanently modify * the vfolder filter rules on disk. */ -void +static void mail_vfolder_notify_uri_unavailable (CamelStore *store, const gchar *uri) { mail_vfolder_add_uri (store, uri, TRUE); @@ -588,7 +588,7 @@ mail_vfolder_notify_uri_unavailable (CamelStore *store, const gchar *uri) * * NOTE: This function must be called from the main thread. */ -void +static void mail_vfolder_delete_uri(CamelStore *store, const gchar *curi) { EFilterRule *rule; @@ -679,7 +679,7 @@ done: } /* called when a uri is renamed in a store */ -void +static void mail_vfolder_rename_uri(CamelStore *store, const gchar *cfrom, const gchar *cto) { EFilterRule *rule; @@ -972,6 +972,30 @@ store_folder_renamed(CamelObject *o, gpointer event_data, gpointer data) } } +static void +folder_available_cb (MailFolderCache *cache, CamelStore *store, const gchar *uri, gpointer user_data) +{ + mail_vfolder_notify_uri_available (store, uri); +} + +static void +folder_unavailable_cb (MailFolderCache *cache, CamelStore *store, const gchar *uri, gpointer user_data) +{ + mail_vfolder_notify_uri_unavailable (store, uri); +} + +static void +folder_deleted_cb (MailFolderCache *cache, CamelStore *store, const gchar *uri, gpointer user_data) +{ + mail_vfolder_delete_uri (store, uri); +} + +static void +folder_renamed_cb (MailFolderCache *cache, CamelStore *store, const gchar *olduri, const gchar *newuri, gpointer user_data) +{ + mail_vfolder_rename_uri (store, olduri, newuri); +} + void vfolder_load_storage(void) { @@ -1049,6 +1073,15 @@ vfolder_load_storage(void) gconf = mail_config_get_gconf_client(); if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL)) gconf_client_set_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", TRUE, NULL); + + g_signal_connect (mail_folder_cache_get_default (), "folder-available", + (GCallback) folder_available_cb, NULL); + g_signal_connect (mail_folder_cache_get_default (), "folder-unavailable", + (GCallback) folder_unavailable_cb, NULL); + g_signal_connect (mail_folder_cache_get_default (), "folder-deleted", + (GCallback) folder_deleted_cb, NULL); + g_signal_connect (mail_folder_cache_get_default (), "folder-renamed", + (GCallback) folder_renamed_cb, NULL); } void |