aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/memos-component.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-08-23 23:59:32 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-08-23 23:59:32 +0800
commit8611c86552211433a9c2f0662e0f3b0a188515c3 (patch)
tree4d7e4a2bb0932df567474c61982a13684d270437 /calendar/gui/memos-component.c
parentebb7bb517c697e05b3f64b07f8e993a9d9bd865c (diff)
downloadgsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.gz
gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.zst
gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.zip
2007-08-23 mcrha Fix for bug #428110
svn path=/trunk/; revision=34077
Diffstat (limited to 'calendar/gui/memos-component.c')
-rw-r--r--calendar/gui/memos-component.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index 40bb509494..c67b6c2da4 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -680,7 +680,7 @@ selector_tree_drag_motion (GtkWidget *widget,
}
static gboolean
-update_single_object (ECal *client, icalcomponent *icalcomp)
+update_single_object (ECal *client, icalcomponent *icalcomp, gboolean fail_on_modify)
{
char *uid;
icalcomponent *tmp_icalcomp;
@@ -689,8 +689,12 @@ update_single_object (ECal *client, icalcomponent *icalcomp)
uid = (char *) icalcomponent_get_uid (icalcomp);
- if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
- return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL);
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL)) {
+ if (fail_on_modify)
+ return FALSE;
+ else
+ return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL);
+ }
return e_cal_create_object (client, icalcomp, &uid, NULL);
}
@@ -705,7 +709,7 @@ update_objects (ECal *client, icalcomponent *icalcomp)
kind = icalcomponent_isa (icalcomp);
if (kind == ICAL_VJOURNAL_COMPONENT)
- return update_single_object (client, icalcomp);
+ return update_single_object (client, icalcomp, TRUE);
else if (kind != ICAL_VCALENDAR_COMPONENT)
return FALSE;
@@ -725,7 +729,7 @@ update_objects (ECal *client, icalcomponent *icalcomp)
if (!success)
return success;
} else if (kind == ICAL_VJOURNAL_COMPONENT) {
- success = update_single_object (client, subcomp);
+ success = update_single_object (client, subcomp, TRUE);
if (!success)
return success;
}
@@ -786,8 +790,7 @@ selector_tree_drag_data_received (GtkWidget *widget,
if (client) {
if (e_cal_open (client, TRUE, NULL)) {
- success = TRUE;
- update_objects (client, icalcomp);
+ success = update_objects (client, icalcomp);
}
g_object_unref (client);
@@ -802,7 +805,14 @@ selector_tree_drag_data_received (GtkWidget *widget,
if (path)
gtk_tree_path_free (path);
- gtk_drag_finish (context, success, context->action == GDK_ACTION_MOVE, time);
+ if (!success && context->action == GDK_ACTION_MOVE) {
+ /* because the delete parameter of 'gtk_drag_finish' doesn't work
+ as expected, then we change context->action to GDK_ACTION_COPY
+ to prevent from deleting data when the drag was unsuccessful.
+ */
+ context->action = GDK_ACTION_COPY;
+ }
+ gtk_drag_finish (context, success, success && context->action == GDK_ACTION_MOVE, time);
}
static void