aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/exchange-operations/exchange-calendar.c
diff options
context:
space:
mode:
authorPraveen Kumar <kpraveen@novell.com>2005-07-22 15:48:16 +0800
committerPraveen Kumar <kpraveen@src.gnome.org>2005-07-22 15:48:16 +0800
commit94b079846d701f72043a651d9df2efa90aa6a2d7 (patch)
tree90c33c3cffc7e14e467d070bd8615c7a907b6632 /plugins/exchange-operations/exchange-calendar.c
parentf29491124b132b0baf7582f482f749c018661717 (diff)
downloadgsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.tar
gsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.tar.gz
gsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.tar.bz2
gsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.tar.lz
gsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.tar.xz
gsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.tar.zst
gsoc2013-evolution-94b079846d701f72043a651d9df2efa90aa6a2d7.zip
Handling the rename of calendars. This addresses the bug 310433 Removed
2005-07-22 Praveen Kumar <kpraveen@novell.com> * exchange-calendar.c : Handling the rename of calendars. This addresses the bug 310433 * exchange-config-listener.c : Removed the functions add_folder_esource and remove_folder_esource * exchange-contacts.c : Handling the rename of addressbooks. Also modified the way of Exchange addressbook ESource URI handling to be the same way as calendar ESource URI handling * exchange-operations.c (exchange_operations_update_child_esources) : Added new to handle the rename of the ESources of all child folders in the case of parent folder being renamed. * exchange-operations.h : Added prototype for the new function svn path=/trunk/; revision=29842
Diffstat (limited to 'plugins/exchange-operations/exchange-calendar.c')
-rw-r--r--plugins/exchange-operations/exchange-calendar.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c
index ab3726d990..3f793b502d 100644
--- a/plugins/exchange-operations/exchange-calendar.c
+++ b/plugins/exchange-operations/exchange-calendar.c
@@ -43,6 +43,9 @@ enum {
NUM_COLS
};
+gboolean calendar_src_exists = FALSE;
+gchar *calendar_old_source_uri = NULL;
+
GPtrArray *e_exchange_calendar_get_calendars (ECalSourceType *ftype);
void e_exchange_calendar_pcalendar_on_change (GtkTreeView *treeview, ESource *source);
GtkWidget *e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data);
@@ -142,7 +145,6 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
gchar *ruri;
gchar *account_name;
gchar *uri_text;
- gboolean src_exists = TRUE;
int row, i;
if (!hidden)
@@ -167,8 +169,13 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
e_uri_free (uri);
g_free (uri_text);
- if (!strlen (e_source_peek_relative_uri (t->source))) {
- src_exists = FALSE;
+ if (strlen (e_source_peek_relative_uri (t->source))) {
+ calendar_src_exists = TRUE;
+ g_free (calendar_old_source_uri);
+ calendar_old_source_uri = g_strdup (e_source_peek_relative_uri (t->source));
+ }
+ else {
+ calendar_src_exists = FALSE;
}
parent = data->parent;
@@ -211,7 +218,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
gtk_table_attach (GTK_TABLE (parent), scrw_pcalendar, 0, 2, row+1, row+2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_show_all (scrw_pcalendar);
- if (src_exists) {
+ if (calendar_src_exists) {
gchar *uri_prefix, *sruri, *tmpruri;
int prefix_len;
GtkTreeSelection *selection;
@@ -260,7 +267,7 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
{
ECalConfigTargetSource *t = (ECalConfigTargetSource *) target;
ESource *source = t->source;
- gchar *uri_text, *gruri, *gname, *ruri, *ftype, *path, *path_prefix;
+ gchar *uri_text, *gruri, *gname, *ruri, *ftype, *path, *path_prefix, *oldpath=NULL;
int prefix_len;
ExchangeAccount *account;
@@ -291,11 +298,37 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
gname = (gchar*) e_source_peek_name (source);
gruri = (gchar*) e_source_peek_relative_uri (source);
- ruri = g_strconcat (gruri, "/", gname, NULL);
+ if (calendar_src_exists) {
+ gchar *tmpruri, *tmpdelimit;
+ tmpruri = g_strdup (gruri);
+ tmpdelimit = g_strrstr (tmpruri, "/");
+ tmpdelimit[0] = '\0';
+ ruri = g_strconcat (tmpruri, "/", gname, NULL);
+ g_free (tmpruri);
+ }
+ else {
+ ruri = g_strconcat (gruri, "/", gname, NULL);
+ }
e_source_set_relative_uri (source, ruri);
- path = g_strdup_printf ("/%s", ruri+prefix_len);
- result = exchange_account_create_folder (account, path, ftype);
+ path = g_strdup_printf ("/%s", ruri+prefix_len);
+
+ if (!calendar_src_exists) {
+ /* Create the new folder */
+ result = exchange_account_create_folder (account, path, ftype);
+ }
+ else if (strcmp (e_source_peek_relative_uri (source), calendar_old_source_uri)) {
+ /* Rename the folder */
+ oldpath = g_strdup_printf ("/%s", calendar_old_source_uri+prefix_len);
+ result = exchange_account_xfer_folder (account, oldpath, path, TRUE);
+ exchange_operations_update_child_esources (source,
+ calendar_old_source_uri,
+ ruri);
+ }
+ else {
+ /* Nothing happened specific to exchange; just return */
+ return;
+ }
switch (result) {
/* TODO: Modify all these error messages using e_error */
@@ -329,4 +362,7 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
g_free (ruri);
g_free (path);
g_free (ftype);
+ g_free (oldpath);
+ g_free (calendar_old_source_uri);
+ calendar_old_source_uri = NULL;
}