aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-config.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon@quotidian.org>2009-12-12 01:51:55 +0800
committerJonathon Jongsma <jonathon@quotidian.org>2009-12-16 04:16:09 +0800
commit0eef4618ca677cd11d54ce0ae8804b5b1ededf3b (patch)
tree0672e4006fe079420010fa34bd7ab46ae55af1c5 /mail/mail-config.c
parent6e73a7a8f31c3b890ad900960a24b930cfeb13ed (diff)
downloadgsoc2013-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-config.c')
-rw-r--r--mail/mail-config.c279
1 files changed, 149 insertions, 130 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 7f0fa42504..41ac85a373 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -58,12 +58,13 @@
#include <libedataserverui/e-passwords.h>
-#include "mail-session.h"
+#include "e-mail-local.h"
+#include "em-utils.h"
#include "mail-config.h"
+#include "mail-folder-cache.h"
#include "mail-mt.h"
+#include "mail-session.h"
#include "mail-tools.h"
-#include "em-utils.h"
-#include "e-mail-local.h"
typedef struct {
GConfClient *gconf;
@@ -251,131 +252,6 @@ gconf_int_value_changed (GConfClient *client,
}
}
-/* Config struct routines */
-void
-mail_config_init (void)
-{
- GConfClientNotifyFunc func;
- const gchar *key;
-
- if (config)
- return;
-
- config = g_new0 (MailConfig, 1);
- config->gconf = gconf_client_get_default ();
- config->gtkrc = g_build_filename (
- e_get_user_data_dir (), "mail",
- "config", "gtkrc-mail-fonts", NULL);
-
- mail_config_clear ();
-
- gtk_rc_parse (config->gtkrc);
-
- /* Composer Configuration */
-
- gconf_client_add_dir (
- config->gconf, "/apps/evolution/mail/composer",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- key = "/apps/evolution/mail/composer/spell_color";
- func = (GConfClientNotifyFunc) gconf_style_changed;
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
-
- key = "/apps/evolution/mail/composer/outlook_filenames";
- func = (GConfClientNotifyFunc) gconf_outlook_filenames_changed;
- gconf_outlook_filenames_changed (config->gconf, 0, NULL, NULL);
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
-
- /* Display Configuration */
-
- gconf_client_add_dir (
- config->gconf, "/apps/evolution/mail/display",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- key = "/apps/evolution/mail/display/address_compress";
- func = (GConfClientNotifyFunc) gconf_bool_value_changed;
- gconf_client_notify_add (
- config->gconf, key, func,
- &config->address_compress, NULL, NULL);
- config->address_compress =
- gconf_client_get_bool (config->gconf, key, NULL);
-
- key = "/apps/evolution/mail/display/address_count";
- func = (GConfClientNotifyFunc) gconf_int_value_changed;
- gconf_client_notify_add (
- config->gconf, key, func,
- &config->address_count, NULL, NULL);
- config->address_count =
- gconf_client_get_int (config->gconf, key, NULL);
-
- key = "/apps/evolution/mail/display/citation_colour";
- func = (GConfClientNotifyFunc) gconf_style_changed;
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
-
- key = "/apps/evolution/mail/display/mark_citations";
- func = (GConfClientNotifyFunc) gconf_style_changed;
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
-
- /* Font Configuration */
-
- gconf_client_add_dir (
- config->gconf, "/apps/evolution/mail/display/fonts",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- key = "/apps/evolution/mail/display/fonts";
- func = (GConfClientNotifyFunc) gconf_style_changed;
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
-
- /* Junk Configuration */
-
- gconf_client_add_dir (
- config->gconf, "/apps/evolution/mail/junk",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- key = "/apps/evolution/mail/junk/check_custom_header";
- func = (GConfClientNotifyFunc) gconf_jh_check_changed;
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
- config->jh_check =
- gconf_client_get_bool (config->gconf, key, NULL);
-
- key = "/apps/evolution/mail/junk/custom_header";
- func = (GConfClientNotifyFunc) gconf_jh_headers_changed;
- gconf_client_notify_add (
- config->gconf, key, func, NULL, NULL, NULL);
-
- key = "/apps/evolution/mail/junk/lookup_addressbook";
- func = (GConfClientNotifyFunc) gconf_bool_value_changed;
- gconf_client_notify_add (
- config->gconf, key, func,
- &config->book_lookup, NULL, NULL);
- config->book_lookup =
- gconf_client_get_bool (config->gconf, key, NULL);
-
- key = "/apps/evolution/mail/junk/lookup_addressbook_local_only";
- func = (GConfClientNotifyFunc) gconf_bool_value_changed;
- gconf_client_notify_add (
- config->gconf, key, func,
- &config->book_lookup_local_only, NULL, NULL);
- config->book_lookup_local_only =
- gconf_client_get_bool (config->gconf, key, NULL);
-
- key = "/desktop/gnome/lockdown/disable_command_line";
- func = (GConfClientNotifyFunc) gconf_bool_value_changed;
- gconf_client_notify_add (
- config->gconf, key, func,
- &config->scripts_disabled, NULL, NULL);
- config->scripts_disabled =
- gconf_client_get_bool (config->gconf, key, NULL);
-
- gconf_jh_check_changed (config->gconf, 0, NULL, config);
-}
-
void
mail_config_clear (void)
{
@@ -578,7 +454,7 @@ uri_to_evname (const gchar *uri, const gchar *prefix)
return tmp;
}
-void
+static void
mail_config_uri_renamed (GCompareFunc uri_cmp, const gchar *old, const gchar *new)
{
EAccountList *account_list;
@@ -633,7 +509,7 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const gchar *old, const gchar *ne
mail_config_write ();
}
-void
+static void
mail_config_uri_deleted (GCompareFunc uri_cmp, const gchar *uri)
{
EAccountList *account_list;
@@ -737,3 +613,146 @@ mail_config_get_lookup_book_local_only (void)
return config->book_lookup_local_only;
}
+
+static void
+folder_deleted_cb (MailFolderCache *cache, CamelStore *store, const gchar *uri, gpointer user_data)
+{
+ mail_config_uri_deleted(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name, uri);
+}
+
+static void
+folder_renamed_cb (MailFolderCache *cache, CamelStore *store, const gchar *olduri, const gchar *newuri, gpointer user_data)
+{
+ mail_config_uri_renamed(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name,
+ olduri, newuri);
+}
+
+/* Config struct routines */
+void
+mail_config_init (void)
+{
+ GConfClientNotifyFunc func;
+ const gchar *key;
+
+ if (config)
+ return;
+
+ config = g_new0 (MailConfig, 1);
+ config->gconf = gconf_client_get_default ();
+ config->gtkrc = g_build_filename (
+ e_get_user_data_dir (), "mail",
+ "config", "gtkrc-mail-fonts", NULL);
+
+ mail_config_clear ();
+
+ gtk_rc_parse (config->gtkrc);
+
+ /* Composer Configuration */
+
+ gconf_client_add_dir (
+ config->gconf, "/apps/evolution/mail/composer",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ key = "/apps/evolution/mail/composer/spell_color";
+ func = (GConfClientNotifyFunc) gconf_style_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+
+ key = "/apps/evolution/mail/composer/outlook_filenames";
+ func = (GConfClientNotifyFunc) gconf_outlook_filenames_changed;
+ gconf_outlook_filenames_changed (config->gconf, 0, NULL, NULL);
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+
+ /* Display Configuration */
+
+ gconf_client_add_dir (
+ config->gconf, "/apps/evolution/mail/display",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ key = "/apps/evolution/mail/display/address_compress";
+ func = (GConfClientNotifyFunc) gconf_bool_value_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func,
+ &config->address_compress, NULL, NULL);
+ config->address_compress =
+ gconf_client_get_bool (config->gconf, key, NULL);
+
+ key = "/apps/evolution/mail/display/address_count";
+ func = (GConfClientNotifyFunc) gconf_int_value_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func,
+ &config->address_count, NULL, NULL);
+ config->address_count =
+ gconf_client_get_int (config->gconf, key, NULL);
+
+ key = "/apps/evolution/mail/display/citation_colour";
+ func = (GConfClientNotifyFunc) gconf_style_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+
+ key = "/apps/evolution/mail/display/mark_citations";
+ func = (GConfClientNotifyFunc) gconf_style_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+
+ /* Font Configuration */
+
+ gconf_client_add_dir (
+ config->gconf, "/apps/evolution/mail/display/fonts",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ key = "/apps/evolution/mail/display/fonts";
+ func = (GConfClientNotifyFunc) gconf_style_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+
+ /* Junk Configuration */
+
+ gconf_client_add_dir (
+ config->gconf, "/apps/evolution/mail/junk",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ key = "/apps/evolution/mail/junk/check_custom_header";
+ func = (GConfClientNotifyFunc) gconf_jh_check_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+ config->jh_check =
+ gconf_client_get_bool (config->gconf, key, NULL);
+
+ key = "/apps/evolution/mail/junk/custom_header";
+ func = (GConfClientNotifyFunc) gconf_jh_headers_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func, NULL, NULL, NULL);
+
+ key = "/apps/evolution/mail/junk/lookup_addressbook";
+ func = (GConfClientNotifyFunc) gconf_bool_value_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func,
+ &config->book_lookup, NULL, NULL);
+ config->book_lookup =
+ gconf_client_get_bool (config->gconf, key, NULL);
+
+ key = "/apps/evolution/mail/junk/lookup_addressbook_local_only";
+ func = (GConfClientNotifyFunc) gconf_bool_value_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func,
+ &config->book_lookup_local_only, NULL, NULL);
+ config->book_lookup_local_only =
+ gconf_client_get_bool (config->gconf, key, NULL);
+
+ key = "/desktop/gnome/lockdown/disable_command_line";
+ func = (GConfClientNotifyFunc) gconf_bool_value_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func,
+ &config->scripts_disabled, NULL, NULL);
+ config->scripts_disabled =
+ gconf_client_get_bool (config->gconf, key, NULL);
+
+ gconf_jh_check_changed (config->gconf, 0, NULL, config);
+
+ 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);
+}