[PATCH] Minor fix for the location bar.



This fixes a regression in the location bar.  Currently, pressing enter
while in the location bar causes the position of the entry to be set to
the beginning, thus making it harder to add to the current path.  This
patch fixes that.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5263
diff -p -u -r1.5263 ChangeLog
--- ChangeLog	2 May 2002 23:03:26 -0000	1.5263
+++ ChangeLog	4 May 2002 01:51:10 -0000
@@ -1,3 +1,12 @@
+2002-05-03  David Emory Watson  <dwatson cs ucr edu>
+
+	* src/nautilus-location-bar.c:
+	(try_to_expand_path): Remove extranious check (we always expand "~/"
+	before we get here) and call set_position_and_selection_to_end () since
+	the behavior of gtk_entry_set_text () has changed
+	(editable_event_after_callback): Useless optimization.
+	(nautilus_location_bar_set_location): Call set_position_and_selectio...
+
 2002-05-01  David Emory Watson  <dwatson cs ucr edu>
 
 	Implement zooming for the list view and other small cleanups.
Index: ./src/nautilus-location-bar.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-location-bar.c,v
retrieving revision 1.84
diff -p -u -r1.84 nautilus-location-bar.c
--- ./src/nautilus-location-bar.c	25 Mar 2002 06:28:40 -0000	1.84
+++ ./src/nautilus-location-bar.c	4 May 2002 01:51:10 -0000
@@ -322,6 +322,7 @@ static void
 get_file_info_list (NautilusLocationBar *bar, const char* dir_name)
 {
 	GnomeVFSResult result;
+
 	if (eel_strcmp (bar->details->current_directory, dir_name) != 0) {
 		g_free (bar->details->current_directory);
 		if (bar->details->file_info_list) {
@@ -376,9 +377,8 @@ try_to_expand_path (gpointer callback_da
 	user_location = gtk_editable_get_chars (editable, 0, -1);
 	bar->details->idle_id = 0;
 
-	/* if it's just '~' or '~/', don't expand because slash shouldn't be appended */
-	if (eel_strcmp (user_location, "~") == 0
-	    || eel_strcmp (user_location, "~/") == 0) {
+	/* if it's just '~' don't expand because slash shouldn't be appended */
+	if (eel_strcmp (user_location, "~") == 0) {
 		g_free (user_location);
 		return FALSE;
 	}
@@ -605,18 +605,12 @@ editable_event_after_callback (GtkEntry 
 	if (position_and_selection_are_at_end (editable)) {
 		if (entry_would_have_inserted_characters (keyevent)) {
 			if (keyevent->keyval == GDK_slash
-			    && has_exactly_one_slash (editable)) {
-				/* It's OK for us to call
-				 * gtk_entry_set_text here, even
-				 * though it has a side effect of
-				 * putting the position and selection
-				 * at the end, since the position and
-				 * selection are already at the end.
-				 */
+				&& has_exactly_one_slash (editable)) {
 				unexpanded_text = gtk_entry_get_text (GTK_ENTRY (editable));
 				expanded_text = gnome_vfs_expand_initial_tilde (unexpanded_text);
 				if (strcmp (unexpanded_text, expanded_text) != 0) {
 					gtk_entry_set_text (GTK_ENTRY (editable), expanded_text);
+					set_position_and_selection_to_end (editable);
 				}
 				g_free (expanded_text);
 			}
@@ -630,8 +624,8 @@ editable_event_after_callback (GtkEntry 
 		 */
 		if (bar->details->idle_id != 0) {
 			gtk_idle_remove (bar->details->idle_id);
+			bar->details->idle_id = 0;
 		}
-		bar->details->idle_id = 0;
 	}
 
 	nautilus_location_bar_update_label (bar);
@@ -801,11 +795,12 @@ nautilus_location_bar_set_location (Naut
 	bar = NAUTILUS_LOCATION_BAR (navigation_bar);
 
 	/* Note: This is called in reaction to external changes, and 
-	 * thus should not emit the LOCATION_CHANGED signal.*/
+	 * thus should not emit the LOCATION_CHANGED signal. */
 	
 	formatted_location = eel_format_uri_for_display (location);
 	nautilus_entry_set_text (NAUTILUS_ENTRY (bar->details->entry),
 				 formatted_location);
+	set_position_and_selection_to_end (GTK_EDITABLE (bar->details->entry));
 	g_free (formatted_location);
 
 	/* free up the cached file info from the previous location */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]