aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-01-18 04:06:17 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-01-18 04:06:17 +0800
commitc22126d54f0cf0637e3d5ddd5d78b3ff5d111582 (patch)
tree64f296a85dd817e3184159126e8dbde39c173363 /mail
parent4d07d219d1f18aeba2c16317ade4b4004d8934b9 (diff)
downloadgsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.tar
gsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.tar.gz
gsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.tar.bz2
gsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.tar.lz
gsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.tar.xz
gsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.tar.zst
gsoc2013-evolution-c22126d54f0cf0637e3d5ddd5d78b3ff5d111582.zip
Hack GtkIconTheme so we can reference category icons as named icons.
Necessary for EActionComboBox, since GtkActions can only handle named or stock icons. Hopefully this is just a temporary hack. Eventually we should make the category icons themeable. Kill the "mail-account-disable" plugin and integrate it properly. More dead plugins to follow... Don't show disabled menu items in pop-up context menus. It does the user no good to see things he CAN'T do with the object he clicked on. svn path=/branches/kill-bonobo/; revision=37093
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-shell-view-actions.c127
-rw-r--r--mail/e-mail-shell-view-actions.h16
-rw-r--r--mail/e-mail-shell-view-private.c4
-rw-r--r--mail/e-mail-shell-view-private.h2
-rw-r--r--mail/e-mail-shell-view.c19
5 files changed, 167 insertions, 1 deletions
diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c
index 8ad9766e2d..8037470ffe 100644
--- a/mail/e-mail-shell-view-actions.c
+++ b/mail/e-mail-shell-view-actions.c
@@ -22,6 +22,45 @@
#include "e-mail-shell-view-private.h"
static void
+action_mail_account_disable_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellModule *shell_module;
+ EShellView *shell_view;
+ EMFolderTree *folder_tree;
+ EAccountList *account_list;
+ EAccount *account;
+ gchar *folder_uri;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_module = e_shell_view_get_shell_module (shell_view);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+ g_return_if_fail (folder_uri != NULL);
+
+ account = mail_config_get_account_by_source_url (folder_uri);
+ g_return_if_fail (account != NULL);
+
+ if (mail_config_has_proxies (account))
+ mail_config_remove_account_proxies (account);
+
+ account->enabled = !account->enabled;
+ account_list = mail_config_get_accounts ();
+ e_account_list_change (account_list, account);
+ e_mail_shell_module_remove_store_by_uri (shell_module, folder_uri);
+
+ if (account->parent_uid != NULL)
+ mail_config_remove_account (account);
+
+ mail_config_save_accounts ();
+
+ g_free (folder_uri);
+}
+
+static void
action_mail_create_search_folder_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
@@ -504,6 +543,13 @@ action_mail_view_cb (GtkRadioAction *action,
static GtkActionEntry mail_entries[] = {
+ { "mail-account-disable",
+ NULL,
+ N_("_Disable Account"),
+ NULL,
+ N_("Disable this account"),
+ G_CALLBACK (action_mail_account_disable_cb) },
+
{ "mail-create-search-folder",
NULL,
N_("C_reate Search Folder From Search..."),
@@ -679,6 +725,57 @@ static GtkActionEntry mail_entries[] = {
N_("Subscribe or unsubscribe to folders on remote servers"),
G_CALLBACK (action_mail_tools_subscriptions_cb) },
+ /*** Popup Menu Variations ***/
+
+ { "mail-popup-folder-copy",
+ "folder-copy",
+ N_("_Copy Folder To..."),
+ NULL,
+ N_("Copy the selected folder into another folder"),
+ G_CALLBACK (action_mail_folder_copy_cb) },
+
+ { "mail-popup-folder-delete",
+ GTK_STOCK_DELETE,
+ NULL,
+ NULL,
+ N_("Permanently remove this folder"),
+ G_CALLBACK (action_mail_folder_delete_cb) },
+
+ { "mail-popup-folder-move",
+ "folder-move",
+ N_("_Move Folder To..."),
+ NULL,
+ N_("Move the selected folder into another folder"),
+ G_CALLBACK (action_mail_folder_move_cb) },
+
+ { "mail-popup-folder-new",
+ "folder-new",
+ N_("_New Folder..."),
+ NULL,
+ N_("Create a new folder for storing mail"),
+ G_CALLBACK (action_mail_folder_new_cb) },
+
+ { "mail-popup-folder-properties",
+ GTK_STOCK_PROPERTIES,
+ NULL,
+ NULL,
+ N_("Change the properties of this folder"),
+ G_CALLBACK (action_mail_folder_properties_cb) },
+
+ { "mail-popup-folder-refresh",
+ GTK_STOCK_REFRESH,
+ NULL,
+ NULL,
+ N_("Refresh the folder"),
+ G_CALLBACK (action_mail_folder_refresh_cb) },
+
+ { "mail-popup-folder-rename",
+ NULL,
+ N_("_Rename..."),
+ NULL,
+ N_("Change the name of this folder"),
+ G_CALLBACK (action_mail_folder_rename_cb) },
+
/*** Menus ***/
{ "mail-folder-menu",
@@ -991,4 +1088,34 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL));
key = "/apps/evolution/mail/display/layout";
gconf_bridge_bind_property (bridge, key, object, "current-value");
+
+ /* Fine tuning. */
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_COPY)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_COPY)), "visible");
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_DELETE)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_DELETE)), "visible");
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_MOVE)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_MOVE)), "visible");
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_NEW)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_NEW)), "visible");
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_PROPERTIES)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_PROPERTIES)), "visible");
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_REFRESH)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_REFRESH)), "visible");
+
+ e_binding_new (
+ G_OBJECT (ACTION (MAIL_FOLDER_RENAME)), "sensitive",
+ G_OBJECT (ACTION (MAIL_POPUP_FOLDER_RENAME)), "visible");
}
diff --git a/mail/e-mail-shell-view-actions.h b/mail/e-mail-shell-view-actions.h
index 5538385911..55125657b6 100644
--- a/mail/e-mail-shell-view-actions.h
+++ b/mail/e-mail-shell-view-actions.h
@@ -25,6 +25,8 @@
#include <shell/e-shell-window-actions.h>
/* Mail Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_ACCOUNT_DISABLE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-account-disable")
#define E_SHELL_WINDOW_ACTION_MAIL_ADD_SENDER(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-add-sender")
#define E_SHELL_WINDOW_ACTION_MAIL_CARET_MODE(window) \
@@ -133,6 +135,20 @@
E_SHELL_WINDOW_ACTION ((window), "mail-next-thread")
#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_UNREAD(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-next-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-properties")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_REFRESH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-refresh")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-rename")
#define E_SHELL_WINDOW_ACTION_MAIL_PREVIEW(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-preview")
#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS(window) \
diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c
index 728f056421..c175e1ad4d 100644
--- a/mail/e-mail-shell-view-private.c
+++ b/mail/e-mail-shell-view-private.c
@@ -34,7 +34,7 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view,
reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
- if ((flags & CAMEL_FOLDER_NOSELECT) || full_name == NULL)
+ if ((flags & CAMEL_FOLDER_NOSELECT) || uri == NULL)
e_mail_reader_set_folder (reader, NULL, NULL);
else {
EMFolderTreeModel *model;
@@ -45,6 +45,8 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view,
e_mail_reader_set_folder_uri (reader, uri);
}
+
+ e_shell_view_update_actions (E_SHELL_VIEW (mail_shell_view));
}
static void
diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h
index 6c6b9d29fa..af9cc1a673 100644
--- a/mail/e-mail-shell-view-private.h
+++ b/mail/e-mail-shell-view-private.h
@@ -29,6 +29,7 @@
#include <camel/camel-vtrash-folder.h>
#include "e-util/e-util.h"
+#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
#include "widgets/menus/gal-view-instance.h"
@@ -40,6 +41,7 @@
#include "em-subscribe-editor.h"
#include "em-utils.h"
#include "mail-autofilter.h"
+#include "mail-config.h"
#include "mail-ops.h"
#include "mail-send-recv.h"
#include "mail-vfolder.h"
diff --git a/mail/e-mail-shell-view.c b/mail/e-mail-shell-view.c
index 74870e59cb..74fa2e2291 100644
--- a/mail/e-mail-shell-view.c
+++ b/mail/e-mail-shell-view.c
@@ -91,14 +91,17 @@ mail_shell_view_update_actions (EShellView *shell_view)
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
EMFolderTree *folder_tree;
+ EAccount *account;
GtkAction *action;
CamelURL *camel_url;
+ const gchar *label;
gchar *uri;
gboolean sensitive;
gboolean visible;
guint32 state;
/* Be descriptive. */
+ gboolean account_is_groupwise;
gboolean folder_allows_children;
gboolean folder_can_be_deleted;
gboolean folder_is_junk;
@@ -130,9 +133,25 @@ mail_shell_view_update_actions (EShellView *shell_view)
(state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_TRASH);
uri = em_folder_tree_get_selected_uri (folder_tree);
+ account = mail_config_get_account_by_source_url (uri);
camel_url = camel_url_new (uri, NULL);
+
+ /* FIXME This belongs in a GroupWise plugin. */
+ account_is_groupwise =
+ (g_strrstr (uri, "groupwise://") != NULL) &&
+ account != NULL && account->parent_uid != NULL;
+
g_free (uri);
+ action = ACTION (MAIL_ACCOUNT_DISABLE);
+ visible = (account != NULL) && folder_is_store;
+ if (account_is_groupwise)
+ label = _("Proxy _Logout");
+ else
+ label = _("_Disable Account");
+ gtk_action_set_visible (action, visible);
+ g_object_set (action, "label", label, NULL);
+
action = ACTION (MAIL_EMPTY_TRASH);
visible = folder_is_trash;
gtk_action_set_visible (action, visible);