9fcb0f8
--- gtk+-1.2.10/gtk/gtkfilesel.c.deletedir	Thu Feb 15 23:36:19 2001
9fcb0f8
+++ gtk+-1.2.10/gtk/gtkfilesel.c	Wed Apr 17 20:36:25 2002
9fcb0f8
@@ -325,7 +325,8 @@
9fcb0f8
 
9fcb0f8
 static void gtk_file_selection_populate      (GtkFileSelection      *fs,
9fcb0f8
 					      gchar                 *rel_path,
9fcb0f8
-					      gint                   try_complete);
9fcb0f8
+					      gboolean               try_complete,
9fcb0f8
+					      gboolean               reset_entry);
9fcb0f8
 static void gtk_file_selection_abort         (GtkFileSelection      *fs);
9fcb0f8
 
9fcb0f8
 static void gtk_file_selection_update_history_menu (GtkFileSelection       *fs,
9fcb0f8
@@ -522,7 +523,7 @@
9fcb0f8
     }
9fcb0f8
   else
9fcb0f8
     {
9fcb0f8
-      gtk_file_selection_populate (filesel, "", FALSE);
9fcb0f8
+      gtk_file_selection_populate (filesel, "", FALSE, TRUE);
9fcb0f8
     }
9fcb0f8
 
9fcb0f8
   gtk_widget_grab_focus (filesel->selection_entry);
9fcb0f8
@@ -637,7 +638,7 @@
9fcb0f8
       name = last_slash + 1;
9fcb0f8
     }
9fcb0f8
 
9fcb0f8
-  gtk_file_selection_populate (filesel, buf, FALSE);
9fcb0f8
+  gtk_file_selection_populate (filesel, buf, FALSE, TRUE);
9fcb0f8
 
9fcb0f8
   if (filesel->selection_entry)
9fcb0f8
     gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
9fcb0f8
@@ -673,7 +674,7 @@
9fcb0f8
 
9fcb0f8
   if (filesel->selection_entry)
9fcb0f8
     gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), pattern);
9fcb0f8
-  gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE);
9fcb0f8
+  gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE, TRUE);
9fcb0f8
 }
9fcb0f8
 
9fcb0f8
 static void
9fcb0f8
@@ -806,7 +807,7 @@
9fcb0f8
   g_free (full_path);
9fcb0f8
   
9fcb0f8
   gtk_widget_destroy (fs->fileop_dialog);
9fcb0f8
-  gtk_file_selection_populate (fs, "", FALSE);
9fcb0f8
+  gtk_file_selection_populate (fs, "", FALSE, FALSE);
9fcb0f8
 }
9fcb0f8
   
9fcb0f8
 static void
9fcb0f8
@@ -903,7 +904,7 @@
9fcb0f8
   g_free (full_path);
9fcb0f8
   
9fcb0f8
   gtk_widget_destroy (fs->fileop_dialog);
9fcb0f8
-  gtk_file_selection_populate (fs, "", FALSE);
9fcb0f8
+  gtk_file_selection_populate (fs, "", FALSE, TRUE);
9fcb0f8
 }
9fcb0f8
 
9fcb0f8
 static void
9fcb0f8
@@ -1009,8 +1010,9 @@
9fcb0f8
   g_free (new_filename);
9fcb0f8
   g_free (old_filename);
9fcb0f8
   
9fcb0f8
+  gtk_file_selection_populate (fs, "", FALSE, FALSE);
9fcb0f8
+  gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), file);
9fcb0f8
   gtk_widget_destroy (fs->fileop_dialog);
9fcb0f8
-  gtk_file_selection_populate (fs, "", FALSE);
9fcb0f8
 }
9fcb0f8
   
9fcb0f8
 static void
9fcb0f8
@@ -1112,7 +1114,7 @@
9fcb0f8
 
9fcb0f8
       text = g_strdup (text);
9fcb0f8
 
9fcb0f8
-      gtk_file_selection_populate (fs, text, TRUE);
9fcb0f8
+      gtk_file_selection_populate (fs, text, TRUE, TRUE);
9fcb0f8
 
9fcb0f8
       g_free (text);
9fcb0f8
 
9fcb0f8
@@ -1124,7 +1126,6 @@
9fcb0f8
   return FALSE;
9fcb0f8
 }
9fcb0f8
 
9fcb0f8
-
9fcb0f8
 static void
9fcb0f8
 gtk_file_selection_history_callback (GtkWidget *widget, gpointer data)
9fcb0f8
 {
9fcb0f8
@@ -1142,7 +1143,7 @@
9fcb0f8
     
9fcb0f8
     if (callback_arg->menu_item == widget)
9fcb0f8
       {
9fcb0f8
-	gtk_file_selection_populate (fs, callback_arg->directory, FALSE);
9fcb0f8
+	gtk_file_selection_populate (fs, callback_arg->directory, FALSE, FALSE);
9fcb0f8
 	break;
9fcb0f8
       }
9fcb0f8
     
9fcb0f8
@@ -1272,7 +1273,7 @@
9fcb0f8
 			       gpointer user_data)
9fcb0f8
 {
9fcb0f8
   GtkFileSelection *fs = NULL;
9fcb0f8
-  gchar *filename, *temp = NULL;
9fcb0f8
+  gchar *filename = NULL;
9fcb0f8
 
9fcb0f8
   g_return_if_fail (GTK_IS_CLIST (widget));
9fcb0f8
 
9fcb0f8
@@ -1280,39 +1281,23 @@
9fcb0f8
   g_return_if_fail (fs != NULL);
9fcb0f8
   g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
9fcb0f8
 
9fcb0f8
-  gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &temp);
9fcb0f8
-  filename = g_strdup (temp);
9fcb0f8
-
9fcb0f8
-  if (filename)
9fcb0f8
-    {
9fcb0f8
-      if (bevent)
9fcb0f8
-	switch (bevent->type)
9fcb0f8
-	  {
9fcb0f8
-	  case GDK_2BUTTON_PRESS:
9fcb0f8
-	    gtk_file_selection_populate (fs, filename, FALSE);
9fcb0f8
-	    break;
9fcb0f8
-	  
9fcb0f8
-	  default:
9fcb0f8
-	    gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
9fcb0f8
-	    break;
9fcb0f8
-	  }
9fcb0f8
-      else
9fcb0f8
-	gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
9fcb0f8
-
9fcb0f8
-      g_free (filename);
9fcb0f8
-    }
9fcb0f8
+  gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &filename);
9fcb0f8
+  
9fcb0f8
+  if (filename && bevent && bevent->type == GDK_2BUTTON_PRESS)
9fcb0f8
+    gtk_file_selection_populate (fs, filename, FALSE, FALSE);
9fcb0f8
 }
9fcb0f8
 
9fcb0f8
 static void
9fcb0f8
 gtk_file_selection_populate (GtkFileSelection *fs,
9fcb0f8
 			     gchar            *rel_path,
9fcb0f8
-			     gint              try_complete)
9fcb0f8
+			     gboolean          try_complete,
9fcb0f8
+			     gboolean          reset_entry)
9fcb0f8
 {
9fcb0f8
   CompletionState *cmpl_state;
9fcb0f8
   PossibleCompletion* poss;
9fcb0f8
   gchar* filename;
9fcb0f8
   gint row;
9fcb0f8
-  gchar* rem_path = rel_path;
9fcb0f8
+  gchar* rem_path;
9fcb0f8
   gchar* sel_text;
9fcb0f8
   gchar* text[2];
9fcb0f8
   gint did_recurse = FALSE;
9fcb0f8
@@ -1323,6 +1308,8 @@
9fcb0f8
   
9fcb0f8
   g_return_if_fail (fs != NULL);
9fcb0f8
   g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
9fcb0f8
+
9fcb0f8
+  rem_path = rel_path = g_strdup (rel_path);
9fcb0f8
   
9fcb0f8
   cmpl_state = (CompletionState*) fs->cmpl_state;
9fcb0f8
   poss = cmpl_completion_matches (rel_path, &rem_path, cmpl_state);
9fcb0f8
@@ -1422,7 +1409,7 @@
9fcb0f8
 
9fcb0f8
               did_recurse = TRUE;
9fcb0f8
 
9fcb0f8
-              gtk_file_selection_populate (fs, dir_name, TRUE);
9fcb0f8
+              gtk_file_selection_populate (fs, dir_name, TRUE, TRUE);
9fcb0f8
 
9fcb0f8
               g_free (dir_name);
9fcb0f8
             }
9fcb0f8
@@ -1441,7 +1428,7 @@
9fcb0f8
 	    gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), rem_path);
9fcb0f8
         }
9fcb0f8
     }
9fcb0f8
-  else
9fcb0f8
+  else if (reset_entry)
9fcb0f8
     {
9fcb0f8
       if (fs->selection_entry)
9fcb0f8
 	gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
9fcb0f8
@@ -1466,8 +1453,9 @@
9fcb0f8
 	{
9fcb0f8
 	  gtk_file_selection_update_history_menu (fs, cmpl_reference_position (cmpl_state));
9fcb0f8
 	}
9fcb0f8
-      
9fcb0f8
     }
9fcb0f8
+
9fcb0f8
+  g_free (rel_path);
9fcb0f8
 }
9fcb0f8
 
9fcb0f8
 static void