[empathy: 16/17] Some improvements to file drag-and-drop based on comments on #595226
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy: 16/17] Some improvements to file drag-and-drop based on comments on #595226
- Date: Mon, 30 Nov 2009 15:09:57 +0000 (UTC)
commit 9ec54fdc072173c6676ec2d8ea0b8eabe6936cef
Author: Shaun McCance <shaunm gnome org>
Date: Tue Nov 24 11:26:45 2009 -0600
Some improvements to file drag-and-drop based on comments on #595226
src/empathy-chat-window.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 0aea2a7..fb04e7c 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -1339,7 +1339,7 @@ chat_window_drag_motion (GtkWidget *widget,
GdkDragContext *context,
int x,
int y,
- guint time,
+ guint time_,
EmpathyChatWindow *window)
{
GdkAtom target;
@@ -1362,16 +1362,21 @@ chat_window_drag_motion (GtkWidget *widget,
priv = GET_PRIV (window);
contact = empathy_chat_get_remote_contact (priv->current_chat);
- if (!empathy_contact_is_online (contact)) {
- gdk_drag_status (context, 0, time);
+ /* contact is NULL for multi-user chats. We don't do
+ * file transfers to MUCs. We also don't send files
+ * to offline contacts or contacts that don't support
+ * file transfer.
+ */
+ if ((contact == NULL) || !empathy_contact_is_online (contact)) {
+ gdk_drag_status (context, 0, time_);
return FALSE;
}
if (!(empathy_contact_get_capabilities (contact)
& EMPATHY_CAPABILITIES_FT)) {
- gdk_drag_status (context, 0, time);
+ gdk_drag_status (context, 0, time_);
return FALSE;
}
- gdk_drag_status (context, GDK_ACTION_COPY, time);
+ gdk_drag_status (context, GDK_ACTION_COPY, time_);
return TRUE;
}
@@ -1382,12 +1387,12 @@ chat_window_drag_motion (GtkWidget *widget,
Otherwise, it opens a chat. Should we use a different drag
type for invites? Should we allow ASK?
*/
- gdk_drag_status (context, GDK_ACTION_COPY, time);
+ gdk_drag_status (context, GDK_ACTION_COPY, time_);
return TRUE;
}
/* Otherwise, it must be a notebook tab drag. Set to MOVE. */
- gdk_drag_status (context, GDK_ACTION_MOVE, time);
+ gdk_drag_status (context, GDK_ACTION_MOVE, time_);
return TRUE;
}
@@ -1481,15 +1486,18 @@ chat_window_drag_data_received (GtkWidget *widget,
priv = GET_PRIV (window);
contact = empathy_chat_get_remote_contact (priv->current_chat);
- if (!EMPATHY_IS_CONTACT (contact)) {
- gtk_drag_finish (context, TRUE, FALSE, time);
+ /* contact is NULL when current_chat is a multi-user chat.
+ * We don't do file transfers to MUCs, so just cancel the drag.
+ */
+ if (contact == NULL) {
+ gtk_drag_finish (context, TRUE, FALSE, time_);
return;
}
data = (const gchar *) gtk_selection_data_get_data (selection);
empathy_send_file_from_uri_list (contact, data);
- gtk_drag_finish (context, TRUE, FALSE, time);
+ gtk_drag_finish (context, TRUE, FALSE, time_);
}
else if (info == DND_DRAG_TYPE_TAB) {
EmpathyChat **chat;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]