aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/dialogs/comp-editor.c3
-rw-r--r--calendar/gui/dialogs/event-editor.c4
-rw-r--r--calendar/gui/dialogs/memo-editor.c4
-rw-r--r--calendar/gui/dialogs/task-editor.c4
-rw-r--r--capplet/settings/mail-account-view.c2
-rw-r--r--composer/e-msg-composer.c4
-rw-r--r--doc/reference/shell/eshell-sections.txt2
-rw-r--r--doc/reference/shell/tmpl/e-shell-switcher.sgml3
-rw-r--r--doc/reference/shell/tmpl/e-shell-utils.sgml9
-rw-r--r--doc/reference/shell/tmpl/e-shell.sgml14
-rw-r--r--e-util/Makefile.am2
-rw-r--r--e-util/e-plugin-ui.c33
-rw-r--r--e-util/e-plugin-ui.h12
-rw-r--r--e-util/e-util.c119
-rw-r--r--e-util/e-util.h8
-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
-rw-r--r--modules/mail/e-mail-shell-view-private.h1
-rw-r--r--modules/mail/e-mail-shell-view.c3
-rw-r--r--shell/e-shell-utils.c25
-rw-r--r--shell/e-shell-utils.h4
-rw-r--r--shell/e-shell-view.c7
-rw-r--r--shell/e-shell-window-actions.c13
-rw-r--r--shell/e-shell-window-private.c20
-rw-r--r--shell/e-shell-window-private.h1
-rw-r--r--shell/e-shell-window.c15
-rw-r--r--shell/e-shell-window.h1
-rw-r--r--shell/e-shell.c86
-rw-r--r--shell/e-shell.h2
-rw-r--r--shell/main.c21
-rw-r--r--widgets/misc/e-attachment-view.c3
-rw-r--r--widgets/misc/e-web-view.c6
33 files changed, 238 insertions, 236 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index e002f6afd4..15384d829d 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -66,6 +66,7 @@
#include "widgets/misc/e-attachment-paned.h"
#include "e-util/e-alert-dialog.h"
+#include "e-util/e-ui-manager.h"
#define COMP_EDITOR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -1608,7 +1609,7 @@ comp_editor_init (CompEditor *editor)
priv->warned = FALSE;
priv->is_group_item = FALSE;
- priv->ui_manager = gtk_ui_manager_new ();
+ priv->ui_manager = e_ui_manager_new ();
if (comp_lite)
gtk_window_set_default_size ((GtkWindow *) editor, 800, 450);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 23256adff0..6e8b049bee 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -507,8 +507,8 @@ event_editor_init (EventEditor *ee)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
id = "org.gnome.evolution.event-editor";
- e_plugin_ui_register_manager (ui_manager, id, ee);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, ee);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c
index 8e988c00a5..8e2a5619dd 100644
--- a/calendar/gui/dialogs/memo-editor.c
+++ b/calendar/gui/dialogs/memo-editor.c
@@ -143,8 +143,8 @@ memo_editor_init (MemoEditor *me)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
id = "org.gnome.evolution.memo-editor";
- e_plugin_ui_register_manager (ui_manager, id, me);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, me);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index a3d4baec46..c7e0440eda 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -365,8 +365,8 @@ task_editor_init (TaskEditor *te)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
id = "org.gnome.evolution.task-editor";
- e_plugin_ui_register_manager (ui_manager, id, te);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, te);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index 9201fcf03f..b63b68b7ad 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -662,7 +662,7 @@ mail_account_view_construct (MailAccountView *view)
em_account_editor_check (view->edit, mail_account_pages[0].path);
view->pages[0]->done = TRUE;
- if (e_shell_get_express_mode (NULL))
+ if (e_shell_get_express_mode (e_shell_get_default ()))
gtk_widget_hide (em_account_editor_get_widget (view->edit, "identity_optional_frame"));
}
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index b57bd156a5..86275b4755 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1745,8 +1745,8 @@ msg_composer_constructed (GObject *object)
gtkhtml_editor_set_changed (editor, FALSE);
id = "org.gnome.evolution.composer";
- e_plugin_ui_register_manager (ui_manager, id, composer);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, composer);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
}
static void
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
index 2ae9b9153a..be5171cb3d 100644
--- a/doc/reference/shell/eshell-sections.txt
+++ b/doc/reference/shell/eshell-sections.txt
@@ -15,6 +15,7 @@ e_shell_watch_window
e_shell_get_watched_windows
e_shell_get_active_window
e_shell_send_receive
+e_shell_get_express_mode
e_shell_get_module_directory
e_shell_get_network_available
e_shell_set_network_available
@@ -238,6 +239,7 @@ EShellTaskbarPrivate
<SECTION>
<FILE>e-shell-utils</FILE>
<TITLE>Shell Utilities</TITLE>
+e_shell_configure_ui_manager
e_shell_configure_web_view
e_shell_run_open_dialog
e_shell_run_save_dialog
diff --git a/doc/reference/shell/tmpl/e-shell-switcher.sgml b/doc/reference/shell/tmpl/e-shell-switcher.sgml
index f656b65988..33a6479c06 100644
--- a/doc/reference/shell/tmpl/e-shell-switcher.sgml
+++ b/doc/reference/shell/tmpl/e-shell-switcher.sgml
@@ -55,7 +55,8 @@ EShellSwitcher
</para>
@switcher:
-@action:
+@switch_action:
+@new_window_action:
<!-- ##### FUNCTION e_shell_switcher_get_style ##### -->
diff --git a/doc/reference/shell/tmpl/e-shell-utils.sgml b/doc/reference/shell/tmpl/e-shell-utils.sgml
index 5fb4913f96..a5768cf1f8 100644
--- a/doc/reference/shell/tmpl/e-shell-utils.sgml
+++ b/doc/reference/shell/tmpl/e-shell-utils.sgml
@@ -17,6 +17,15 @@ Shell Utilities
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### FUNCTION e_shell_configure_ui_manager ##### -->
+<para>
+
+</para>
+
+@shell:
+@ui_manager:
+
+
<!-- ##### FUNCTION e_shell_configure_web_view ##### -->
<para>
diff --git a/doc/reference/shell/tmpl/e-shell.sgml b/doc/reference/shell/tmpl/e-shell.sgml
index 394645413c..4d3f9a4e47 100644
--- a/doc/reference/shell/tmpl/e-shell.sgml
+++ b/doc/reference/shell/tmpl/e-shell.sgml
@@ -94,6 +94,11 @@ EShell
@eshell: the object which received the signal.
+<!-- ##### ARG EShell:express-mode ##### -->
+<para>
+
+</para>
+
<!-- ##### ARG EShell:geometry ##### -->
<para>
@@ -241,6 +246,15 @@ EShell
@parent:
+<!-- ##### FUNCTION e_shell_get_express_mode ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
<!-- ##### FUNCTION e_shell_get_module_directory ##### -->
<para>
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 419468480e..7384333452 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -51,6 +51,7 @@ eutilinclude_HEADERS = \
e-text-event-processor-types.h \
e-text-event-processor.h \
e-timeout-activity.h \
+ e-ui-manager.h \
e-util.h \
e-unicode.h \
e-xml-utils.h \
@@ -127,6 +128,7 @@ libeutil_la_SOURCES = \
e-text-event-processor-emacs-like.c \
e-text-event-processor.c \
e-timeout-activity.c \
+ e-ui-manager.c \
e-util.c \
e-unicode.c \
e-util-private.h \
diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c
index 133455b108..9a9a4f23ed 100644
--- a/e-util/e-plugin-ui.c
+++ b/e-util/e-plugin-ui.c
@@ -16,7 +16,9 @@
*/
#include "e-plugin-ui.h"
+
#include "e-util.h"
+#include "e-ui-manager.h"
#include <string.h>
@@ -165,7 +167,7 @@ static gpointer parent_class;
static void
plugin_ui_hook_unregister_manager (EPluginUIHook *hook,
- GtkUIManager *ui_manager)
+ EUIManager *ui_manager)
{
GHashTable *registry;
@@ -176,7 +178,7 @@ plugin_ui_hook_unregister_manager (EPluginUIHook *hook,
static void
plugin_ui_hook_register_manager (EPluginUIHook *hook,
- GtkUIManager *ui_manager,
+ EUIManager *ui_manager,
const gchar *id,
gpointer user_data)
{
@@ -227,7 +229,7 @@ plugin_ui_hook_register_manager (EPluginUIHook *hook,
static guint
plugin_ui_hook_merge_ui (EPluginUIHook *hook,
- GtkUIManager *ui_manager,
+ EUIManager *ui_manager,
const gchar *id)
{
GHashTable *hash_table;
@@ -239,7 +241,7 @@ plugin_ui_hook_merge_ui (EPluginUIHook *hook,
ui_definition = g_hash_table_lookup (hash_table, id);
g_return_val_if_fail (ui_definition != NULL, 0);
- merge_id = e_load_ui_manager_definition_from_string (
+ merge_id = e_ui_manager_add_ui_from_string (
ui_manager, ui_definition, &error);
if (error != NULL) {
@@ -252,7 +254,7 @@ plugin_ui_hook_merge_ui (EPluginUIHook *hook,
static void
plugin_ui_enable_manager (EPluginUIHook *hook,
- GtkUIManager *ui_manager,
+ EUIManager *ui_manager,
const gchar *id)
{
GHashTable *hash_table;
@@ -300,7 +302,7 @@ plugin_ui_enable_manager (EPluginUIHook *hook,
static void
plugin_ui_disable_manager (EPluginUIHook *hook,
- GtkUIManager *ui_manager,
+ EUIManager *ui_manager,
const gchar *id,
gboolean remove)
{
@@ -336,7 +338,8 @@ plugin_ui_disable_manager (EPluginUIHook *hook,
/* Merge ID could be 0 if the plugin is disabled. */
if (merge_id > 0)
- gtk_ui_manager_remove_ui (ui_manager, merge_id);
+ gtk_ui_manager_remove_ui (
+ GTK_UI_MANAGER (ui_manager), merge_id);
if (remove)
g_hash_table_remove (hash_table, id);
@@ -358,7 +361,7 @@ plugin_ui_enable_hook (EPluginUIHook *hook)
g_hash_table_iter_init (&iter, hash_table);
while (g_hash_table_iter_next (&iter, &key, NULL)) {
- GtkUIManager *ui_manager = key;
+ EUIManager *ui_manager = key;
plugin_ui_enable_manager (hook, ui_manager, NULL);
}
}
@@ -376,7 +379,7 @@ plugin_ui_disable_hook (EPluginUIHook *hook)
g_hash_table_iter_init (&iter, hash_table);
while (g_hash_table_iter_next (&iter, &key, NULL)) {
- GtkUIManager *ui_manager = key;
+ EUIManager *ui_manager = key;
plugin_ui_disable_manager (hook, ui_manager, NULL, FALSE);
}
}
@@ -546,13 +549,13 @@ e_plugin_ui_hook_get_type (void)
}
void
-e_plugin_ui_register_manager (GtkUIManager *ui_manager,
+e_plugin_ui_register_manager (EUIManager *ui_manager,
const gchar *id,
gpointer user_data)
{
GSList *plugin_list;
- g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+ g_return_if_fail (E_IS_UI_MANAGER (ui_manager));
g_return_if_fail (id != NULL);
/* Loop over all installed plugins. */
@@ -586,12 +589,12 @@ e_plugin_ui_register_manager (GtkUIManager *ui_manager,
}
void
-e_plugin_ui_enable_manager (GtkUIManager *ui_manager,
+e_plugin_ui_enable_manager (EUIManager *ui_manager,
const gchar *id)
{
GSList *plugin_list;
- g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+ g_return_if_fail (E_IS_UI_MANAGER (ui_manager));
g_return_if_fail (id != NULL);
/* Loop over all installed plugins. */
@@ -615,12 +618,12 @@ e_plugin_ui_enable_manager (GtkUIManager *ui_manager,
}
void
-e_plugin_ui_disable_manager (GtkUIManager *ui_manager,
+e_plugin_ui_disable_manager (EUIManager *ui_manager,
const gchar *id)
{
GSList *plugin_list;
- g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+ g_return_if_fail (E_IS_UI_MANAGER (ui_manager));
g_return_if_fail (id != NULL);
/* Loop over all installed plugins. */
diff --git a/e-util/e-plugin-ui.h b/e-util/e-plugin-ui.h
index c9bddafb64..e0cbb32f2d 100644
--- a/e-util/e-plugin-ui.h
+++ b/e-util/e-plugin-ui.h
@@ -19,7 +19,9 @@
#define E_PLUGIN_UI_H
#include <gtk/gtk.h>
-#include "e-plugin.h"
+
+#include <e-util/e-ui-manager.h>
+#include <e-util/e-plugin.h>
/* Standard GObject macros */
#define E_TYPE_PLUGIN_UI_HOOK \
@@ -57,17 +59,17 @@ struct _EPluginUIHookClass {
/* Plugins with "org.gnome.evolution.ui" hooks should define a
* function named e_plugin_ui_init() having this signature. */
-typedef gboolean (*EPluginUIInitFunc) (GtkUIManager *ui_manager,
+typedef gboolean (*EPluginUIInitFunc) (EUIManager *ui_manager,
gpointer user_data);
GType e_plugin_ui_hook_get_type (void);
-void e_plugin_ui_register_manager (GtkUIManager *ui_manager,
+void e_plugin_ui_register_manager (EUIManager *ui_manager,
const gchar *id,
gpointer user_data);
-void e_plugin_ui_enable_manager (GtkUIManager *ui_manager,
+void e_plugin_ui_enable_manager (EUIManager *ui_manager,
const gchar *id);
-void e_plugin_ui_disable_manager (GtkUIManager *ui_manager,
+void e_plugin_ui_disable_manager (EUIManager *ui_manager,
const gchar *id);
G_END_DECLS
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 3573952244..cf5c0b0464 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -310,125 +310,6 @@ e_load_ui_builder_definition (GtkBuilder *builder,
}
}
-
-void
-e_load_ui_manager_set_express (GtkUIManager *ui_manager,
- gboolean express)
-{
- g_object_set_data (G_OBJECT (ui_manager),
- "e-ui-mgr-express",
- GUINT_TO_POINTER (express));
-}
-
-static gboolean
-e_load_ui_manager_get_express (GtkUIManager *ui_manager)
-{
- gboolean express = GPOINTER_TO_UINT (
- g_object_get_data (G_OBJECT (ui_manager),
- "e-ui-mgr-express"));
- return express;
-}
-
-
-/**
- * e_load_ui_manager_definition_from_string:
- * @ui_manager: a #GtkUIManager
- * @string: the UI XML in NULL terminated string form
- *
- * Loads a UI definition into @ui_manager from Evolution's UI directory.
- * Depending on the mode signalled by the 'express' flag on the UI manager
- * a simplified version of the UI may be presented.
- *
- * Returns: The merge ID for the merged UI. The merge ID can be used to
- * unmerge the UI with gtk_ui_manager_remove_ui().
- **/
-guint
-e_load_ui_manager_definition_from_string (GtkUIManager *ui_manager,
- const gchar *ui_string,
- GError **error)
-{
- int i;
- guint merge_id;
- gchar *filtered, **lines;
- gboolean is_express, in_conditional = FALSE;
- gboolean include = TRUE;
-
- is_express = e_load_ui_manager_get_express (ui_manager);
-
- /*
- * Very simple line based pre-processing based on comments:
- * <!-- if [!]EXPRESS -->\n ... \n<!-- endif -->\n
- */
- lines = g_strsplit (ui_string, "\n", -1);
- for (i = 0; lines[i]; i++) {
- char *p;
- if ((p = strstr (lines[i], "<!-- if "))) {
- gboolean not_express = lines[i][8] == '!';
- include = is_express ^ not_express;
-/* g_warning ("not express: %d from '%s' include to %d (%d)",
- not_express, lines[i], include, is_express); */
- lines[i][0] = '\0';
- in_conditional = TRUE;
- } else if ((p = strstr (lines[i], "<!-- endif"))) {
- lines[i][0] = '\0';
- include = TRUE;
- in_conditional = FALSE;
- }
-/* if (in_conditional)
- g_warning ("conditional: (%d): '%s'", include, lines[i]); */
- if (!include)
- lines[i][0] = '\0';
- }
- filtered = g_strjoinv("\n", lines);
-
- merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, filtered, -1, error);
-
- g_free (filtered);
-
- return merge_id;
-}
-
-/**
- * e_load_ui_manager_definition:
- * @ui_manager: a #GtkUIManager
- * @basename: basename of the UI definition file
- *
- * Loads a UI definition into @ui_manager from Evolution's UI directory.
- * Failure here is fatal, since the application can't function without
- * its UI definitions.
- * Depending on the mode signalled by the 'express' flag on the UI manager
- * a simplified version of the UI may be presented.
- *
- * Returns: The merge ID for the merged UI. The merge ID can be used to
- * unmerge the UI with gtk_ui_manager_remove_ui().
- **/
-guint
-e_load_ui_manager_definition (GtkUIManager *ui_manager,
- const gchar *basename)
-{
- gchar *filename;
- guint merge_id = 0;
- GError *error = NULL;
- gchar *buffer;
-
- g_return_val_if_fail (GTK_IS_UI_MANAGER (ui_manager), 0);
- g_return_val_if_fail (basename != NULL, 0);
-
- filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
-
- if (g_file_get_contents (filename, &buffer, NULL, &error))
- merge_id = e_load_ui_manager_definition_from_string (ui_manager, buffer, &error);
-
- g_free (filename);
-
- if (error != NULL) {
- g_error ("%s: %s", basename, error->message);
- g_assert_not_reached ();
- }
-
- return merge_id;
-}
-
/**
* e_action_compare_by_label:
* @action1: a #GtkAction
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 34c02a2507..dfbc6c0746 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -65,14 +65,6 @@ GtkActionGroup *e_lookup_action_group (GtkUIManager *ui_manager,
const gchar *group_name);
void e_load_ui_builder_definition (GtkBuilder *builder,
const gchar *basename);
-void e_load_ui_manager_set_express (GtkUIManager *ui_manager,
- gboolean express);
-guint e_load_ui_manager_definition (GtkUIManager *ui_manager,
- const gchar *basename);
-guint e_load_ui_manager_definition_from_string
- (GtkUIManager *ui_manager,
- const gchar *ui_string,
- GError **error);
gint e_action_compare_by_label (GtkAction *action1,
GtkAction *action2);
void e_action_group_remove_all_actions
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 ||
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 9cdd71d13c..de237aff96 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -38,6 +38,7 @@
#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
#include "e-util/e-account-utils.h"
+#include "e-util/e-ui-manager.h"
#include "filter/e-filter-part.h"
#include "widgets/misc/e-web-view.h"
#include "widgets/misc/e-popup-action.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index c72a366159..c3429859f7 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -177,7 +177,8 @@ mail_shell_view_toggled (EShellView *shell_view)
basename = E_MAIL_READER_UI_DEFINITION;
if (view_is_active && priv->merge_id == 0) {
- priv->merge_id = e_load_ui_manager_definition (ui_manager, basename);
+ priv->merge_id = e_ui_manager_add_ui_from_file (
+ E_UI_MANAGER (ui_manager), basename);
e_mail_reader_create_charset_menu (
E_MAIL_READER (priv->mail_shell_content),
ui_manager, priv->merge_id);
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index f954492a0c..a584289d20 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -27,6 +27,31 @@
#include "widgets/misc/e-import-assistant.h"
/**
+ * e_shell_configure_ui_manager:
+ * @shell: an #EShell
+ * @ui_manager: an #EUIManager
+ *
+ * Adds shell integration to @ui_manager. In particular, it keeps
+ * @ui_manager's EUIManager:express-mode property synchronized with
+ * @shell's EShell:express-mode property.
+ **/
+void
+e_shell_configure_ui_manager (EShell *shell,
+ EUIManager *ui_manager)
+{
+ EShellSettings *shell_settings;
+
+ g_return_if_fail (E_IS_SHELL (shell));
+ g_return_if_fail (E_IS_UI_MANAGER (ui_manager));
+
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_binding_new (
+ shell, "express-mode",
+ ui_manager, "express-mode");
+}
+
+/**
* e_shell_configure_web_view:
* @shell: an #EShell
* @web_view: an #EWebView
diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h
index 18e90aa5f2..e705ded2e5 100644
--- a/shell/e-shell-utils.h
+++ b/shell/e-shell-utils.h
@@ -30,9 +30,13 @@
#include <shell/e-shell.h>
#include <misc/e-web-view.h>
+#include <e-util/e-ui-manager.h>
G_BEGIN_DECLS
+void e_shell_configure_ui_manager (EShell *shell,
+ EUIManager *ui_manager);
+
void e_shell_configure_web_view (EShell *shell,
EWebView *web_view);
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index b23966b627..33f7fe8d7c 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -594,11 +594,12 @@ shell_view_toggled (EShellView *shell_view)
id = shell_view_class->ui_manager_id;
if (view_is_active && priv->merge_id == 0) {
- priv->merge_id = e_load_ui_manager_definition (ui_manager, basename);
- e_plugin_ui_enable_manager (ui_manager, id);
+ priv->merge_id = e_ui_manager_add_ui_from_file (
+ E_UI_MANAGER (ui_manager), basename);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
} else if (!view_is_active && priv->merge_id != 0) {
- e_plugin_ui_disable_manager (ui_manager, id);
+ e_plugin_ui_disable_manager (E_UI_MANAGER (ui_manager), id);
gtk_ui_manager_remove_ui (ui_manager, priv->merge_id);
priv->merge_id = 0;
}
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index c2c5aea1af..b4330e95f2 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1887,7 +1887,8 @@ e_shell_window_actions_init (EShellWindow *shell_window)
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
ui_manager = e_shell_window_get_ui_manager (shell_window);
- e_load_ui_manager_definition (ui_manager, "evolution-shell.ui");
+ e_ui_manager_add_ui_from_file (
+ E_UI_MANAGER (ui_manager), "evolution-shell.ui");
/* Shell Actions */
action_group = ACTION_GROUP (SHELL);
@@ -2024,6 +2025,7 @@ express_filter_new_actions (GList *list)
GtkWidget *
e_shell_window_create_new_menu (EShellWindow *shell_window)
{
+ EShell *shell;
GtkActionGroup *action_group;
GList *new_item_actions;
GList *new_source_actions;
@@ -2031,6 +2033,8 @@ e_shell_window_create_new_menu (EShellWindow *shell_window)
GtkWidget *menu;
GtkWidget *separator;
+ shell = e_shell_window_get_shell (shell_window);
+
/* Get sorted lists of "new item" and "new source" actions. */
action_group = ACTION_GROUP (NEW_ITEM);
@@ -2058,7 +2062,7 @@ e_shell_window_create_new_menu (EShellWindow *shell_window)
for (iter = list; iter != NULL; iter = iter->next)
iter->data = gtk_action_create_menu_item (iter->data);
- if (e_shell_window_get_express_mode (shell_window)) {
+ if (e_shell_get_express_mode (shell)) {
new_item_actions = express_filter_new_actions (new_item_actions);
g_list_free (new_source_actions);
new_source_actions = NULL;
@@ -2325,8 +2329,9 @@ e_shell_window_update_view_menu (EShellWindow *shell_window)
gtk_action_group_add_action (action_group, action);
gtk_ui_manager_add_ui (
- ui_manager, merge_id, path, action_name,
- action_name, GTK_UI_MANAGER_AUTO, FALSE);
+ ui_manager, merge_id,
+ path, action_name, action_name,
+ GTK_UI_MANAGER_AUTO, FALSE);
g_free (action_name);
g_free (tooltip);
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 07f8f5bf1a..e70e76673c 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -228,7 +228,7 @@ e_shell_window_private_init (EShellWindow *shell_window)
signal_handler_ids = g_array_new (FALSE, FALSE, sizeof (gulong));
- priv->ui_manager = gtk_ui_manager_new ();
+ priv->ui_manager = e_ui_manager_new ();
priv->loaded_views = loaded_views;
priv->signal_handler_ids = signal_handler_ids;
@@ -282,20 +282,20 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
e_shell_watch_window (shell, window);
- e_load_ui_manager_set_express (priv->ui_manager,
- e_shell_get_express_mode (shell));
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ e_shell_configure_ui_manager (shell, E_UI_MANAGER (ui_manager));
/* Defer actions and menu merging until we have set express mode */
e_shell_window_actions_init (shell_window);
- accel_group = gtk_ui_manager_get_accel_group (priv->ui_manager);
+ accel_group = gtk_ui_manager_get_accel_group (ui_manager);
gtk_window_add_accel_group (GTK_WINDOW (shell_window), accel_group);
- merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
priv->custom_rule_merge_id = merge_id;
- merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
priv->gal_view_merge_id = merge_id;
@@ -425,7 +425,7 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
key = "/apps/evolution/shell/view_defaults/statusbar_visible";
gconf_bridge_bind_property (bridge, key, object, "taskbar-visible");
- if (e_shell_get_express_mode(NULL)) {
+ if (e_shell_get_express_mode (shell)) {
e_shell_window_set_switcher_visible (shell_window, FALSE);
} else {
object = G_OBJECT (shell_window);
@@ -456,9 +456,9 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
shell_window_init_switcher_style (shell_window);
id = "org.gnome.evolution.shell";
- ui_manager = e_shell_window_get_ui_manager (shell_window);
- e_plugin_ui_register_manager (ui_manager, id, shell_window);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (
+ E_UI_MANAGER (ui_manager), id, shell_window);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
}
void
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
index b11222d93a..6050ce135d 100644
--- a/shell/e-shell-window-private.h
+++ b/shell/e-shell-window-private.h
@@ -41,6 +41,7 @@
#include <e-shell-view.h>
#include <e-shell-switcher.h>
#include <e-shell-window-actions.h>
+#include <e-shell-utils.h>
#define E_SHELL_WINDOW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 8cb1ed8831..283445766c 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -541,7 +541,8 @@ shell_window_create_shell_view (EShellWindow *shell_window,
/* Register the GtkUIManager ID for the shell view. */
id = E_SHELL_VIEW_GET_CLASS (shell_view)->ui_manager_id;
ui_manager = e_shell_window_get_ui_manager (shell_window);
- e_plugin_ui_register_manager (ui_manager, id, shell_view);
+ e_plugin_ui_register_manager (
+ E_UI_MANAGER (ui_manager), id, shell_view);
/* Add pages to the various shell window notebooks. */
@@ -1149,18 +1150,6 @@ e_shell_window_get_safe_mode (EShellWindow *shell_window)
}
/**
- * e_shell_window_get_safe_mode:
- * @shell_window: an #EShellWindow
- *
- * Returns %TRUE if @shell_window is in "express mode".
- **/
-gboolean
-e_shell_window_get_express_mode (EShellWindow *shell_window)
-{
- return e_shell_get_express_mode (e_shell_window_get_shell (shell_window));
-}
-
-/**
* e_shell_window_set_safe_mode:
* @shell_window: an #EShellWindow
* @safe_mode: whether to put @shell_window into "safe mode"
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 3d8696a066..0bd71075c9 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -117,7 +117,6 @@ void e_shell_window_set_active_view (EShellWindow *shell_window,
gboolean e_shell_window_get_safe_mode (EShellWindow *shell_window);
void e_shell_window_set_safe_mode (EShellWindow *shell_window,
gboolean safe_mode);
-gboolean e_shell_window_get_express_mode (EShellWindow *shell_window);
void e_shell_window_add_action_group (EShellWindow *shell_window,
const gchar *group_name);
gboolean e_shell_window_get_sidebar_visible
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 73ea0ac520..8dbf8a5f84 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -60,11 +60,12 @@ struct _EShellPrivate {
guint online : 1;
guint quit_cancelled : 1;
guint safe_mode : 1;
- guint express : 1;
+ guint express_mode : 1;
};
enum {
PROP_0,
+ PROP_EXPRESS_MODE,
PROP_GEOMETRY,
PROP_MODULE_DIRECTORY,
PROP_NETWORK_AVAILABLE,
@@ -466,6 +467,13 @@ shell_sm_quit_cb (EShell *shell,
}
static void
+shell_set_express_mode (EShell *shell,
+ gboolean express_mode)
+{
+ shell->priv->express_mode = express_mode;
+}
+
+static void
shell_set_geometry (EShell *shell,
const gchar *geometry)
{
@@ -490,6 +498,12 @@ shell_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EXPRESS_MODE:
+ shell_set_express_mode (
+ E_SHELL (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_GEOMETRY:
shell_set_geometry (
E_SHELL (object),
@@ -525,6 +539,12 @@ shell_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EXPRESS_MODE:
+ g_value_set_boolean (
+ value, e_shell_get_express_mode (
+ E_SHELL (object)));
+ return;
+
case PROP_MODULE_DIRECTORY:
g_value_set_string (
value, e_shell_get_module_directory (
@@ -613,14 +633,16 @@ shell_finalize (GObject *object)
static void
shell_constructed (GObject *object)
{
+ EShellPrivate *priv;
+
+ priv = E_SHELL_GET_PRIVATE (object);
+
/* The first EShell instance is the default. */
if (default_shell == NULL) {
default_shell = object;
g_object_add_weak_pointer (object, &default_shell);
}
- E_SHELL (object)->priv->express = e_shell_get_express_mode (NULL);
-
/* UniqueApp will have by this point determined whether we're
* the only Evolution process running. If so, proceed normally.
* Otherwise we just issue commands to the other process. */
@@ -751,6 +773,23 @@ shell_class_init (EShellClass *class)
class->window_destroyed = shell_window_destroyed;
/**
+ * EShell:express-mode
+ *
+ * Express mode alters Evolution's user interface to be more
+ * usable on devices with small screens.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_EXPRESS_MODE,
+ g_param_spec_boolean (
+ "express-mode",
+ "Express Mode",
+ "Whether express mode is enabled",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
* EShell:geometry
*
* User-specified initial window geometry string to apply
@@ -1554,6 +1593,22 @@ e_shell_send_receive (EShell *shell,
}
/**
+ * e_shell_get_express_mode:
+ * @shell: an #EShell
+ *
+ * Returns %TRUE if Evolution is in express mode.
+ *
+ * Returns: %TRUE if Evolution is in express mode
+ **/
+gboolean
+e_shell_get_express_mode (EShell *shell)
+{
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ return shell->priv->express_mode;
+}
+
+/**
* e_shell_get_module_directory:
* @shell: an #EShell
*
@@ -1662,31 +1717,6 @@ e_shell_set_online (EShell *shell,
}
/**
- * e_shell_get_express_mode:
- * @shell: an #EShell, or NULL for the global value
- *
- * Returns %TRUE if Evolution is in express mode, %FALSE if Evolution not.
- *
- **/
-gboolean
-e_shell_get_express_mode (EShell *shell)
-{
- if (shell)
- return shell->priv->express;
-
- if (g_getenv ("EVO_EXPRESS"))
- return TRUE;
-
- shell = e_shell_get_default ();
- g_return_val_if_fail (shell != NULL, FALSE);
-
- return gconf_client_get_bool (
- shell->priv->gconf_client,
- "/apps/evolution/shell/express_mode",
- NULL);
-}
-
-/**
* e_shell_get_preferences_window:
* @shell: an #EShell
*
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 33d1e1c496..5ff9abb77d 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -114,6 +114,7 @@ GList * e_shell_get_watched_windows (EShell *shell);
GtkWindow * e_shell_get_active_window (EShell *shell);
void e_shell_send_receive (EShell *shell,
GtkWindow *parent);
+gboolean e_shell_get_express_mode (EShell *shell);
const gchar * e_shell_get_module_directory (EShell *shell);
gboolean e_shell_get_network_available (EShell *shell);
void e_shell_set_network_available (EShell *shell,
@@ -121,7 +122,6 @@ void e_shell_set_network_available (EShell *shell,
gboolean e_shell_get_online (EShell *shell);
void e_shell_set_online (EShell *shell,
gboolean online);
-gboolean e_shell_get_express_mode (EShell *shell);
GtkWidget * e_shell_get_preferences_window (EShell *shell);
void e_shell_event (EShell *shell,
const gchar *event_name,
diff --git a/shell/main.c b/shell/main.c
index 29affc8c72..4848ef92b8 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -77,6 +77,7 @@
#endif
/* Command-line options. */
+static gboolean express_mode = FALSE;
static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
static gboolean setup_only = FALSE;
@@ -322,6 +323,8 @@ static GOptionEntry entries[] = {
N_("Start in offline mode"), NULL },
{ "online", '\0', 0, G_OPTION_ARG_NONE, &start_online,
N_("Start in online mode"), NULL },
+ { "express", '\0', 0, G_OPTION_ARG_NONE, &express_mode,
+ N_("Start in \"express\" mode"), NULL },
#ifdef KILL_PROCESS_CMD
{ "force-shutdown", '\0', 0, G_OPTION_ARG_NONE, &force_shutdown,
N_("Forcibly shut down Evolution"), NULL },
@@ -412,11 +415,12 @@ create_default_shell (void)
GError *error = NULL;
client = gconf_client_get_default ();
- key = "/apps/evolution/shell/start_offline";
/* Requesting online or offline mode from the command-line
* should be persistent, just like selecting it in the UI. */
+ key = "/apps/evolution/shell/start_offline";
+
if (start_online) {
online = TRUE;
gconf_client_set_bool (client, key, FALSE, &error);
@@ -433,7 +437,19 @@ create_default_shell (void)
if (error != NULL) {
g_warning ("%s", error->message);
- g_error_free (error);
+ g_clear_error (&error);
+ }
+
+ /* Determine whether to run Evolution in "express" mode. */
+
+ key = "/apps/evolution/shell/express_mode";
+
+ if (!express_mode)
+ express_mode = gconf_client_get_bool (client, key, &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
}
shell = g_object_new (
@@ -441,6 +457,7 @@ create_default_shell (void)
"name", "org.gnome.Evolution",
"geometry", geometry,
"module-directory", EVOLUTION_MODULEDIR,
+ "express-mode", express_mode,
"online", online,
NULL);
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index 1d76b5dd8d..9725604865 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -28,6 +28,7 @@
#include "e-util/e-binding.h"
#include "e-util/e-selection.h"
+#include "e-util/e-ui-manager.h"
#include "e-util/e-util.h"
#include "e-attachment-dialog.h"
#include "e-attachment-handler-image.h"
@@ -787,7 +788,7 @@ e_attachment_view_init (EAttachmentView *view)
priv = e_attachment_view_get_private (view);
- ui_manager = gtk_ui_manager_new ();
+ ui_manager = e_ui_manager_new ();
priv->merge_id = gtk_ui_manager_new_merge_id (ui_manager);
priv->ui_manager = ui_manager;
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index ce41c32d4c..8744bef74b 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -1229,7 +1229,7 @@ web_view_init (EWebView *web_view)
web_view->priv = E_WEB_VIEW_GET_PRIVATE (web_view);
- ui_manager = gtk_ui_manager_new ();
+ ui_manager = e_ui_manager_new ();
web_view->priv->ui_manager = ui_manager;
g_signal_connect_swapped (
@@ -1331,8 +1331,8 @@ web_view_init (EWebView *web_view)
g_error ("%s", error->message);
id = "org.gnome.evolution.webview";
- e_plugin_ui_register_manager (ui_manager, id, web_view);
- e_plugin_ui_enable_manager (ui_manager, id);
+ e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, web_view);
+ e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
}
GType