evolution r37309 - in branches/kill-bonobo: addressbook/gui/component calendar/modules doc/reference/shell doc/reference/shell/tmpl mail shell shell/test
- From: mbarnes svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r37309 - in branches/kill-bonobo: addressbook/gui/component calendar/modules doc/reference/shell doc/reference/shell/tmpl mail shell shell/test
- Date: Mon, 23 Feb 2009 03:21:04 +0000 (UTC)
Author: mbarnes
Date: Mon Feb 23 03:21:04 2009
New Revision: 37309
URL: http://svn.gnome.org/viewvc/evolution?rev=37309&view=rev
Log:
Make filter options for mail labels work again.
Define a new shell module method named start() that tells the module when to
start loading data and running background tasks. Only really applies to the
mail module right now since the others use evolution-data-server. Basically
it prevents the mail module from loading and refreshing mail stores until
you actually switch to the mail view.
Modified:
branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c
branches/kill-bonobo/calendar/modules/e-cal-shell-module.c
branches/kill-bonobo/calendar/modules/e-memo-shell-module.c
branches/kill-bonobo/calendar/modules/e-task-shell-module.c
branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
branches/kill-bonobo/doc/reference/shell/tmpl/e-shell-module.sgml
branches/kill-bonobo/mail/e-mail-shell-module.c
branches/kill-bonobo/mail/e-mail-shell-module.h
branches/kill-bonobo/mail/filtertypes.xml
branches/kill-bonobo/mail/searchtypes.xml
branches/kill-bonobo/mail/vfoldertypes.xml
branches/kill-bonobo/shell/e-shell-module.c
branches/kill-bonobo/shell/e-shell-module.h
branches/kill-bonobo/shell/e-shell-window.c
branches/kill-bonobo/shell/test/e-test-shell-module.c
Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c (original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c Mon Feb 23 03:21:04 2009
@@ -436,6 +436,7 @@
MODULE_SORT_ORDER,
/* Methods */
+ /* start */ NULL,
book_module_is_busy,
book_module_shutdown,
e_book_shell_module_migrate
Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-module.c (original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-module.c Mon Feb 23 03:21:04 2009
@@ -507,6 +507,7 @@
MODULE_SCHEMES,
MODULE_SORT_ORDER,
+ /* start */ NULL,
/* is_busy */ NULL,
/* shutdown */ NULL,
e_cal_shell_module_migrate
Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-module.c (original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-module.c Mon Feb 23 03:21:04 2009
@@ -479,6 +479,7 @@
MODULE_SCHEMES,
MODULE_SORT_ORDER,
+ /* start */ NULL,
/* is_busy */ NULL,
/* shutdown */ NULL,
e_memo_shell_module_migrate
Modified: branches/kill-bonobo/calendar/modules/e-task-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-task-shell-module.c (original)
+++ branches/kill-bonobo/calendar/modules/e-task-shell-module.c Mon Feb 23 03:21:04 2009
@@ -486,6 +486,7 @@
MODULE_SCHEMES,
MODULE_SORT_ORDER,
+ /* start */ NULL,
/* is_busy */ NULL,
/* shutdown */ NULL,
e_task_shell_module_migrate
Modified: branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/eshell-sections.txt (original)
+++ branches/kill-bonobo/doc/reference/shell/eshell-sections.txt Mon Feb 23 03:21:04 2009
@@ -20,6 +20,7 @@
e_shell_set_online
e_shell_get_preferences_window
e_shell_event
+e_shell_start
e_shell_is_busy
e_shell_do_quit
e_shell_quit
Modified: branches/kill-bonobo/doc/reference/shell/tmpl/e-shell-module.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/e-shell-module.sgml (original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/e-shell-module.sgml Mon Feb 23 03:21:04 2009
@@ -50,6 +50,7 @@
@aliases:
@schemes:
@sort_order:
+ start:
@is_busy:
@shutdown:
@migrate:
Modified: branches/kill-bonobo/mail/e-mail-shell-module.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.c (original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.c Mon Feb 23 03:21:04 2009
@@ -827,6 +827,32 @@
}
}
+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 @@
MODULE_SCHEMES,
MODULE_SORT_ORDER,
+ mail_shell_module_start,
/* is_busy */ NULL,
/* shutdown */ NULL,
e_mail_shell_module_migrate
@@ -844,12 +871,9 @@
{
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 @@
* 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 @@
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;
+}
Modified: branches/kill-bonobo/mail/e-mail-shell-module.h
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.h (original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.h Mon Feb 23 03:21:04 2009
@@ -76,6 +76,9 @@
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 */
Modified: branches/kill-bonobo/mail/filtertypes.xml
==============================================================================
--- branches/kill-bonobo/mail/filtertypes.xml (original)
+++ branches/kill-bonobo/mail/filtertypes.xml Mon Feb 23 03:21:04 2009
@@ -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">
Modified: branches/kill-bonobo/mail/searchtypes.xml
==============================================================================
--- branches/kill-bonobo/mail/searchtypes.xml (original)
+++ branches/kill-bonobo/mail/searchtypes.xml Mon Feb 23 03:21:04 2009
@@ -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>
Modified: branches/kill-bonobo/mail/vfoldertypes.xml
==============================================================================
--- branches/kill-bonobo/mail/vfoldertypes.xml (original)
+++ branches/kill-bonobo/mail/vfoldertypes.xml Mon Feb 23 03:21:04 2009
@@ -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>
Modified: branches/kill-bonobo/shell/e-shell-module.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-module.c (original)
+++ branches/kill-bonobo/shell/e-shell-module.c Mon Feb 23 03:21:04 2009
@@ -53,6 +53,8 @@
/* Initializes the loaded type module. */
void (*init) (GTypeModule *type_module);
+
+ guint started : 1;
};
enum {
@@ -445,6 +447,30 @@
}
/**
+ * e_shell_module_start:
+ * @shell_module: an #EShellModule
+ *
+ * Tells the @shell_module to begin loading data or running background
+ * tasks which may consume significant resources. This gets called in
+ * reponse to the user switching to the corresponding shell view for
+ * the first time. The function is idempotent for each shell module.
+ **/
+void
+e_shell_module_start (EShellModule *shell_module)
+{
+ EShellModuleInfo *module_info;
+
+ g_return_if_fail (E_IS_SHELL_MODULE (shell_module));
+
+ module_info = &shell_module->priv->info;
+
+ if (module_info->start != NULL && !shell_module->priv->started)
+ module_info->start (shell_module);
+
+ shell_module->priv->started = TRUE;
+}
+
+/**
* e_shell_module_is_busy:
* @shell_module: an #EShellModule
*
@@ -576,6 +602,7 @@
module_info->schemes = g_intern_string (info->schemes);
module_info->sort_order = info->sort_order;
+ module_info->start = info->start;
module_info->is_busy = info->is_busy;
module_info->shutdown = info->shutdown;
module_info->migrate = info->migrate;
Modified: branches/kill-bonobo/shell/e-shell-module.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-module.h (original)
+++ branches/kill-bonobo/shell/e-shell-module.h Mon Feb 23 03:21:04 2009
@@ -73,6 +73,12 @@
* @sort_order: Used to determine the order of modules listed in
* the main menu and in the switcher. See
* e_shell_module_compare().
+ * @start: Callback for notifying the module to begin loading data
+ * and running background tasks. This is called the first
+ * time the corresponding shell view class is instantiated.
+ * It allows the module to delay initialization steps that
+ * consume significant resources until they are actually
+ * needed.
* @is_busy: Callback for querying whether the module has
* operations in progress that cannot be cancelled
* or finished immediately. Returning %TRUE prevents
@@ -96,6 +102,7 @@
const gchar *schemes;
gint sort_order;
+ void (*start) (EShellModule *shell_module);
gboolean (*is_busy) (EShellModule *shell_module);
gboolean (*shutdown) (EShellModule *shell_module);
gboolean (*migrate) (EShellModule *shell_module,
@@ -133,6 +140,7 @@
(EShellModule *shell_module);
void e_shell_module_add_activity (EShellModule *shell_module,
EActivity *activity);
+void e_shell_module_start (EShellModule *shell_module);
gboolean e_shell_module_is_busy (EShellModule *shell_module);
gboolean e_shell_module_shutdown (EShellModule *shell_module);
gboolean e_shell_module_migrate (EShellModule *shell_module,
Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c (original)
+++ branches/kill-bonobo/shell/e-shell-window.c Mon Feb 23 03:21:04 2009
@@ -45,12 +45,19 @@
const gchar *title)
{
GHashTable *loaded_views;
+ EShell *shell;
+ EShellModule *shell_module;
EShellView *shell_view;
GtkNotebook *notebook;
GtkAction *action;
GtkWidget *widget;
gint page_num;
+ /* First off, start the shell module. */
+ shell = e_shell_window_get_shell (shell_window);
+ shell_module = e_shell_get_module_by_name (shell, view_name);
+ e_shell_module_start (shell_module);
+
/* Determine the page number for the new shell view. */
notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
Modified: branches/kill-bonobo/shell/test/e-test-shell-module.c
==============================================================================
--- branches/kill-bonobo/shell/test/e-test-shell-module.c (original)
+++ branches/kill-bonobo/shell/test/e-test-shell-module.c Mon Feb 23 03:21:04 2009
@@ -69,6 +69,12 @@
G_CALLBACK (action_test_source_new_cb) }
};
+static void
+test_module_start (EShellModule *shell_module)
+{
+ g_debug ("%s", G_STRFUNC);
+}
+
static gboolean
test_module_is_busy (EShellModule *shell_module)
{
@@ -149,6 +155,7 @@
MODULE_SORT_ORDER,
/* Methods */
+ test_module_start,
test_module_is_busy,
test_module_shutdown,
test_module_migrate
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]