diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-16 01:03:25 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-16 01:03:25 +0800 |
commit | 07d220cd50802d5d7e21f7f339984e0f3a8eb74a (patch) | |
tree | 93fd246de8fdc14d269b3e2568424ccb0ddfda75 /src | |
parent | f3842fe890a0819331c3a5901437c88b2e88d282 (diff) | |
parent | b27315f5de4084fff748ac12f54b6d23ee7260a7 (diff) | |
download | gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.tar gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.tar.gz gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.tar.bz2 gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.tar.lz gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.tar.xz gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.tar.zst gsoc2013-empathy-07d220cd50802d5d7e21f7f339984e0f3a8eb74a.zip |
Merge commit 'staz/dnd'
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-chat-window.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 96484172c..29d574a3e 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -119,6 +119,7 @@ static const GtkTargetEntry drag_types_dest[] = { { "text/contact-id", 0, DND_DRAG_TYPE_CONTACT_ID }, { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, DND_DRAG_TYPE_TAB }, { "text/uri-list", 0, DND_DRAG_TYPE_URI_LIST }, + { "text/path-list", 0, DND_DRAG_TYPE_URI_LIST }, }; static const GtkTargetEntry drag_types_dest_contact[] = { @@ -126,6 +127,9 @@ static const GtkTargetEntry drag_types_dest_contact[] = { }; static const GtkTargetEntry drag_types_dest_file[] = { + /* must be first to be prioritized, in order to receive the + * note's file path from Tomboy instead of an URI */ + { "text/path-list", 0, DND_DRAG_TYPE_URI_LIST }, { "text/uri-list", 0, DND_DRAG_TYPE_URI_LIST }, }; @@ -1539,15 +1543,18 @@ chat_window_drag_drop (GtkWidget *widget, int x, int y, guint time_, - gpointer user_data) + EmpathyChatWindow *window) { - GdkAtom target, uri_target, contact_target; + GdkAtom target; + EmpathyChatWindowPriv *priv; - target = gtk_drag_dest_find_target (widget, context, NULL); - uri_target = gdk_atom_intern_static_string ("text/uri-list"); - contact_target = gdk_atom_intern_static_string ("text/contact-id"); + priv = GET_PRIV (window); + + target = gtk_drag_dest_find_target (widget, context, priv->file_targets); + if (target == GDK_NONE) + target = gtk_drag_dest_find_target (widget, context, priv->contact_targets); - if (target == uri_target || target == contact_target) { + if (target != GDK_NONE) { gtk_drag_get_data (widget, context, target, time_); return TRUE; } @@ -1565,14 +1572,11 @@ chat_window_drag_motion (GtkWidget *widget, { GdkAtom target; EmpathyChatWindowPriv *priv; - GdkAtom dest_target; priv = GET_PRIV (window); - target = gtk_drag_dest_find_target (widget, context, NULL); - - dest_target = gdk_atom_intern_static_string ("text/uri-list"); - if (target == dest_target) { + target = gtk_drag_dest_find_target (widget, context, priv->file_targets); + if (target != GDK_NONE) { /* This is a file drag. Ensure the contact is online and set the drag type to COPY. Note that it's possible that the tab will be switched by GTK+ after a timeout from drag_motion without @@ -1601,8 +1605,8 @@ chat_window_drag_motion (GtkWidget *widget, return TRUE; } - dest_target = gdk_atom_intern_static_string ("text/contact-id"); - if (target == dest_target) { + target = gtk_drag_dest_find_target (widget, context, priv->contact_targets); + if (target != GDK_NONE) { /* This is a drag of a contact from a contact list. Set to COPY. FIXME: If this drag is to a MUC window, it invites the user. Otherwise, it opens a chat. Should we use a different drag |