diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-03-05 04:26:59 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-14 09:53:17 +0800 |
commit | d7494c8f160b12e1199b06dcafdc8ff01b24b796 (patch) | |
tree | 28e4c85c915c770a4e7bfb48ede7f686d18da206 /shell/e-shell.c | |
parent | 51cbd483d163138c3b570b01f0921f767ca64a7e (diff) | |
download | gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.gz gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.bz2 gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.lz gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.xz 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 'shell/e-shell.c')
-rw-r--r-- | shell/e-shell.c | 86 |
1 files changed, 58 insertions, 28 deletions
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 * |