[evolution/gnome-2-28] BUGFIX #601202 - Evo deletes system addressbook
- From: Bharath Acharya <abharath src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/gnome-2-28] BUGFIX #601202 - Evo deletes system addressbook
- Date: Fri, 27 Nov 2009 06:56:45 +0000 (UTC)
commit d780f0758a5c542e3b3db1ab48dead66d0cec68a
Author: Bharath Acharya <abharath novell com>
Date: Fri Nov 27 12:24:01 2009 +0530
BUGFIX #601202 - Evo deletes system addressbook
Add the delete flag for standard folders to use to disable delete option in the
popup. Added it for Address book, Tasks and Memos too.
addressbook/gui/component/addressbook-view.c | 8 +++++++-
addressbook/gui/widgets/eab-popup.c | 12 ++++++++++++
addressbook/gui/widgets/eab-popup.h | 4 +++-
calendar/gui/memos-component.c | 2 +-
calendar/gui/tasks-component.c | 2 +-
5 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
index 6a66a94..4eec3cd 100644
--- a/addressbook/gui/component/addressbook-view.c
+++ b/addressbook/gui/component/addressbook-view.c
@@ -454,12 +454,18 @@ folder_can_delete (AddressbookView *view)
AddressbookViewPrivate *priv = view->priv;
ESource *source;
const gchar *source_uri;
+ const gchar *delete = NULL;
source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
if (source) {
source_uri = e_source_peek_relative_uri (source);
+ /*check for delete_status property here*/
+ delete = e_source_get_property (source, "delete");
+
if (source_uri && !strcmp("system", source_uri))
return 0;
+ else if (delete && strcmp (delete,"no") == 0)
+ return 0;
else
return 1;
}
@@ -951,7 +957,7 @@ static EPopupItem abv_source_popups[] = {
{ E_POPUP_ITEM, (gchar *) "25.rename", (gchar *) N_("_Rename..."), rename_addressbook_cb, NULL, NULL, 0, EAB_POPUP_SOURCE_PRIMARY },
{ E_POPUP_BAR, (gchar *) "30.bar" },
- { E_POPUP_ITEM, (gchar *) "30.delete", (gchar *) N_("_Delete"), delete_addressbook_cb, NULL, (gchar *) "edit-delete", 0, EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, (gchar *) "30.delete", (gchar *) N_("_Delete"), delete_addressbook_cb, NULL, (gchar *) "edit-delete", 0, EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY|EAB_POPUP_SOURCE_DELETE },
{ E_POPUP_BAR, (gchar *) "99.bar" },
{ E_POPUP_ITEM, (gchar *) "99.properties", (gchar *) N_("_Properties"), edit_addressbook_cb, NULL, (gchar *) "document-properties", 0, EAB_POPUP_SOURCE_PRIMARY },
diff --git a/addressbook/gui/widgets/eab-popup.c b/addressbook/gui/widgets/eab-popup.c
index 30ab08f..84499f4 100644
--- a/addressbook/gui/widgets/eab-popup.c
+++ b/addressbook/gui/widgets/eab-popup.c
@@ -217,6 +217,7 @@ eab_popup_target_new_source(EABPopup *eabp, ESourceSelector *selector)
guint32 mask = ~0;
const gchar *source_uri;
ESource *source;
+ const gchar *delete = NULL;
/* TODO: this is duplicated for calendar and tasks too */
@@ -235,6 +236,17 @@ eab_popup_target_new_source(EABPopup *eabp, ESourceSelector *selector)
else
mask &= ~EAB_POPUP_SOURCE_USER;
+
+ /*check for delete_status property here*/
+ delete = e_source_get_property (source, "delete");
+
+ if (delete && strcmp (delete,"no") == 0) {
+ /*set the menu item to non deletable */
+ mask &= ~EAB_POPUP_SOURCE_NO_DELETE;
+ }
+ else
+ mask &= ~EAB_POPUP_SOURCE_DELETE;
+
t->target.mask = mask;
return t;
diff --git a/addressbook/gui/widgets/eab-popup.h b/addressbook/gui/widgets/eab-popup.h
index 31d0310..d08e7d6 100644
--- a/addressbook/gui/widgets/eab-popup.h
+++ b/addressbook/gui/widgets/eab-popup.h
@@ -84,7 +84,9 @@ enum _eab_popup_target_uri_t {
enum _eab_popup_target_source_t {
EAB_POPUP_SOURCE_PRIMARY = 1<<0,
EAB_POPUP_SOURCE_SYSTEM = 1<<1, /* system folder */
- EAB_POPUP_SOURCE_USER = 1<<2 /* user folder (!system) */
+ EAB_POPUP_SOURCE_USER = 1<<2, /* user folder (!system) */
+ EAB_POPUP_SOURCE_DELETE = 1<<3,
+ EAB_POPUP_SOURCE_NO_DELETE = 1<<4
};
typedef struct _EABPopupTargetSelect EABPopupTargetSelect;
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index a427b22..01a8a12 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -482,7 +482,7 @@ static EPopupItem emc_source_popups[] = {
{ E_POPUP_ITEM, (gchar *) "18.rename", (gchar *) N_("_Rename..."), rename_memo_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
{ E_POPUP_BAR, (gchar *) "20.bar" },
- { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_memo_list_cb, NULL, (gchar *) "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_memo_list_cb, NULL, (gchar *) "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_DELETE },
{ E_POPUP_ITEM, (gchar *) "30.mark_memos_offline", (gchar *) N_("_Make available for offline use"), mark_offline_cb, NULL, (gchar *) "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE },
{ E_POPUP_ITEM, (gchar *) "40.mark_memos_no_offline", (gchar *) N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, (gchar *) "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE },
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 44d7379..1f81458 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -475,7 +475,7 @@ static EPopupItem etc_source_popups[] = {
{ E_POPUP_ITEM, (gchar *) "18.rename", (gchar *) N_("_Rename..."), rename_task_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
{ E_POPUP_BAR, (gchar *) "20.bar" },
- { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_task_list_cb, NULL, (gchar *) "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_task_list_cb, NULL, (gchar *) "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_DELETE },
{ E_POPUP_ITEM, (gchar *) "30.mark_tasks_offline", (gchar *) N_("_Make available for offline use"), mark_offline_cb, NULL, (gchar *) "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE },
{ E_POPUP_ITEM, (gchar *) "40.mark_tasks_no_offline", (gchar *) N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, (gchar *) "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]