[PATCH] pathbar: cannot switch locations when dragging text
"nbenitezl ." <[email protected]>
| Newsgroups | gmane.comp.gnome.nautilus |
|---|---|
| Message-ID | <CAAUd641xdGbkXhw-xFA1c3xacS8rGXiYkexYuBRmvvHApTNK1Q@mail.gmail.com> |
Hi, I've attached a patch for http://bugs.gnome.org/705549 This is about when you drag some text (for instance from gedit) and hover it over the pathbar buttons, the buttons don't react and change the location. You can visit the bug link for more info. Patch also attached to this mail. Regards, -- nautilus-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/nautilus-list
0001-pathbar-cannot-switch-locations-when-dragging-text.patch
(application/octet-stream, 2.7 KB)
From 3ff327ae1825affd7a91714b9d1c4cf4aebc64de Mon Sep 17 00:00:00 2001 From: Nelson Benitez Leon <[email protected]> Date: Tue, 6 Aug 2013 13:20:35 +0200 Subject: [PATCH] pathbar: cannot switch locations when dragging text Make pathbar also change locations when hovered with text dnd targets. Fixes bug 705549 --- src/nautilus-window-slot-dnd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c index b4d0c82..ba1389f 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 { @@ -421,6 +426,12 @@ 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) { + if (drag_info->data.selection_data != NULL) { + gtk_selection_data_free (drag_info->data.selection_data); + } + 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 +478,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); -- 1.8.2.1