diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-shell-module.c | 89 | ||||
-rw-r--r-- | mail/e-mail-shell-module.h | 3 | ||||
-rw-r--r-- | mail/filtertypes.xml | 4 | ||||
-rw-r--r-- | mail/searchtypes.xml | 2 | ||||
-rw-r--r-- | mail/vfoldertypes.xml | 2 |
5 files changed, 80 insertions, 20 deletions
diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index f699edf7c3..2ae8bd5a5a 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -827,6 +827,32 @@ mail_shell_module_window_created_cb (EShell *shell, } } +static void +mail_shell_module_start (EShellModule *shell_module) +{ + EShell *shell; + EShellSettings *shell_settings; + gboolean enable_search_folders; + + shell = e_shell_module_get_shell (shell_module); + shell_settings = e_shell_get_shell_settings (shell); + + g_debug ("Jumpstarting Mail"); + + enable_search_folders = e_shell_settings_get_boolean ( + shell_settings, "mail-enable-search-folders"); + if (enable_search_folders) + vfolder_load_storage (); + + mail_autoreceive_init (session); + + if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL) + mail_sync_timeout_source_id = g_timeout_add_seconds ( + mail_config_get_sync_timeout (), + (GSourceFunc) mail_shell_module_mail_sync, + shell_module); +} + static EShellModuleInfo module_info = { MODULE_NAME, @@ -834,6 +860,7 @@ static EShellModuleInfo module_info = { MODULE_SCHEMES, MODULE_SORT_ORDER, + mail_shell_module_start, /* is_busy */ NULL, /* shutdown */ NULL, e_mail_shell_module_migrate @@ -844,12 +871,9 @@ e_shell_module_init (GTypeModule *type_module) { EShell *shell; EShellModule *shell_module; - EShellSettings *shell_settings; - gboolean enable_search_folders; shell_module = E_SHELL_MODULE (type_module); shell = e_shell_module_get_shell (shell_module); - shell_settings = e_shell_get_shell_settings (shell); e_shell_module_set_info ( shell_module, &module_info, @@ -913,19 +937,6 @@ e_shell_module_init (GTypeModule *type_module) * since the preferences bind to the shell settings. */ e_mail_shell_module_init_settings (shell); mail_shell_module_init_preferences (shell); - - enable_search_folders = e_shell_settings_get_boolean ( - shell_settings, "mail-enable-search-folders"); - if (enable_search_folders) - vfolder_load_storage (); - - mail_autoreceive_init (session); - - if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL) - mail_sync_timeout_source_id = g_timeout_add_seconds ( - mail_config_get_sync_timeout (), - (GSourceFunc) mail_shell_module_mail_sync, - shell_module); } /******************************** Public API *********************************/ @@ -1101,3 +1112,49 @@ e_mail_shell_module_stores_foreach (EShellModule *shell_module, while (g_hash_table_iter_next (&iter, &key, &value)) func (key, ((StoreInfo *) value)->name, user_data); } + +/******************* Code below here belongs elsewhere. *******************/ + +#include "filter/filter-option.h" +#include "shell/e-shell-settings.h" +#include "mail/e-mail-label-list-store.h" + +GSList * +e_mail_labels_get_filter_options (void) +{ + EShell *shell; + EShellSettings *shell_settings; + EMailLabelListStore *list_store; + GtkTreeModel *model; + GtkTreeIter iter; + GSList *list = NULL; + gboolean valid; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + list_store = e_shell_settings_get_object ( + shell_settings, "mail-label-list-store"); + + model = GTK_TREE_MODEL (list_store); + valid = gtk_tree_model_get_iter_first (model, &iter); + + while (valid) { + struct _filter_option *option; + gchar *name, *tag; + + name = e_mail_label_list_store_get_name (list_store, &iter); + tag = e_mail_label_list_store_get_tag (list_store, &iter); + + option = g_new0 (struct _filter_option, 1); + option->title = e_str_without_underscores (name); + option->value = tag; /* takes ownership */ + + g_free (name); + + valid = gtk_tree_model_iter_next (model, &iter); + } + + g_object_unref (list_store); + + return list; +} diff --git a/mail/e-mail-shell-module.h b/mail/e-mail-shell-module.h index de19861ac6..d72df698a5 100644 --- a/mail/e-mail-shell-module.h +++ b/mail/e-mail-shell-module.h @@ -76,6 +76,9 @@ void e_mail_shell_module_stores_foreach GHFunc func, gpointer user_data); +/* XXX Find a better place for this function. */ +GSList * e_mail_labels_get_filter_options(void); + G_END_DECLS #endif /* E_MAIL_SHELL_MODULE_H */ diff --git a/mail/filtertypes.xml b/mail/filtertypes.xml index f2f69c4c06..a93b887271 100644 --- a/mail/filtertypes.xml +++ b/mail/filtertypes.xml @@ -636,7 +636,7 @@ </option> </input> <input type="optionlist" name="versus"> - <dynamic func="e_util_labels_get_filter_options"/> + <dynamic func="e_mail_labels_get_filter_options"/> </input> </part> @@ -923,7 +923,7 @@ <title>Set Label</title> <code>(set-label ${label})</code> <input type="optionlist" name="label"> - <dynamic func="e_util_labels_get_filter_options"/> + <dynamic func="e_mail_labels_get_filter_options"/> </input> </part> <part name="colour"> diff --git a/mail/searchtypes.xml b/mail/searchtypes.xml index 83941d875c..ba349993f7 100644 --- a/mail/searchtypes.xml +++ b/mail/searchtypes.xml @@ -569,7 +569,7 @@ </option> </input> <input type="optionlist" name="versus"> - <dynamic func="e_util_labels_get_filter_options"/> + <dynamic func="e_mail_labels_get_filter_options"/> </input> </part> diff --git a/mail/vfoldertypes.xml b/mail/vfoldertypes.xml index 11ed7cc0af..9fd117b67d 100644 --- a/mail/vfoldertypes.xml +++ b/mail/vfoldertypes.xml @@ -569,7 +569,7 @@ </option> </input> <input type="optionlist" name="versus"> - <dynamic func="e_util_labels_get_filter_options"/> + <dynamic func="e_mail_labels_get_filter_options"/> </input> </part> |