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 | |
parent | 9cd1f937a26363aa108f3d2b36606b167597a2eb (diff) | |
download | gsoc2013-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')
-rw-r--r-- | modules/addressbook/e-book-shell-view-actions.c | 2 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-content.c | 26 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-content.c | 26 |
3 files changed, 31 insertions, 23 deletions
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index c439fafec8..dbfdc991e7 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -552,7 +552,7 @@ action_contact_save_as_cb (GtkAction *action, /* XXX No callback means errors are discarded. * - * There an EAlert for this which I'm not using + * There's an EAlert for this which I'm not using * until I figure out a better way to display errors: * * "addressbook:save-error" 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), 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), |