diff options
author | Milan Crha <mcrha@src.gnome.org> | 2007-08-23 23:59:32 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2007-08-23 23:59:32 +0800 |
commit | 8611c86552211433a9c2f0662e0f3b0a188515c3 (patch) | |
tree | 4d7e4a2bb0932df567474c61982a13684d270437 | |
parent | ebb7bb517c697e05b3f64b07f8e993a9d9bd865c (diff) | |
download | gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.gz gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.bz2 gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.lz gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.xz gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.tar.zst gsoc2013-evolution-8611c86552211433a9c2f0662e0f3b0a188515c3.zip |
2007-08-23 mcrha Fix for bug #428110
svn path=/trunk/; revision=34077
-rw-r--r-- | calendar/ChangeLog | 12 | ||||
-rw-r--r-- | calendar/gui/memos-component.c | 26 |
2 files changed, 30 insertions, 8 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index baf80c23bb..e9c1d98fc2 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,17 @@ 2007-08-23 Milan Crha <mcrha@redhat.com> + ** Fix for bug #428110 + + * gui/memos-component.c: (update_single_object): + Added parameter to rather fail on adding same object with drag&drop, + rather than modify and then delete existing one. + * gui/memos-component.c: (update_objects): Use new parameter above. + * gui/memos-component.c: (selector_tree_drag_data_received): + Use result of call 'update_objects' and prevent delete object when + the call fails. + +2007-08-23 Milan Crha <mcrha@redhat.com> + ** Fix for bug #201201 * gui/e-week-view.h: (struct _EWeekView): Added properties. 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 |