aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/modules/e-task-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-11-29 23:26:50 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-11-29 23:26:50 +0800
commit6375ba9a6cf327e665d98c5820992ab7fb80a6d0 (patch)
tree3917285854f52e19cc529c6ab56cf0d2b5a414bc /calendar/modules/e-task-shell-content.c
parent4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 (diff)
downloadgsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.tar
gsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.tar.gz
gsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.tar.bz2
gsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.tar.lz
gsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.tar.xz
gsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.tar.zst
gsoc2013-evolution-6375ba9a6cf327e665d98c5820992ab7fb80a6d0.zip
Get drag-and-drop-to-source-selector working for contacts, memos and tasks.
Utilizes the new ESourceSelector::data-dropped signal. svn path=/branches/kill-bonobo/; revision=36822
Diffstat (limited to 'calendar/modules/e-task-shell-content.c')
-rw-r--r--calendar/modules/e-task-shell-content.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/calendar/modules/e-task-shell-content.c b/calendar/modules/e-task-shell-content.c
index febd0c9ef2..5e98bf2f49 100644
--- a/calendar/modules/e-task-shell-content.c
+++ b/calendar/modules/e-task-shell-content.c
@@ -26,6 +26,7 @@
#include "e-util/gconf-bridge.h"
#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-model-tasks.h"
#include "calendar/gui/e-calendar-table.h"
#include "calendar/gui/e-calendar-table-config.h"
@@ -92,6 +93,45 @@ task_shell_content_display_view_cb (ETaskShellContent *task_shell_content,
}
static void
+task_shell_content_table_foreach_cb (gint model_row,
+ gpointer user_data)
+{
+ ECalModelComponent *comp_data;
+ icalcomponent *clone;
+ icalcomponent *vcal;
+ gchar *string;
+
+ struct {
+ ECalModel *model;
+ GSList *list;
+ } *foreach_data = user_data;
+
+ comp_data = e_cal_model_get_component_at (
+ foreach_data->model, model_row);
+
+ vcal = e_cal_util_new_top_level ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
+ icalcomponent_add_component (vcal, clone);
+
+ /* String is owned by libical; do not free. */
+ string = icalcomponent_as_ical_string (vcal);
+ if (string != NULL) {
+ ESource *source;
+ const gchar *source_uid;
+
+ source = e_cal_get_source (comp_data->client);
+ source_uid = e_source_peek_uid (source);
+
+ foreach_data->list = g_slist_prepend (
+ foreach_data->list,
+ g_strdup_printf ("%s\n%s", source_uid, string));
+ }
+
+ icalcomponent_free (vcal);
+}
+
+static void
task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content,
gint row,
gint col,
@@ -100,7 +140,33 @@ task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content
guint info,
guint time)
{
- /* FIXME */
+ ECalendarTable *task_table;
+ ETable *table;
+
+ struct {
+ ECalModel *model;
+ GSList *list;
+ } foreach_data;
+
+ if (info != TARGET_VCALENDAR)
+ return;
+
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_calendar_table_get_table (task_table);
+
+ foreach_data.model = e_calendar_table_get_model (task_table);
+ foreach_data.list = NULL;
+
+ e_table_selected_row_foreach (
+ table, task_shell_content_table_foreach_cb,
+ &foreach_data);
+
+ if (foreach_data.list != NULL) {
+ cal_comp_selection_set_string_list (
+ selection_data, foreach_data.list);
+ g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL);
+ g_slist_free (foreach_data.list);
+ }
}
static void