aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-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
11 files changed, 133 insertions, 62 deletions
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);