aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-14 23:39:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-14 23:42:02 +0800
commitbb1653f64c0998f3c90d9cf0e7a2183dccd4611f (patch)
treeb1419804cd5af877df35c2a2293fb23a58ce5cfd /modules/addressbook
parente1815361e0a7dc69f5d06a4d623e709eff611464 (diff)
downloadgsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.tar
gsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.tar.gz
gsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.tar.bz2
gsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.tar.lz
gsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.tar.xz
gsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.tar.zst
gsoc2013-evolution-bb1653f64c0998f3c90d9cf0e7a2183dccd4611f.zip
BugĀ 600397 - Delete option enabled for undeletable ESource
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/e-book-shell-sidebar.c8
-rw-r--r--modules/addressbook/e-book-shell-sidebar.h3
-rw-r--r--modules/addressbook/e-book-shell-view.c5
3 files changed, 14 insertions, 2 deletions
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index fc283e28d7..24a0997173 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -126,6 +126,7 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
EBookShellSidebar *book_shell_sidebar;
ESourceSelector *selector;
ESource *source;
+ gboolean can_delete = FALSE;
gboolean is_system = FALSE;
guint32 state = 0;
@@ -135,13 +136,20 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
if (source != NULL) {
const gchar *uri;
+ const gchar *delete;
uri = e_source_peek_relative_uri (source);
is_system = (uri == NULL || strcmp (uri, "system") == 0);
+
+ can_delete = !is_system;
+ delete = e_source_get_property (source, "delete");
+ can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
}
if (source != NULL)
state |= E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
+ if (can_delete)
+ state |= E_BOOK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
if (is_system)
state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
diff --git a/modules/addressbook/e-book-shell-sidebar.h b/modules/addressbook/e-book-shell-sidebar.h
index 716523f971..a3eb76c77f 100644
--- a/modules/addressbook/e-book-shell-sidebar.h
+++ b/modules/addressbook/e-book-shell-sidebar.h
@@ -54,7 +54,8 @@ typedef struct _EBookShellSidebarPrivate EBookShellSidebarPrivate;
enum {
E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
- E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 1
+ E_BOOK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE = 1 << 1,
+ E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 2
};
struct _EBookShellSidebar {
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index d5f160d407..568bc4567a 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -237,6 +237,7 @@ book_shell_view_update_actions (EShellView *shell_view)
/* Be descriptive. */
gboolean any_contacts_selected;
+ gboolean can_delete_primary_source;
gboolean has_primary_source;
gboolean multiple_contacts_selected;
gboolean primary_source_is_system;
@@ -277,6 +278,8 @@ book_shell_view_update_actions (EShellView *shell_view)
has_primary_source =
(state & E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
+ can_delete_primary_source =
+ (state & E_BOOK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE);
primary_source_is_system =
(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM);
@@ -284,7 +287,7 @@ book_shell_view_update_actions (EShellView *shell_view)
(single_contact_selected || multiple_contacts_selected);
action = ACTION (ADDRESS_BOOK_DELETE);
- sensitive = has_primary_source && !primary_source_is_system;
+ sensitive = can_delete_primary_source;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (ADDRESS_BOOK_PRINT);