aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-26 19:54:33 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-08-03 23:40:13 +0800
commit4fedf14c7b90d1bab1906d0e1ffd676af620c15c (patch)
treeb0df6fd65232a528924eb7e0a3b0fda5119390f8 /modules/addressbook
parentcdc45d0ef235591a93e980f7513e5fadd7abb315 (diff)
downloadgsoc2013-evolution-4fedf14c7b90d1bab1906d0e1ffd676af620c15c.tar.gz
gsoc2013-evolution-4fedf14c7b90d1bab1906d0e1ffd676af620c15c.tar.zst
gsoc2013-evolution-4fedf14c7b90d1bab1906d0e1ffd676af620c15c.zip
Enable "delete" action for remote-deletable sources.
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/e-book-shell-sidebar.c8
-rw-r--r--modules/addressbook/e-book-shell-sidebar.h4
-rw-r--r--modules/addressbook/e-book-shell-view.c7
3 files changed, 17 insertions, 2 deletions
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index 2f2d9391c5..6e9e3484f9 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -149,6 +149,8 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
ESource *source;
gboolean is_writable = FALSE;
gboolean is_removable = FALSE;
+ gboolean is_remote_creatable = FALSE;
+ gboolean is_remote_deletable = FALSE;
gboolean in_collection = FALSE;
gboolean has_primary_source = FALSE;
guint32 state = 0;
@@ -164,6 +166,8 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
has_primary_source = TRUE;
is_writable = e_source_get_writable (source);
is_removable = e_source_get_removable (source);
+ is_remote_creatable = e_source_get_remote_creatable (source);
+ is_remote_deletable = e_source_get_remote_deletable (source);
collection = e_source_registry_find_extension (
registry, source, E_SOURCE_EXTENSION_COLLECTION);
@@ -181,6 +185,10 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
if (is_removable)
state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+ if (is_remote_creatable)
+ state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE;
+ if (is_remote_deletable)
+ state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE;
if (in_collection)
state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION;
diff --git a/modules/addressbook/e-book-shell-sidebar.h b/modules/addressbook/e-book-shell-sidebar.h
index 9507681541..d2bac8ca97 100644
--- a/modules/addressbook/e-book-shell-sidebar.h
+++ b/modules/addressbook/e-book-shell-sidebar.h
@@ -56,7 +56,9 @@ enum {
E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE = 1 << 1,
E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE = 1 << 2,
- E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION = 1 << 3
+ E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE = 1 << 3,
+ E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE = 1 << 4,
+ E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION = 1 << 5
};
struct _EBookShellSidebar {
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index c8ef07441d..f2c06bbb8d 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -203,6 +203,7 @@ book_shell_view_update_actions (EShellView *shell_view)
gboolean multiple_contacts_selected;
gboolean primary_source_is_writable;
gboolean primary_source_is_removable;
+ gboolean primary_source_is_remote_deletable;
gboolean primary_source_in_collection;
gboolean single_contact_selected;
gboolean selection_is_contact_list;
@@ -240,6 +241,8 @@ book_shell_view_update_actions (EShellView *shell_view)
(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
primary_source_is_removable =
(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+ primary_source_is_remote_deletable =
+ (state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE);
primary_source_in_collection =
(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION);
@@ -251,7 +254,9 @@ book_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (ADDRESS_BOOK_DELETE);
- sensitive = primary_source_is_removable;
+ sensitive =
+ primary_source_is_removable ||
+ primary_source_is_remote_deletable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (ADDRESS_BOOK_PRINT);