Commit 10f15d1a authored by Nelson Ben's avatar Nelson Ben 👣 Committed by Nelson Ben

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's avatarNelson Benítez León <nbenitezl+gnome@gmail.com>
parent 4618b96b
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment