[evolution/express] Bug #529331 - Deletes appointments when moving to the same calendar
- From: Michael Meeks <michael src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/express] Bug #529331 - Deletes appointments when moving to the same calendar
- Date: Tue, 2 Mar 2010 13:19:19 +0000 (UTC)
commit 76c965a346af6c9fd3a2da063457952fb2de33dc
Author: Milan Crha <mcrha redhat com>
Date: Thu Feb 25 13:32:32 2010 +0100
Bug #529331 - Deletes appointments when moving to the same calendar
calendar/gui/dialogs/copy-source-dialog.c | 2 +-
calendar/gui/dialogs/select-source-dialog.c | 5 ++++-
calendar/gui/dialogs/select-source-dialog.h | 2 +-
modules/calendar/e-cal-shell-view-actions.c | 22 ++++++++++++++++++----
modules/calendar/e-cal-shell-view-private.c | 5 +++--
5 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c
index aafe66a..9b8c8c4 100644
--- a/calendar/gui/dialogs/copy-source-dialog.c
+++ b/calendar/gui/dialogs/copy-source-dialog.c
@@ -172,7 +172,7 @@ copy_source_dialog (GtkWindow *parent, ESource *source, ECalSourceType obj_type)
csdd.selected_source = NULL;
csdd.obj_type = obj_type;
- csdd.selected_source = select_source_dialog (parent, obj_type);
+ csdd.selected_source = select_source_dialog (parent, obj_type, source);
if (csdd.selected_source) {
result = copy_source (&csdd);
diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c
index bae8682..e517819 100644
--- a/calendar/gui/dialogs/select-source-dialog.c
+++ b/calendar/gui/dialogs/select-source-dialog.c
@@ -35,7 +35,7 @@
* Implements dialog for allowing user to select a destination source.
*/
ESource *
-select_source_dialog (GtkWindow *parent, ECalSourceType obj_type)
+select_source_dialog (GtkWindow *parent, ECalSourceType obj_type, ESource *except_source)
{
GtkWidget *dialog;
ESourceList *source_list;
@@ -69,6 +69,9 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type)
if (icon_name)
gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+ if (except_source)
+ g_object_set_data (G_OBJECT (dialog), "except-source", except_source);
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog));
if (selected_source) {
diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h
index 850eddd..902ac3f 100644
--- a/calendar/gui/dialogs/select-source-dialog.h
+++ b/calendar/gui/dialogs/select-source-dialog.h
@@ -30,6 +30,6 @@
#include <libedataserver/e-source.h>
#include <libecal/e-cal.h>
-ESource *select_source_dialog (GtkWindow *parent, ECalSourceType type);
+ESource *select_source_dialog (GtkWindow *parent, ECalSourceType type, ESource *except_source);
#endif
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 03a6eb6..4e80a99 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -507,7 +507,7 @@ action_event_copy_cb (GtkAction *action,
GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
ECalendarView *calendar_view;
- ESource *destination_source = NULL;
+ ESource *source_source = NULL, *destination_source = NULL;
ECal *destination_client = NULL;
GList *selected, *iter;
@@ -522,9 +522,16 @@ action_event_copy_cb (GtkAction *action,
selected = e_calendar_view_get_selected_events (calendar_view);
g_return_if_fail (selected != NULL);
+ if (selected->data) {
+ ECalendarViewEvent *event = selected->data;
+
+ if (event && event->comp_data && event->comp_data->client)
+ source_source = e_cal_get_source (event->comp_data->client);
+ }
+
/* Get a destination source from the user. */
destination_source = select_source_dialog (
- GTK_WINDOW (shell_window), E_CAL_SOURCE_TYPE_EVENT);
+ GTK_WINDOW (shell_window), E_CAL_SOURCE_TYPE_EVENT, source_source);
if (destination_source == NULL)
return;
@@ -762,7 +769,7 @@ action_event_move_cb (GtkAction *action,
GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
ECalendarView *calendar_view;
- ESource *destination_source = NULL;
+ ESource *source_source = NULL, *destination_source = NULL;
ECal *destination_client = NULL;
GList *selected, *iter;
@@ -777,9 +784,16 @@ action_event_move_cb (GtkAction *action,
selected = e_calendar_view_get_selected_events (calendar_view);
g_return_if_fail (selected != NULL);
+ if (selected->data) {
+ ECalendarViewEvent *event = selected->data;
+
+ if (event && event->comp_data && event->comp_data->client)
+ source_source = e_cal_get_source (event->comp_data->client);
+ }
+
/* Get a destination source from the user. */
destination_source = select_source_dialog (
- GTK_WINDOW (shell_window), E_CAL_SOURCE_TYPE_EVENT);
+ GTK_WINDOW (shell_window), E_CAL_SOURCE_TYPE_EVENT, source_source);
if (destination_source == NULL)
return;
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index b5f9ba5..e5c1ed4 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -737,8 +737,9 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
success = e_cal_modify_object (
destination_client, icalcomp_event,
CALOBJ_MOD_ALL, NULL);
- if (!success)
- return;
+
+ /* do not delete the event when it was found in the calendar */
+ return;
} else {
icalproperty *icalprop;
gchar *new_uid;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]