aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-03-04 00:56:13 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-14 09:53:17 +0800
commitc0f1cd53092a42fd0b96a132bda6ab8119f344ae (patch)
tree6a9dd837a0dc697d860fdd14b1b7d8641e8cf3fa /shell
parent20168f042f92a0e2037a68453304e7e9f5d1a324 (diff)
downloadgsoc2013-evolution-c0f1cd53092a42fd0b96a132bda6ab8119f344ae.tar.gz
gsoc2013-evolution-c0f1cd53092a42fd0b96a132bda6ab8119f344ae.tar.zst
gsoc2013-evolution-c0f1cd53092a42fd0b96a132bda6ab8119f344ae.zip
make the 'New' drop-down menu much cleaner for express mode
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-window-actions.c34
-rw-r--r--shell/e-shell-window.c12
-rw-r--r--shell/e-shell-window.h1
3 files changed, 44 insertions, 3 deletions
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 9f9b043102..7a091a1c49 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -2001,6 +2001,26 @@ e_shell_window_actions_init (EShellWindow *shell_window)
g_free (path);
}
+static GList *
+express_filter_new_actions (GList *list)
+{
+ GList *l, *filtered = NULL;
+
+ for (l = list; l; l = l->next) {
+ const gchar *backend_name;
+
+ backend_name = g_object_get_data (
+ G_OBJECT (l->data), "backend-name");
+
+ /* only the addressbook pieces in express mode */
+ if (!strcmp (backend_name, "addressbook"))
+ filtered = g_list_prepend (filtered, l->data);
+ }
+ g_list_free (list);
+
+ return g_list_reverse (filtered);
+}
+
GtkWidget *
e_shell_window_create_new_menu (EShellWindow *shell_window)
{
@@ -2038,6 +2058,12 @@ 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)) {
+ new_item_actions = express_filter_new_actions (new_item_actions);
+ g_list_free (new_source_actions);
+ new_source_actions = NULL;
+ }
+
for (iter = new_item_actions; iter != NULL; iter = iter->next)
iter->data = gtk_action_create_menu_item (iter->data);
@@ -2050,9 +2076,11 @@ e_shell_window_create_new_menu (EShellWindow *shell_window)
new_item_actions = g_list_prepend (new_item_actions, separator);
gtk_widget_show (GTK_WIDGET (separator));
- separator = gtk_separator_menu_item_new ();
- new_source_actions = g_list_prepend (new_source_actions, separator);
- gtk_widget_show (GTK_WIDGET (separator));
+ if (new_source_actions != NULL) {
+ separator = gtk_separator_menu_item_new ();
+ new_source_actions = g_list_prepend (new_source_actions, separator);
+ gtk_widget_show (GTK_WIDGET (separator));
+ }
/* Merge everything into one list, reflecting the menu layout. */
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 5513efbe95..8cb1ed8831 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -1149,6 +1149,18 @@ 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 0bd71075c9..3d8696a066 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -117,6 +117,7 @@ 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