diff options
author | Bharath Acharya <abharath@novell.com> | 2009-11-27 14:54:01 +0800 |
---|---|---|
committer | Bharath Acharya <abharath@novell.com> | 2009-11-27 14:54:01 +0800 |
commit | d780f0758a5c542e3b3db1ab48dead66d0cec68a (patch) | |
tree | 6e1ebcbd08fe4a2fbb93baf25c0e625013ba7724 | |
parent | d252e70bc91878cedac6ab4b6704062d4c1b9d8a (diff) | |
download | gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.tar gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.tar.gz gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.tar.bz2 gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.tar.lz gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.tar.xz gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.tar.zst gsoc2013-evolution-d780f0758a5c542e3b3db1ab48dead66d0cec68a.zip |
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.
-rw-r--r-- | addressbook/gui/component/addressbook-view.c | 8 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-popup.c | 12 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-popup.h | 4 | ||||
-rw-r--r-- | calendar/gui/memos-component.c | 2 | ||||
-rw-r--r-- | 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 6a66a94913..4eec3cd8e4 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 30ab08f837..84499f460e 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 31d0310829..d08e7d6f7d 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 a427b224ca..01a8a12c41 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 44d73798be..1f8145882b 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 }, |