[nautilus] pathbar: cannot switch locations when dragging text
- From: Nelson Benítez León <nbenitez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] pathbar: cannot switch locations when dragging text
- Date: Tue, 6 Aug 2013 12:15:22 +0000 (UTC)
commit 10f15d1af56d87ec02e4d829d5f3c38d179b9626
Author: Nelson Benitez Leon <nbenitezl gmail com>
Date: Tue Aug 6 13:20:35 2013 +0200
pathbar: cannot switch locations when dragging text
Make pathbar also change locations when hovered by
text dnd targets.
Fixes bug 705549
Signed-off-by: Nelson Benítez León <nbenitezl+gnome gmail com>
src/nautilus-window-slot-dnd.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index b4d0c82..bc45857 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -41,6 +41,7 @@ typedef struct {
GList *selection_list;
GList *uri_list;
char *netscape_url;
+ GtkSelectionData *selection_data;
} data;
NautilusFile *target_file;
@@ -158,10 +159,12 @@ slot_proxy_drag_motion (GtkWidget *widget,
GdkAtom target;
int action;
char *target_uri;
+ gboolean valid_text_drag;
drag_info = user_data;
action = 0;
+ valid_text_drag = FALSE;
if (gtk_drag_get_source_widget (context) == widget) {
goto out;
@@ -217,13 +220,15 @@ slot_proxy_drag_motion (GtkWidget *widget,
action = nautilus_drag_default_drop_action_for_uri_list (context, target_uri);
} else if (drag_info->info == NAUTILUS_ICON_DND_NETSCAPE_URL) {
action = nautilus_drag_default_drop_action_for_netscape_url (context);
+ } else if (drag_info->info == NAUTILUS_ICON_DND_TEXT) {
+ valid_text_drag = TRUE;
}
}
g_free (target_uri);
out:
- if (action != 0) {
+ if (action != 0 || valid_text_drag) {
gtk_drag_highlight (widget);
slot_proxy_check_switch_location_timer (drag_info, widget);
} else {
@@ -262,6 +267,10 @@ drag_info_clear (NautilusDragSlotProxyInfo *drag_info)
g_list_free (drag_info->data.uri_list);
} else if (drag_info->info == NAUTILUS_ICON_DND_NETSCAPE_URL) {
g_free (drag_info->data.netscape_url);
+ } else if (drag_info->info == NAUTILUS_ICON_DND_TEXT) {
+ if (drag_info->data.selection_data != NULL) {
+ gtk_selection_data_free (drag_info->data.selection_data);
+ }
}
out:
@@ -421,6 +430,9 @@ slot_proxy_drag_data_received (GtkWidget *widget,
drag_info->data.netscape_url = g_strdup ((char *) gtk_selection_data_get_data (data));
drag_info->have_valid_data = drag_info->data.netscape_url != NULL;
+ } else if (info == NAUTILUS_ICON_DND_TEXT) {
+ drag_info->data.selection_data = gtk_selection_data_copy (data);
+ drag_info->have_valid_data = drag_info->data.selection_data != NULL;
}
if (drag_info->drop_occured) {
@@ -467,6 +479,7 @@ nautilus_drag_slot_proxy_init (GtkWidget *widget,
target_list = gtk_target_list_new (targets, G_N_ELEMENTS (targets));
gtk_target_list_add_uri_targets (target_list, NAUTILUS_ICON_DND_URI_LIST);
+ gtk_target_list_add_text_targets (target_list, NAUTILUS_ICON_DND_TEXT);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]