diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-02-09 03:52:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-02-09 07:57:24 +0800 |
commit | 67ce5f3b140525c2f5944270a9383616f9d67923 (patch) | |
tree | 167788f4efa12f87ac04c474598d61b5ca446464 /modules/calendar/e-task-shell-content.c | |
parent | 9cd1f937a26363aa108f3d2b36606b167597a2eb (diff) | |
download | gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.gz gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.zst gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.zip |
Add DnD support to e-selection.c.
Avoid listing calendar and directory targets explicitly, so that
e-selection.c contains the one and only master list. Still need
to figure out how to centralize "text/x-source-vcard".
Diffstat (limited to 'modules/calendar/e-task-shell-content.c')
-rw-r--r-- | modules/calendar/e-task-shell-content.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index fd76fe7513..5fb39a9738 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -70,15 +70,6 @@ enum { PROP_PREVIEW_VISIBLE }; -enum { - TARGET_VCALENDAR -}; - -static GtkTargetEntry drag_types[] = { - { (gchar *) "text/calendar", 0, TARGET_VCALENDAR }, - { (gchar *) "text/x-calendar", 0, TARGET_VCALENDAR } -}; - static gpointer parent_class; static GType task_shell_content_type; @@ -146,13 +137,16 @@ task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content guint time) { ETaskTable *task_table; + GdkAtom target; struct { ECalModel *model; GSList *list; } foreach_data; - if (info != TARGET_VCALENDAR) + /* Sanity check the selection target. */ + target = gtk_selection_data_get_target (selection_data); + if (!e_targets_include_calendar (&target, 1)) return; task_table = e_task_shell_content_get_task_table (task_shell_content); @@ -402,9 +396,12 @@ task_shell_content_constructed (GObject *object) GalViewInstance *view_instance; icaltimezone *timezone; GConfBridge *bridge; + GtkTargetList *target_list; + GtkTargetEntry *targets; GtkWidget *container; GtkWidget *widget; const gchar *key; + gint n_targets; priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); @@ -477,11 +474,18 @@ task_shell_content_constructed (GObject *object) e_table_set_state ( E_TABLE (priv->task_table), E_TASK_TABLE_DEFAULT_STATE); + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_calendar_targets (target_list, 0); + targets = gtk_target_table_new_from_list (target_list, &n_targets); + e_table_drag_source_set ( E_TABLE (priv->task_table), - GDK_BUTTON1_MASK, drag_types, G_N_ELEMENTS (drag_types), + GDK_BUTTON1_MASK, targets, n_targets, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK); + gtk_target_table_free (targets, n_targets); + gtk_target_list_unref (target_list); + g_signal_connect_swapped ( priv->task_table, "table-drag-data-get", G_CALLBACK (task_shell_content_table_drag_data_get_cb), |