aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-memo-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-02-09 03:52:18 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-02-09 07:57:24 +0800
commit67ce5f3b140525c2f5944270a9383616f9d67923 (patch)
tree167788f4efa12f87ac04c474598d61b5ca446464 /modules/calendar/e-memo-shell-content.c
parent9cd1f937a26363aa108f3d2b36606b167597a2eb (diff)
downloadgsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar
gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.gz
gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.bz2
gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.lz
gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.xz
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-memo-shell-content.c')
-rw-r--r--modules/calendar/e-memo-shell-content.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index e34af1fbf8..34946b7bdd 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-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 memo_shell_content_type;
@@ -146,13 +137,16 @@ memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content
guint time)
{
EMemoTable *memo_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;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
@@ -404,9 +398,12 @@ memo_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_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
@@ -480,11 +477,18 @@ memo_shell_content_constructed (GObject *object)
e_table_set_state (
E_TABLE (priv->memo_table), E_MEMO_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->memo_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->memo_table, "table-drag-data-get",
G_CALLBACK (memo_shell_content_table_drag_data_get_cb),