aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-05 04:26:59 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-14 09:53:17 +0800
commitd7494c8f160b12e1199b06dcafdc8ff01b24b796 (patch)
tree28e4c85c915c770a4e7bfb48ede7f686d18da206 /mail
parent51cbd483d163138c3b570b01f0921f767ca64a7e (diff)
downloadgsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.gz
gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.zst
gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.zip
Shell and UI manager cleanups.
Replace the EVO_EXPRESS environment variable with an --express command line option. (Note, this adds a new translatable string for --help.) Add an EUIManager class with an "express-mode" property and custom load functions that use our new "express" preprocessor. This replaces the UI manager functions in e-utils.c. (Also going to see if I can get GTK+ to add an "add_ui_from_string" method to GtkUIManagerClass that we can override. Then we could just call gtk_ui_manager_add_ui_from_string() and the preprocessor would automatically do its thing and chain up.) Add an "express-mode" read-only GObject property to EShell. Add e_shell_configure_ui_manager() to e-shell-utils.c. For now this just creates a one-way property binding: EShell:express-mode -> EUIManager:express-mode Call this immediately after e_ui_manager_new(). (EUIManager can't do this itself because it lives too low in the dependency hierarchy and doesn't know about EShell.)
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-browser.c28
-rw-r--r--mail/em-folder-tree-model.c6
-rw-r--r--mail/em-folder-tree.c9
3 files changed, 32 insertions, 11 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 13934d9c59..5c36049cce 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -29,6 +29,7 @@
#include "e-util/e-plugin-ui.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell.h"
+#include "shell/e-shell-utils.h"
#include "widgets/misc/e-popup-action.h"
#include "widgets/misc/e-preview-pane.h"
@@ -505,10 +506,12 @@ mail_browser_constructed (GObject *object)
G_N_ELEMENTS (mail_browser_popup_entries));
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
- e_load_ui_manager_definition (ui_manager, E_MAIL_READER_UI_DEFINITION);
- e_load_ui_manager_definition_from_string (ui_manager, ui, NULL);
+ e_ui_manager_add_ui_from_file (
+ E_UI_MANAGER (ui_manager), E_MAIL_READER_UI_DEFINITION);
+ e_ui_manager_add_ui_from_string (
+ E_UI_MANAGER (ui_manager), ui, NULL);
- merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (ui_manager));
e_mail_reader_create_charset_menu (reader, ui_manager, merge_id);
accel_group = gtk_ui_manager_get_accel_group (ui_manager);
@@ -577,8 +580,8 @@ mail_browser_constructed (GObject *object)
gconf_bridge_bind_property (bridge, key, object, "show-deleted");
id = "org.gnome.evolution.mail.browser";
- e_plugin_ui_register_manager (ui_manager, id, object);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, object);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
}
static gboolean
@@ -770,14 +773,23 @@ mail_browser_iface_init (EMailReaderIface *iface)
static void
mail_browser_init (EMailBrowser *browser)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ GtkUIManager *ui_manager;
+ EMailReader *reader;
GConfBridge *bridge;
const gchar *prefix;
browser->priv = E_MAIL_BROWSER_GET_PRIVATE (browser);
- browser->priv->ui_manager = gtk_ui_manager_new ();
- e_load_ui_manager_set_express (browser->priv->ui_manager,
- e_shell_get_express_mode (NULL));
+ reader = E_MAIL_READER (browser);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ ui_manager = e_ui_manager_new ();
+ e_shell_configure_ui_manager (shell, E_UI_MANAGER (ui_manager));
+
+ browser->priv->ui_manager = ui_manager;
browser->priv->action_group = gtk_action_group_new ("mail-browser");
browser->priv->html_display = em_format_html_display_new ();
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index cedd234cb1..3daacc52c5 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -121,12 +121,16 @@ folder_tree_model_sort (GtkTreeModel *model,
GtkTreeIter *b,
gpointer user_data)
{
+ EShell *shell;
gchar *aname, *bname;
CamelStore *store;
gboolean is_store;
guint32 aflags, bflags;
gint rv = -2;
+ /* XXX Pass the EShell in as user_data. */
+ shell = e_shell_get_default ();
+
gtk_tree_model_get (
model, a,
COL_BOOL_IS_STORE, &is_store,
@@ -142,7 +146,7 @@ folder_tree_model_sort (GtkTreeModel *model,
if (is_store) {
/* On This Computer is always first, and Search Folders
* is always last. */
- if (e_shell_get_express_mode (NULL)) {
+ if (e_shell_get_express_mode (shell)) {
if (!strcmp (aname, _("On This Computer")) &&
!strcmp (bname, _("Search Folders")))
rv = -1;
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 4a7df713b5..bbb9ec379b 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2619,8 +2619,10 @@ sort_by_store_and_uri (gconstpointer name1, gconstpointer name2)
/* restores state of a tree (collapsed/expanded) as stores in the given key_file */
void
-em_folder_tree_restore_state (EMFolderTree *folder_tree, GKeyFile *key_file)
+em_folder_tree_restore_state (EMFolderTree *folder_tree,
+ GKeyFile *key_file)
{
+ EShell *shell;
GtkTreeModel *tree_model;
GtkTreeView *tree_view;
GtkTreeIter iter;
@@ -2633,6 +2635,9 @@ em_folder_tree_restore_state (EMFolderTree *folder_tree, GKeyFile *key_file)
if (key_file == NULL)
return;
+ /* XXX Pass this in. */
+ shell = e_shell_get_default ();
+
tree_view = GTK_TREE_VIEW (folder_tree);
tree_model = gtk_tree_view_get_model (tree_view);
@@ -2717,7 +2722,7 @@ em_folder_tree_restore_state (EMFolderTree *folder_tree, GKeyFile *key_file)
group_name = g_strdup_printf ("Store %s", uri);
- if (e_shell_get_express_mode (NULL)) {
+ if (e_shell_get_express_mode (shell)) {
gboolean system = FALSE;
if (strncmp (uri, "vfolder", 7) == 0 ||