aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog21
-rw-r--r--calendar/gui/calendar-component.c100
-rw-r--r--calendar/gui/comp-util.c189
-rw-r--r--calendar/gui/comp-util.h2
-rw-r--r--calendar/gui/e-calendar-table.c3
-rw-r--r--calendar/gui/e-day-view.c12
-rw-r--r--calendar/gui/e-memo-table.c3
-rw-r--r--calendar/gui/memos-component.c120
-rw-r--r--calendar/gui/tasks-component.c112
9 files changed, 256 insertions, 306 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 94b0c6f87b..d3337bf98f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,24 @@
+2009-01-27 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #318003
+
+ * gui/memos-component.c: (selector_tree_data_dropped):
+ * gui/tasks-component.c: (selector_tree_data_dropped):
+ * gui/calendar-component.c: (selector_tree_data_dropped),
+ (create_component_view):
+ * gui/comp-util.h: (cal_comp_process_source_list_drop):
+ * gui/comp-util.c: (update_single_object), (update_objects),
+ (cal_comp_process_source_list_drop):
+ Support move of the event in day view when dropped over the source
+ list. Use the same function for events/tasks/memos.
+
+ * gui/e-day-view.c: (e_day_view_on_drag_data_get):
+ Encode string data same as memos and tasks do, with a source UID.
+
+ * gui/e-calendar-table.c: (e_calendar_table_copy_clipboard):
+ * gui/e-memo-table.c: (e_memo_table_copy_clipboard):
+ Removed inappropriate comments.
+
2009-01-27 Bharath Acharya <abharath@novell.com>
** Fix for bug #463597, bug #463594, bug#463599 (BNC) and
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index a3a9a8b345..a44b279f19 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -1020,94 +1020,42 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-update_single_object (ECal *client, icalcomponent *icalcomp)
-{
- char *uid;
- icalcomponent *tmp_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);
-
- return e_cal_create_object (client, icalcomp, &uid, NULL);
-}
-
-static gboolean
-update_objects (ECal *client, icalcomponent *icalcomp)
-{
- icalcomponent *subcomp;
- icalcomponent_kind kind;
-
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
- return update_single_object (client, icalcomp);
- else if (kind != ICAL_VCALENDAR_COMPONENT)
- return FALSE;
-
- subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
- while (subcomp) {
- gboolean success;
-
- kind = icalcomponent_isa (subcomp);
- if (kind == ICAL_VTIMEZONE_COMPONENT) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, subcomp);
-
- success = e_cal_add_timezone (client, zone, NULL);
- icaltimezone_free (zone, 1);
- if (!success)
- return success;
- } else if (kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VEVENT_COMPONENT) {
- success = update_single_object (client, subcomp);
- if (!success)
- return success;
- }
-
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
- }
-
- return TRUE;
-}
-
-static gboolean
selector_tree_data_dropped (ESourceSelector *selector,
GtkSelectionData *data,
ESource *destination,
GdkDragAction action,
- guint info)
+ guint info,
+ CalendarComponent *component)
{
gboolean success = FALSE;
- icalcomponent *icalcomp = NULL;
- ECal *client = NULL;
+ ECal *client;
- icalcomp = icalparser_parse_string ((char *)data->data);
+ client = auth_new_cal_from_source (destination, E_CAL_SOURCE_TYPE_EVENT);
- if (icalcomp) {
- char * uid;
+ if (!client || !e_cal_open (client, TRUE, NULL)) {
+ if (client)
+ g_object_unref (client);
- /* FIXME deal with GDK_ACTION_ASK */
- if (action == GDK_ACTION_COPY) {
- uid = e_cal_component_gen_uid ();
- icalcomponent_set_uid (icalcomp, uid);
- }
+ return FALSE;
+ }
- client = auth_new_cal_from_source (destination,
- E_CAL_SOURCE_TYPE_EVENT);
+ if (data->data) {
+ icalcomponent *icalcomp = NULL;
+ char *comp_str; /* do not free this! */
- if (client) {
- if (e_cal_open (client, TRUE, NULL)) {
- success = TRUE;
- update_objects (client, icalcomp);
- }
+ /* data->data is "source_uid\ncomponent_string" */
+ comp_str = strchr ((char *)data->data, '\n');
+ if (comp_str) {
+ comp_str [0] = 0;
+ comp_str++;
- g_object_unref (client);
- }
+ icalcomp = icalparser_parse_string (comp_str);
- icalcomponent_free (icalcomp);
+ if (icalcomp) {
+ success = cal_comp_process_source_list_drop (client, icalcomp, action, (char *)data->data, component->priv->source_list);
+ icalcomponent_free (icalcomp);
+ }
+ }
}
return success;
@@ -1324,7 +1272,7 @@ create_component_view (CalendarComponent *calendar_component)
g_signal_connect (
component_view->source_selector, "data-dropped",
- G_CALLBACK (selector_tree_data_dropped), NULL);
+ G_CALLBACK (selector_tree_data_dropped), calendar_component);
gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 9504c7bda7..9a58a8cf6b 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -33,6 +33,7 @@
#include "dialogs/delete-comp.h"
#include <libecal/e-cal-component.h>
#include "e-util/e-categories-config.h"
+#include "common/authentication.h"
@@ -607,3 +608,191 @@ cal_comp_set_dtend_with_oldzone (ECal *client, ECalComponent *comp, const ECalCo
e_cal_component_free_datetime (&olddate);
}
+
+static gboolean
+update_single_object (ECal *client, icalcomponent *icalcomp, gboolean fail_on_modify)
+{
+ const char *uid;
+ char *tmp;
+ icalcomponent *tmp_icalcomp;
+ gboolean res;
+
+ uid = icalcomponent_get_uid (icalcomp);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL)) {
+ if (fail_on_modify)
+ return FALSE;
+
+ return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL);
+ }
+
+ tmp = NULL;
+ res = e_cal_create_object (client, icalcomp, &tmp, NULL);
+
+ g_free (tmp);
+
+ return res;
+}
+
+static gboolean
+update_objects (ECal *client, icalcomponent *icalcomp)
+{
+ icalcomponent *subcomp;
+ icalcomponent_kind kind;
+
+ kind = icalcomponent_isa (icalcomp);
+ if (kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VEVENT_COMPONENT ||
+ kind == ICAL_VJOURNAL_COMPONENT)
+ return update_single_object (client, icalcomp, kind == ICAL_VJOURNAL_COMPONENT);
+ else if (kind != ICAL_VCALENDAR_COMPONENT)
+ return FALSE;
+
+ subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp) {
+ gboolean success;
+
+ kind = icalcomponent_isa (subcomp);
+ if (kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+
+ success = e_cal_add_timezone (client, zone, NULL);
+ icaltimezone_free (zone, 1);
+ if (!success)
+ return success;
+ } else if (kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VEVENT_COMPONENT ||
+ kind == ICAL_VJOURNAL_COMPONENT) {
+ success = update_single_object (client, subcomp, kind == ICAL_VJOURNAL_COMPONENT);
+ if (!success)
+ return success;
+ }
+
+ subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ return TRUE;
+}
+
+/**
+ * cal_comp_process_source_list_drop:
+ * Processes the drop signal over the ESourceList.
+ * @param destination Where to put the component.
+ * @param comp Component to move/copy.
+ * @param action What to do.
+ * @param source_uid Where the component comes from; used when moving.
+ * @param source_list The ESourceList over which the event was called.
+ * @return Whether was the operation successful.
+ **/
+gboolean
+cal_comp_process_source_list_drop (ECal *destination, icalcomponent *comp, GdkDragAction action, const char *source_uid, ESourceList *source_list)
+{
+ const char * uid;
+ char *old_uid = NULL;
+ icalcomponent *tmp_icalcomp = NULL;
+ GError *error = NULL;
+ gboolean success = FALSE;
+
+ g_return_val_if_fail (destination != NULL, FALSE);
+ g_return_val_if_fail (comp != NULL, FALSE);
+ g_return_val_if_fail (source_uid != NULL, FALSE);
+ g_return_val_if_fail (source_list != NULL, FALSE);
+
+ /* FIXME deal with GDK_ACTION_ASK */
+ if (action == GDK_ACTION_COPY) {
+ char *tmp;
+
+ old_uid = g_strdup (icalcomponent_get_uid (comp));
+ tmp = e_cal_component_gen_uid ();
+
+ icalcomponent_set_uid (comp, tmp);
+ g_free (tmp);
+ }
+
+ uid = icalcomponent_get_uid (comp);
+ if (!old_uid)
+ old_uid = g_strdup (uid);
+
+ if (!e_cal_get_object (destination, uid, NULL, &tmp_icalcomp, &error)) {
+ if ((error != NULL) && (error->code != E_CALENDAR_STATUS_OBJECT_NOT_FOUND)) {
+ switch (e_cal_get_source_type (destination)) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ g_message ("Failed to search the object in destination event list: %s", error->message);
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ g_message ("Failed to search the object in destination task list: %s", error->message);
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ g_message ("Failed to search the object in destination memo list: %s", error->message);
+ break;
+ default:
+ break;
+ }
+ } else {
+ /* this will report success by last item, but we don't care */
+ success = update_objects (destination, comp);
+
+ if (success && action == GDK_ACTION_MOVE) {
+ /* remove components rather here, because we know which has been moved */
+ ESource *source_source;
+ ECal *source_client;
+
+ source_source = e_source_list_peek_source_by_uid (source_list, source_uid);
+
+ if (source_source && !E_IS_SOURCE_GROUP (source_source) && !e_source_get_readonly (source_source)) {
+ source_client = auth_new_cal_from_source (source_source, e_cal_get_source_type (destination));
+
+ if (source_client) {
+ gboolean read_only = TRUE;
+
+ e_cal_is_read_only (source_client, &read_only, NULL);
+
+ if (!read_only && e_cal_open (source_client, TRUE, NULL))
+ e_cal_remove_object (source_client, old_uid, NULL);
+ else if (!read_only) {
+ switch (e_cal_get_source_type (destination)) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ g_message ("Cannot open source client to remove old event");
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ g_message ("Cannot open source client to remove old task");
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ g_message ("Cannot open source client to remove old memo");
+ break;
+ default:
+ break;
+ }
+ }
+
+ g_object_unref (source_client);
+ } else {
+ switch (e_cal_get_source_type (destination)) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ g_message ("Cannot create source client to remove old event");
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ g_message ("Cannot create source client to remove old task");
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ g_message ("Cannot create source client to remove old memo");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ g_clear_error (&error);
+ } else
+ icalcomponent_free (tmp_icalcomp);
+
+ g_free (old_uid);
+
+ return success;
+}
diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h
index e4e200217e..3225557a5e 100644
--- a/calendar/gui/comp-util.h
+++ b/calendar/gui/comp-util.h
@@ -57,4 +57,6 @@ GSList *cal_comp_selection_get_string_list (GtkSelectionData *data);
void cal_comp_set_dtstart_with_oldzone (ECal *client, ECalComponent *comp, const ECalComponentDateTime *pdate);
void cal_comp_set_dtend_with_oldzone (ECal *client, ECalComponent *comp, const ECalComponentDateTime *pdate);
+gboolean cal_comp_process_source_list_drop (ECal *destination, icalcomponent *comp, GdkDragAction action, const char *source_uid, ESourceList *source_list);
+
#endif
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index dec81a0f07..4c5836f1d9 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -1129,8 +1129,7 @@ e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
clipboard_get_calendar_cb,
NULL, comp_str)) {
- /* do not free this pointer, it owns libical */
- /* g_free (comp_str); */
+ /* no-op */
} else {
gtk_clipboard_set_can_store (clipboard, target_types + 1, n_target_types - 1);
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 523cf45afd..263b72d7ad 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -7366,8 +7366,18 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
comp_str = icalcomponent_as_ical_string_r (vcal);
if (comp_str) {
+ ESource *source = e_cal_get_source (event->comp_data->client);
+ const char *source_uid = e_source_peek_uid (source);
+ char *tmp;
+
+ if (!source_uid)
+ source_uid = "";
+
+ tmp = g_strconcat (source_uid, "\n", comp_str, NULL);
gtk_selection_data_set (selection_data, selection_data->target,
- 8, (unsigned char *)comp_str, strlen (comp_str));
+ 8, (unsigned char *)tmp, strlen (tmp));
+
+ g_free (tmp);
}
icalcomponent_free (vcal);
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 63a43c4e9d..8e312c7b0b 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -601,8 +601,7 @@ e_memo_table_copy_clipboard (EMemoTable *memo_table)
if (!gtk_clipboard_set_with_data(clipboard, target_types, n_target_types,
clipboard_get_calendar_cb,
NULL, comp_str)) {
- /* do not free this pointer, it owns libical */
- /* g_free (comp_str); */
+ /* no-op */
} else {
gtk_clipboard_set_can_store (clipboard, target_types + 1, n_target_types - 1);
}
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index 02c1df50ff..82961c0ded 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -647,67 +647,6 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-update_single_object (ECal *client, icalcomponent *icalcomp, gboolean fail_on_modify)
-{
- char *uid;
- icalcomponent *tmp_icalcomp;
-
- d(g_message("memos-component.c: update_single_object called");)
-
- uid = (char *) icalcomponent_get_uid (icalcomp);
-
- 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);
-}
-
-static gboolean
-update_objects (ECal *client, icalcomponent *icalcomp)
-{
- icalcomponent *subcomp;
- icalcomponent_kind kind;
-
- d(g_message("memos-component.c: update_objects called");)
-
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VJOURNAL_COMPONENT)
- return update_single_object (client, icalcomp, TRUE);
- else if (kind != ICAL_VCALENDAR_COMPONENT)
- return FALSE;
-
- subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
- while (subcomp) {
- gboolean success;
-
- kind = icalcomponent_isa (subcomp);
- if (kind == ICAL_VTIMEZONE_COMPONENT) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, subcomp);
-
- success = e_cal_add_timezone (client, zone, NULL);
- icaltimezone_free (zone, 1);
- if (!success)
- return success;
- } else if (kind == ICAL_VJOURNAL_COMPONENT) {
- success = update_single_object (client, subcomp, TRUE);
- if (!success)
- return success;
- }
-
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
- }
-
- return TRUE;
-}
-
-static gboolean
selector_tree_data_dropped (ESourceSelector *selector,
GtkSelectionData *data,
ESource *destination,
@@ -727,11 +666,8 @@ selector_tree_data_dropped (ESourceSelector *selector,
goto finish;
components = cal_comp_selection_get_string_list (data);
- for (p = components; p; p = p->next) {
- const char * uid;
- char *old_uid = NULL;
- icalcomponent *tmp_icalcomp = NULL;
- GError *error = NULL;
+ success = components != NULL;
+ for (p = components; p && success; p = p->next) {
char *comp_str; /* do not free this! */
/* p->data is "source_uid\ncomponent_string" */
@@ -746,58 +682,10 @@ selector_tree_data_dropped (ESourceSelector *selector,
if (!icalcomp)
continue;
- /* FIXME deal with GDK_ACTION_ASK */
- if (action == GDK_ACTION_COPY) {
- old_uid = g_strdup (icalcomponent_get_uid (icalcomp));
- uid = e_cal_component_gen_uid ();
- icalcomponent_set_uid (icalcomp, uid);
- }
-
- uid = icalcomponent_get_uid (icalcomp);
- if (!old_uid)
- old_uid = g_strdup (uid);
-
- if (!e_cal_get_object (client, uid, NULL, &tmp_icalcomp, &error)) {
- if ((error != NULL) && (error->code != E_CALENDAR_STATUS_OBJECT_NOT_FOUND))
- g_message ("Failed to search the object in destination task list: %s",error->message);
- else {
- /* this will report success by last item, but we don't care */
- success = update_objects (client, icalcomp);
-
- if (success && action == GDK_ACTION_MOVE) {
- /* remove components rather here, because we know which has been moved */
- ESource *source_source;
- ECal *source_client;
-
- source_source = e_source_list_peek_source_by_uid (component->priv->source_list, p->data);
-
- if (source_source && !E_IS_SOURCE_GROUP (source_source) && !e_source_get_readonly (source_source)) {
- source_client = auth_new_cal_from_source (source_source, E_CAL_SOURCE_TYPE_JOURNAL);
-
- if (source_client) {
- gboolean read_only = TRUE;
-
- e_cal_is_read_only (source_client, &read_only, NULL);
-
- if (!read_only && e_cal_open (source_client, TRUE, NULL))
- e_cal_remove_object (source_client, old_uid, NULL);
- else if (!read_only)
- g_message ("Cannot open source client to remove old memo");
-
- g_object_unref (source_client);
- } else
- g_message ("Cannot create source client to remove old memo");
- }
- }
- }
-
- g_clear_error (&error);
- } else
- icalcomponent_free (tmp_icalcomp);
-
- g_free (old_uid);
+ success = cal_comp_process_source_list_drop (client, icalcomp, action, p->data, component->priv->source_list);
icalcomponent_free (icalcomp);
}
+
g_slist_foreach (components, (GFunc)g_free, NULL);
g_slist_free (components);
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 9300068796..7564c1bf92 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -638,60 +638,6 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-update_single_object (ECal *client, icalcomponent *icalcomp)
-{
- char *uid;
- icalcomponent *tmp_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);
-
- return e_cal_create_object (client, icalcomp, &uid, NULL);
-}
-
-static gboolean
-update_objects (ECal *client, icalcomponent *icalcomp)
-{
- icalcomponent *subcomp;
- icalcomponent_kind kind;
-
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
- return update_single_object (client, icalcomp);
- else if (kind != ICAL_VCALENDAR_COMPONENT)
- return FALSE;
-
- subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
- while (subcomp) {
- gboolean success;
-
- kind = icalcomponent_isa (subcomp);
- if (kind == ICAL_VTIMEZONE_COMPONENT) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, subcomp);
-
- success = e_cal_add_timezone (client, zone, NULL);
- icaltimezone_free (zone, 1);
- if (!success)
- return success;
- } else if (kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VEVENT_COMPONENT) {
- success = update_single_object (client, subcomp);
- if (!success)
- return success;
- }
-
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
- }
-
- return TRUE;
-}
-
-static gboolean
selector_tree_data_dropped (ESourceSelector *selector,
GtkSelectionData *data,
ESource *destination,
@@ -711,11 +657,8 @@ selector_tree_data_dropped (ESourceSelector *selector,
goto finish;
components = cal_comp_selection_get_string_list (data);
- for (p = components; p; p = p->next) {
- const char * uid;
- char *old_uid = NULL;
- icalcomponent *tmp_icalcomp = NULL;
- GError *error = NULL;
+ success = components != NULL;
+ for (p = components; p && success; p = p->next) {
char *comp_str; /* do not free this! */
/* p->data is "source_uid\ncomponent_string" */
@@ -730,56 +673,7 @@ selector_tree_data_dropped (ESourceSelector *selector,
if (!icalcomp)
continue;
- /* FIXME deal with GDK_ACTION_ASK */
- if (action == GDK_ACTION_COPY) {
- old_uid = g_strdup (icalcomponent_get_uid (icalcomp));
- uid = e_cal_component_gen_uid ();
- icalcomponent_set_uid (icalcomp, uid);
- }
-
- uid = icalcomponent_get_uid (icalcomp);
- if (!old_uid)
- old_uid = g_strdup (uid);
-
- if (!e_cal_get_object (client, uid, NULL, &tmp_icalcomp, &error)) {
- if ((error != NULL) && (error->code != E_CALENDAR_STATUS_OBJECT_NOT_FOUND))
- g_message ("Failed to search the object in destination task list: %s",error->message);
- else {
- /* this will report success by last item, but we don't care */
- success = update_objects (client, icalcomp);
-
- if (success && action == GDK_ACTION_MOVE) {
- /* remove components rather here, because we know which has been moved */
- ESource *source_source;
- ECal *source_client;
-
- source_source = e_source_list_peek_source_by_uid (component->priv->source_list, p->data);
-
- if (source_source && !E_IS_SOURCE_GROUP (source_source) && !e_source_get_readonly (source_source)) {
- source_client = auth_new_cal_from_source (source_source, E_CAL_SOURCE_TYPE_TODO);
-
- if (source_client) {
- gboolean read_only = TRUE;
-
- e_cal_is_read_only (source_client, &read_only, NULL);
-
- if (!read_only && e_cal_open (source_client, TRUE, NULL))
- e_cal_remove_object (source_client, old_uid, NULL);
- else if (!read_only)
- g_message ("Cannot open source client to remove old task");
-
- g_object_unref (source_client);
- } else
- g_message ("Cannot create source client to remove old task");
- }
- }
- }
-
- g_clear_error (&error);
- } else
- icalcomponent_free (tmp_icalcomp);
-
- g_free (old_uid);
+ success = cal_comp_process_source_list_drop (client, icalcomp, action, p->data, component->priv->source_list);
icalcomponent_free (icalcomp);
}
g_slist_foreach (components, (GFunc)g_free, NULL);