diff options
author | Andy Hertzfeld <andy@src.gnome.org> | 2000-04-26 01:27:07 +0000 |
---|---|---|
committer | Andy Hertzfeld <andy@src.gnome.org> | 2000-04-26 01:27:07 +0000 |
commit | 841ac7b5bb19f970ab77fdf2c6ff92c662e20dc7 (patch) | |
tree | 3b808e945f2f187dddc99c8c8874610e0d4995f0 | |
parent | 86e64a0269fa875718dac72ec421531ab69623e7 (diff) | |
download | nautilus-841ac7b5bb19f970ab77fdf2c6ff92c662e20dc7.tar.gz |
made drag and drop to and from the location bar work properly
made drag and drop to and from the location bar work properly
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/nautilus-location-bar.c | 14 |
2 files changed, 19 insertions, 7 deletions
@@ -1,3 +1,15 @@ +2000-04-25 Andy Hertzfeld <andy@eazel.com> + + made drag and drop to and from the location bar work properly + + * src/nautilus-location-bar.c: + changed the exported drag action to GDK_ACTION_LINK, as well as making + it accept links. Fixed crashes in drag_data_get by referencing the + actual location bar instead of the event box, and by not destroying + the result from gtk_entry_get_text, since it's not a copy. Made it + actually go to the dropped in uri by emitting the location changed + signal. + 2000-04-25 John Sullivan <sullivan@eazel.com> * data/mime/nautilus.keys diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c index 51b69a9d4..f2b149029 100644 --- a/src/nautilus-location-bar.c +++ b/src/nautilus-location-bar.c @@ -109,6 +109,9 @@ drag_data_received_cb (GtkWidget *widget, nautilus_location_bar_set_location (NAUTILUS_LOCATION_BAR (widget), names->data); + gtk_signal_emit (GTK_OBJECT (widget), + signals[LOCATION_CHANGED], + gtk_entry_get_text (GTK_ENTRY (NAUTILUS_LOCATION_BAR (widget)->entry))); gnome_uri_list_free_strings (names); @@ -124,11 +127,10 @@ drag_data_get_cb (GtkWidget *widget, { char *entry_text; - g_assert (NAUTILUS_IS_LOCATION_BAR (widget)); g_assert (selection_data != NULL); - entry_text = gtk_entry_get_text (NAUTILUS_LOCATION_BAR (widget)->entry); - + entry_text = gtk_entry_get_text (NAUTILUS_LOCATION_BAR (widget->parent)->entry); + switch (info) { case NAUTILUS_DND_URI_LIST: case NAUTILUS_DND_TEXT_PLAIN: @@ -141,8 +143,6 @@ drag_data_get_cb (GtkWidget *widget, default: g_assert_not_reached (); } - - g_free (entry_text); } static void @@ -217,7 +217,7 @@ nautilus_location_bar_initialize (NautilusLocationBar *bar) gtk_drag_source_set (GTK_WIDGET (event_box), GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, drag_types, NAUTILUS_N_ELEMENTS (drag_types), - GDK_ACTION_COPY | GDK_ACTION_MOVE); + GDK_ACTION_LINK); gtk_signal_connect (GTK_OBJECT (event_box), "drag_data_get", GTK_SIGNAL_FUNC (drag_data_get_cb), bar); @@ -226,7 +226,7 @@ nautilus_location_bar_initialize (NautilusLocationBar *bar) gtk_drag_dest_set (GTK_WIDGET (bar), GTK_DEST_DEFAULT_ALL, drop_types, NAUTILUS_N_ELEMENTS (drop_types), - GDK_ACTION_COPY | GDK_ACTION_MOVE); + GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); gtk_signal_connect (GTK_OBJECT (bar), "drag_data_received", GTK_SIGNAL_FUNC (drag_data_received_cb), NULL); |