diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-03-04 00:56:13 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-14 09:53:17 +0800 |
commit | c0f1cd53092a42fd0b96a132bda6ab8119f344ae (patch) | |
tree | 6a9dd837a0dc697d860fdd14b1b7d8641e8cf3fa /shell/e-shell-window-actions.c | |
parent | 20168f042f92a0e2037a68453304e7e9f5d1a324 (diff) | |
download | gsoc2013-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/e-shell-window-actions.c')
-rw-r--r-- | shell/e-shell-window-actions.c | 34 |
1 files changed, 31 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. */ |