aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-08-11 04:17:40 +0800
committerMichael Meeks <michael.meeks@novell.com>2010-08-11 04:17:40 +0800
commit18813ccd8f4367ac98348f08e183d858cfe963f5 (patch)
tree370b866001d65bd5d1c343331bd01d8d4df3f975 /modules/mail
parentabd3e2a257586a96cac80f9ac860bba3c3d65d30 (diff)
downloadgsoc2013-evolution-18813ccd8f4367ac98348f08e183d858cfe963f5.tar.gz
gsoc2013-evolution-18813ccd8f4367ac98348f08e183d858cfe963f5.tar.zst
gsoc2013-evolution-18813ccd8f4367ac98348f08e183d858cfe963f5.zip
Defer the load / creation of configuration UI with changes to
e_preferences_window to take factory callbacks and store a reference to the shell. - This makes start-up substantially faster, particularly on Atom (eg.). Remove a number of idle handlers used to create these UIs in the first instance, cleaning the code.
Diffstat (limited to 'modules/mail')
-rw-r--r--modules/mail/e-mail-shell-backend.c86
-rw-r--r--modules/mail/em-account-prefs.c7
-rw-r--r--modules/mail/em-account-prefs.h5
-rw-r--r--modules/mail/em-composer-prefs.c3
-rw-r--r--modules/mail/em-composer-prefs.h9
-rw-r--r--modules/mail/em-mailer-prefs.c3
-rw-r--r--modules/mail/em-mailer-prefs.h8
-rw-r--r--modules/mail/em-network-prefs.c2
-rw-r--r--modules/mail/em-network-prefs.h5
9 files changed, 62 insertions, 66 deletions
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 5a659cb884..09f5068e82 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -23,7 +23,6 @@
#include <glib/gi18n.h>
-#include "e-util/e-account-utils.h"
#include "e-util/e-binding.h"
#include "e-util/e-import.h"
#include "e-util/e-util.h"
@@ -182,52 +181,6 @@ static GtkActionEntry source_entries[] = {
G_CALLBACK (action_mail_folder_new_cb) }
};
-static gboolean
-mail_shell_backend_init_preferences (EShell *shell)
-{
- EAccountList *account_list;
- GtkWidget *preferences_window;
-
- /* This is a main loop idle callback. */
-
- account_list = e_get_account_list ();
- preferences_window = e_shell_get_preferences_window (shell);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "mail-accounts",
- "preferences-mail-accounts",
- _("Mail Accounts"),
- em_account_prefs_new (account_list),
- 100);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "mail",
- "preferences-mail",
- _("Mail Preferences"),
- em_mailer_prefs_new (shell),
- 300);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "composer",
- "preferences-composer",
- _("Composer Preferences"),
- em_composer_prefs_new (shell),
- 400);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "system-network-proxy",
- "preferences-system-network-proxy",
- _("Network Preferences"),
- em_network_prefs_new (),
- 500);
-
- return FALSE;
-}
-
static void
mail_shell_backend_sync_store_done_cb (CamelStore *store,
gpointer user_data)
@@ -474,6 +427,7 @@ mail_shell_backend_constructed (GObject *object)
{
EShell *shell;
EShellBackend *shell_backend;
+ GtkWidget *preferences_window;
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
@@ -513,9 +467,41 @@ mail_shell_backend_constructed (GObject *object)
e_mail_shell_settings_init (shell);
- /* Initialize preferences after the main loop starts so
- * that all EPlugins and EPluginHooks are loaded first. */
- g_idle_add ((GSourceFunc) mail_shell_backend_init_preferences, shell);
+
+ /* Setup preference widget factories */
+ preferences_window = e_shell_get_preferences_window (shell);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "mail-accounts",
+ "preferences-mail-accounts",
+ _("Mail Accounts"),
+ em_account_prefs_new,
+ 100);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "mail",
+ "preferences-mail",
+ _("Mail Preferences"),
+ em_mailer_prefs_new,
+ 300);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "composer",
+ "preferences-composer",
+ _("Composer Preferences"),
+ em_composer_prefs_new,
+ 400);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "system-network-proxy",
+ "preferences-system-network-proxy",
+ _("Network Preferences"),
+ em_network_prefs_new,
+ 500);
}
static void
diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c
index 90aaa968f7..310f18ed7b 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -33,6 +33,7 @@
#include <glib/gi18n.h>
#include "e-util/e-alert-dialog.h"
+#include "e-util/e-account-utils.h"
#include "e-mail-store.h"
#include "em-config.h"
@@ -326,8 +327,12 @@ em_account_prefs_get_type (void)
}
GtkWidget *
-em_account_prefs_new (EAccountList *account_list)
+em_account_prefs_new (EPreferencesWindow *window)
{
+ EAccountList *account_list;
+
+ account_list = e_get_account_list ();
+
g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), NULL);
return g_object_new (
diff --git a/modules/mail/em-account-prefs.h b/modules/mail/em-account-prefs.h
index 82df8fa941..5fe49b6b31 100644
--- a/modules/mail/em-account-prefs.h
+++ b/modules/mail/em-account-prefs.h
@@ -26,6 +26,7 @@
#include <table/e-table.h>
#include <libedataserver/e-account-list.h>
#include <misc/e-account-manager.h>
+#include <widgets/misc/e-preferences-window.h>
/* Standard GObject macros */
#define EM_TYPE_ACCOUNT_PREFS \
@@ -61,8 +62,8 @@ struct _EMAccountPrefsClass {
EAccountManagerClass parent_class;
};
-GType em_account_prefs_get_type (void);
-GtkWidget * em_account_prefs_new (EAccountList *account_list);
+GType em_account_prefs_get_type (void);
+GtkWidget *em_account_prefs_new (EPreferencesWindow *window);
G_END_DECLS
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index a975a3a92d..a87be9e3c5 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -592,9 +592,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
}
GtkWidget *
-em_composer_prefs_new (EShell *shell)
+em_composer_prefs_new (EPreferencesWindow *window)
{
EMComposerPrefs *prefs;
+ EShell *shell = e_preferences_window_get_shell (window);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
diff --git a/modules/mail/em-composer-prefs.h b/modules/mail/em-composer-prefs.h
index af4979ae18..4cbcb31128 100644
--- a/modules/mail/em-composer-prefs.h
+++ b/modules/mail/em-composer-prefs.h
@@ -27,6 +27,7 @@
#include <gtkhtml/gtkhtml.h>
#include <shell/e-shell.h>
+#include <widgets/misc/e-preferences-window.h>
/* Standard GObject macros */
#define EM_TYPE_COMPOSER_PREFS \
@@ -75,10 +76,10 @@ struct _EMComposerPrefsClass {
GtkVBoxClass parent_class;
};
-GType em_composer_prefs_get_type (void);
-GtkWidget * em_composer_prefs_new (EShell *shell);
-void em_composer_prefs_new_signature (GtkWindow *parent,
- gboolean html_mode);
+GType em_composer_prefs_get_type (void);
+GtkWidget *em_composer_prefs_new (EPreferencesWindow *window);
+void em_composer_prefs_new_signature (GtkWindow *parent,
+ gboolean html_mode);
G_END_DECLS
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 80163a4713..7a6b86da18 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -1237,9 +1237,10 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
}
GtkWidget *
-em_mailer_prefs_new (EShell *shell)
+em_mailer_prefs_new (EPreferencesWindow *window)
{
EMMailerPrefs *new;
+ EShell *shell = e_preferences_window_get_shell (window);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
diff --git a/modules/mail/em-mailer-prefs.h b/modules/mail/em-mailer-prefs.h
index db77493416..a6b3f1876e 100644
--- a/modules/mail/em-mailer-prefs.h
+++ b/modules/mail/em-mailer-prefs.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <shell/e-shell.h>
+#include <widgets/misc/e-preferences-window.h>
/* Standard GObject macros */
#define EM_TYPE_MAILER_PREFS \
@@ -108,10 +109,9 @@ struct _EMMailerPrefsClass {
GtkVBoxClass parent_class;
};
-GType em_mailer_prefs_get_type (void);
-GtkWidget * create_combo_text_widget (void);
-
-GtkWidget * em_mailer_prefs_new (EShell *shell);
+GType em_mailer_prefs_get_type (void);
+GtkWidget *create_combo_text_widget (void);
+GtkWidget *em_mailer_prefs_new (EPreferencesWindow *window);
G_END_DECLS
diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c
index 85a0a82ca3..efa9e0a090 100644
--- a/modules/mail/em-network-prefs.c
+++ b/modules/mail/em-network-prefs.c
@@ -488,7 +488,7 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
}
GtkWidget *
-em_network_prefs_new (void)
+em_network_prefs_new (EPreferencesWindow *window)
{
EMNetworkPrefs *new;
diff --git a/modules/mail/em-network-prefs.h b/modules/mail/em-network-prefs.h
index c7a70a803a..4196686ffe 100644
--- a/modules/mail/em-network-prefs.h
+++ b/modules/mail/em-network-prefs.h
@@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
+#include <widgets/misc/e-preferences-window.h>
/* Standard GObject macros */
#define EM_TYPE_NETWORK_PREFS \
@@ -93,8 +94,8 @@ struct _EMNetworkPrefsClass {
GtkVBoxClass parent_class;
};
-GType em_network_prefs_get_type (void);
-GtkWidget * em_network_prefs_new (void);
+GType em_network_prefs_get_type (void);
+GtkWidget *em_network_prefs_new (EPreferencesWindow *window);
G_END_DECLS