aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/e-util.c45
-rw-r--r--e-util/e-util.h3
-rw-r--r--mail/e-mail-browser.c3
-rw-r--r--modules/mail/e-mail-shell-view.c5
-rw-r--r--shell/e-shell-view.c5
-rw-r--r--shell/e-shell-window-actions.c7
-rw-r--r--ui/evolution-mail-reader.ui4
-rw-r--r--ui/evolution-shell.ui3
8 files changed, 64 insertions, 11 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 202c956dc1..16f665171b 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -314,28 +314,63 @@ e_load_ui_builder_definition (GtkBuilder *builder,
* e_load_ui_manager_definition:
* @ui_manager: a #GtkUIManager
* @basename: basename of the UI definition file
+ * @is_express: are we in 'express' mode ?
*
* 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.
+ * its UI definitions. Depending on the mode signalled by @is_express 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)
+ const gchar *basename,
+ gboolean is_express)
{
gchar *filename;
- guint merge_id;
+ 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);
- merge_id = gtk_ui_manager_add_ui_from_file (
- ui_manager, filename, &error);
+
+ /*
+ * Very simple line based pre-processing based on comments:
+ * <!-- if [!]EXPRESS --> ... <!-- endif -->
+ */
+ if (g_file_get_contents (filename, &buffer, NULL, &error)) {
+ int i;
+ gchar *filtered, **lines;
+ gboolean include = TRUE;
+
+ lines = g_strsplit (buffer, "\n", -1);
+ for (i = 0; lines[i]; i++) {
+ char *p;
+ if ((p = strstr (lines[i], "<!-- if "))) {
+ gboolean not_express = lines[i][8] == '!';
+ lines[i][0] = '\0';
+ include = is_express ^ not_express;
+ fprintf (stderr, "not exporess: %d from '%s' include to %d\n",
+ not_express, lines[i], include);
+ } else if ((p = strstr (lines[i], "<!-- endif"))) {
+ lines[i][0] = '\0';
+ include = TRUE;
+ }
+ 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);
+ }
+
g_free (filename);
if (error != NULL) {
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 45d3801453..5d369595bb 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -66,7 +66,8 @@ GtkActionGroup *e_lookup_action_group (GtkUIManager *ui_manager,
void e_load_ui_builder_definition (GtkBuilder *builder,
const gchar *basename);
guint e_load_ui_manager_definition (GtkUIManager *ui_manager,
- const gchar *basename);
+ const gchar *basename,
+ gboolean express);
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 59c09b6039..91dacbb392 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -505,7 +505,8 @@ 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 (ui_manager, E_MAIL_READER_UI_DEFINITION,
+ e_shell_get_express_mode (shell));
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index b85d146828..d922689b56 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -177,8 +177,11 @@ mail_shell_view_toggled (EShellView *shell_view)
basename = E_MAIL_READER_UI_DEFINITION;
if (view_is_active && priv->merge_id == 0) {
+ gboolean express = e_shell_get_express_mode (
+ e_shell_backend_get_shell (
+ e_shell_view_get_shell_backend (shell_view)));
priv->merge_id = e_load_ui_manager_definition (
- ui_manager, basename);
+ ui_manager, basename, express);
e_mail_reader_create_charset_menu (
E_MAIL_READER (priv->mail_shell_content),
ui_manager, priv->merge_id);
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 6135b58848..d029627153 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -594,8 +594,11 @@ shell_view_toggled (EShellView *shell_view)
id = shell_view_class->ui_manager_id;
if (view_is_active && priv->merge_id == 0) {
+ gboolean express = e_shell_get_express_mode (
+ e_shell_backend_get_shell (
+ e_shell_view_get_shell_backend (shell_view)));
priv->merge_id = e_load_ui_manager_definition (
- ui_manager, basename);
+ ui_manager, basename, express);
e_plugin_ui_enable_manager (ui_manager, id);
} else if (!view_is_active && priv->merge_id != 0) {
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index d751251eb3..b29a96e49b 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1867,13 +1867,16 @@ e_shell_window_actions_init (EShellWindow *shell_window)
GtkActionGroup *action_group;
EFocusTracker *focus_tracker;
GtkUIManager *ui_manager;
+ gboolean express;
gchar *path;
-
+
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ express = e_shell_get_express_mode (
+ e_shell_window_get_shell (shell_window));
ui_manager = e_shell_window_get_ui_manager (shell_window);
- e_load_ui_manager_definition (ui_manager, "evolution-shell.ui");
+ e_load_ui_manager_definition (ui_manager, "evolution-shell.ui", express);
/* Shell Actions */
action_group = ACTION_GROUP (SHELL);
diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui
index dc87cf08e5..b5aef127f9 100644
--- a/ui/evolution-mail-reader.ui
+++ b/ui/evolution-mail-reader.ui
@@ -120,15 +120,19 @@
</menu>
</toolitem>
<separator/>
+<!-- if !EXPRESS -->
<toolitem action='mail-print'/>
+<!-- endif -->
<toolitem action='mail-delete'/>
<toolitem action='mail-mark-junk'/>
<toolitem action='mail-mark-notjunk'/>
</placeholder>
<separator/>
<placeholder name='mail-toolbar-navigation'>
+<!-- if !EXPRESS -->
<toolitem action='mail-previous'/>
<toolitem action='mail-next'/>
+<!-- endif -->
</placeholder>
</toolbar>
<popup name='mail-message-popup'>
diff --git a/ui/evolution-shell.ui b/ui/evolution-shell.ui
index fab9255989..eb11673f0e 100644
--- a/ui/evolution-shell.ui
+++ b/ui/evolution-shell.ui
@@ -86,5 +86,8 @@
<toolitem action='send-receive'/>
<separator/>
<placeholder name='toolbar-actions'/>
+<!-- if !EXPRESS -->
+ <toolitem action='preferences'/>
+<!-- endif -->
</toolbar>
</ui>