aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/tasks-component.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-02-01 03:03:12 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-02-01 03:03:12 +0800
commitfee5916b60c605ff5086d8fdc2a85c5ea21351f6 (patch)
tree4feaede1cf070448a32bd0ab846908e47747ceb7 /calendar/gui/tasks-component.c
parentcd5ff486fb02451645f8b4b39608edca2da5e4a2 (diff)
downloadgsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.tar
gsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.tar.gz
gsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.tar.bz2
gsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.tar.lz
gsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.tar.xz
gsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.tar.zst
gsoc2013-evolution-fee5916b60c605ff5086d8fdc2a85c5ea21351f6.zip
Merge revisions 37108:37199 from trunk.
svn path=/branches/kill-bonobo/; revision=37200
Diffstat (limited to 'calendar/gui/tasks-component.c')
-rw-r--r--calendar/gui/tasks-component.c112
1 files changed, 3 insertions, 109 deletions
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index f61100c34f..cb7326e7d6 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -355,60 +355,6 @@ source_removed_cb (ETasks *tasks, ESource *source, TasksComponentView *component
}
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,
@@ -428,11 +374,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" */
@@ -447,56 +390,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);