diff options
author | Shaun McCance <Shaun McCance> | 2009-09-16 04:10:24 +0800 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2009-11-25 02:05:31 +0800 |
commit | 42185f1d38082579ca113d612000c670eac76869 (patch) | |
tree | cfd05c97e6ed322dd8a8501d13a6375af345c7d2 /src | |
parent | 810fc88802d72b880ff9472be7374f72a34df748 (diff) | |
download | gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.tar gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.tar.gz gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.tar.bz2 gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.tar.lz gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.tar.xz gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.tar.zst gsoc2013-empathy-42185f1d38082579ca113d612000c670eac76869.zip |
Always prefer GDK_ACTION_COPY for text/uri-list drags
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-chat-window.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 5b3a3ac0f..90d4f8f6d 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -113,10 +113,12 @@ typedef enum { 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 }, }; -static const GtkTargetEntry drag_types_uri_dest[] = { - { "text/uri-list", 0, DND_DRAG_TYPE_URI_LIST }, +static const GtkTargetEntry drag_types_dest_noft[] = { + { "text/contact-id", 0, DND_DRAG_TYPE_CONTACT_ID }, + { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, DND_DRAG_TYPE_TAB }, }; static void chat_window_update (EmpathyChatWindow *window); @@ -1327,6 +1329,28 @@ chat_window_focus_in_event_cb (GtkWidget *widget, } static void +chat_window_drag_motion (GtkWidget *widget, + GdkDragContext *context, + int x, + int y, + guint time, + EmpathyChatWindow *window) +{ + static GtkTargetList *list = NULL; + GdkAtom target; + + if (list == NULL) { + list = gtk_target_list_new (drag_types_dest_noft, + G_N_ELEMENTS (drag_types_dest_noft)); + } + + target = gtk_drag_dest_find_target (widget, context, list); + if (target == GDK_NONE) { + gdk_drag_status (context, GDK_ACTION_COPY, time); + } +} + +static void chat_window_drag_data_received (GtkWidget *widget, GdkDragContext *context, int x, @@ -1662,14 +1686,13 @@ empathy_chat_window_init (EmpathyChatWindow *window) GTK_DEST_DEFAULT_ALL, drag_types_dest, G_N_ELEMENTS (drag_types_dest), - GDK_ACTION_MOVE); - gtk_drag_dest_set (GTK_WIDGET (priv->notebook), - GTK_DEST_DEFAULT_ALL, - drag_types_uri_dest, - G_N_ELEMENTS (drag_types_uri_dest), - GDK_ACTION_COPY); + GDK_ACTION_MOVE | GDK_ACTION_COPY); g_signal_connect (priv->notebook, + "drag-motion", + G_CALLBACK (chat_window_drag_motion), + window); + g_signal_connect (priv->notebook, "drag-data-received", G_CALLBACK (chat_window_drag_data_received), window); |