aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
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 /widgets
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 'widgets')
-rw-r--r--widgets/misc/e-attachment-view.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index 7529e669fb..1d76b5dd8d 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -27,6 +27,7 @@
#include <camel/camel-stream-mem.h>
#include "e-util/e-binding.h"
+#include "e-util/e-selection.h"
#include "e-util/e-util.h"
#include "e-attachment-dialog.h"
#include "e-attachment-handler-image.h"
@@ -39,9 +40,7 @@ enum {
/* Note: Do not use the info field. */
static GtkTargetEntry target_table[] = {
- { (gchar *) "_NETSCAPE_URL", 0, 0 },
- { (gchar *) "text/x-vcard", 0, 0 },
- { (gchar *) "text/calendar", 0, 0 }
+ { (gchar *) "_NETSCAPE_URL", 0, 0 }
};
static const gchar *ui =
@@ -421,20 +420,18 @@ attachment_view_text_calendar (EAttachmentView *view,
guint info,
guint time)
{
- static GdkAtom atom = GDK_NONE;
EAttachmentStore *store;
EAttachment *attachment;
CamelMimePart *mime_part;
GdkAtom data_type;
+ GdkAtom target;
const gchar *data;
gpointer parent;
gchar *content_type;
gint length;
- if (G_UNLIKELY (atom == GDK_NONE))
- atom = gdk_atom_intern_static_string ("text/calendar");
-
- if (gtk_selection_data_get_target (selection_data) != atom)
+ target = gtk_selection_data_get_target (selection_data);
+ if (!e_targets_include_calendar (&target, 1))
return;
g_signal_stop_emission_by_name (view, "drag-data-received");
@@ -477,20 +474,18 @@ attachment_view_text_x_vcard (EAttachmentView *view,
guint info,
guint time)
{
- static GdkAtom atom = GDK_NONE;
EAttachmentStore *store;
EAttachment *attachment;
CamelMimePart *mime_part;
GdkAtom data_type;
+ GdkAtom target;
const gchar *data;
gpointer parent;
gchar *content_type;
gint length;
- if (G_UNLIKELY (atom == GDK_NONE))
- atom = gdk_atom_intern_static_string ("text/x-vcard");
-
- if (gtk_selection_data_get_target (selection_data) != atom)
+ target = gtk_selection_data_get_target (selection_data);
+ if (!e_targets_include_directory (&target, 1))
return;
g_signal_stop_emission_by_name (view, "drag-data-received");
@@ -713,6 +708,8 @@ attachment_view_init_handlers (EAttachmentView *view)
target_table, G_N_ELEMENTS (target_table));
gtk_target_list_add_uri_targets (target_list, 0);
+ e_target_list_add_calendar_targets (target_list, 0);
+ e_target_list_add_directory_targets (target_list, 0);
priv->handlers = g_ptr_array_new ();
priv->target_list = target_list;