make clean does not remove wavlmc.o for some reason.  Here's the patch
to fix the Makefile-plugins.in so that this is remedied. 

--- ../freeamp/Makefile-plugins.in      Tue Oct 16 00:31:05 2001
+++ freeamp/Makefile-plugins.in Sat Apr 13 00:45:16 2002
@@ -29,7 +29,7 @@
 OSDEPPLUGINS = @OSDEPPLUGINS@
 
 clean-plugins plugins-clean:
-       -rm -f $(CORBAUIOBJ) $(VORBISLIBOBJ) $(VORBISOBJ) $(VORBISMDFOBJ) 
$(SIGNATUREPMOOBJ) $(LIBHTTPOBJ) $(KJOFOLOBJ) $(WINAMPOBJ) $(CDPMOOBJ) $(CDLMCOBJ) 
$(UNZIPOBJ) $(MBCDOBJ) $(PLSOBJ) $(RMPOBJ) $(MISCOBJ) $(ZLIBOBJ) $(MUSICBROWSEROBJ) 
$(MAKETHEMEOBJ) $(LFIOBJ) $(HTTPOBJ) $(OBSPMI) $(SCPMOOBJ) $(ALSAOBJ) $(ESNDOBJ) 
$(DOWNLOADUIOBJ) $(CMDUIOBJ) $(MPG123UIOBJ) $(NCURSESUIOBJ) $(LCDUIOBJ) $(IRMANUIOBJ) 
$(FREEAMPUIOBJ) $(ID3V1OBJ) $(ID3V2OBJ) $(M3UOBJ) $(PMP300OBJ) $(XINGLMCOBJ) 
$(WAVPMOOBJ) MakeTheme plugins/*.*
+       -rm -f $(CORBAUIOBJ) $(VORBISLIBOBJ) $(VORBISOBJ) $(WAVOBJ) $(VORBISMDFOBJ) 
+$(SIGNATUREPMOOBJ) $(LIBHTTPOBJ) $(KJOFOLOBJ) $(WINAMPOBJ) $(CDPMOOBJ) $(CDLMCOBJ) 
+$(UNZIPOBJ) $(MBCDOBJ) $(PLSOBJ) $(RMPOBJ) $(MISCOBJ) $(ZLIBOBJ) $(MUSICBROWSEROBJ) 
+$(MAKETHEMEOBJ) $(LFIOBJ) $(HTTPOBJ) $(OBSPMI) $(SCPMOOBJ) $(ALSAOBJ) $(ESNDOBJ) 
+$(DOWNLOADUIOBJ) $(CMDUIOBJ) $(MPG123UIOBJ) $(NCURSESUIOBJ) $(LCDUIOBJ) $(IRMANUIOBJ) 
+$(FREEAMPUIOBJ) $(ID3V1OBJ) $(ID3V2OBJ) $(M3UOBJ) $(PMP300OBJ) $(XINGLMCOBJ) 
+$(WAVPMOOBJ) MakeTheme plugins/*.*
 
 PLUGINS =  lib/zlib/lib/libzlib.la
 PLUGINS += lib/unzip/lib/libunzip.la


Now on to the fun stuff.  I finished my incomplete patch for adding
"return to directory" functionality to freeamp's add file menu.  This
allows users to bypass freeamp's default behavior of opening to the
current dir that freeamp was run in.  Good for those who are picking and
choosing many different files from some subtree of directories.  

it's enabled by clicking on the "Open to file last selected" in the
General Preferences under Playlist.  It seems to cause a little "issue"
with themes that i cant quite figure it out.  Sometimes it has a problem
with it, sometimes it doesn't.  Strange. Anyway it works fine, nothing
crashes and it's not reccurring.  

I've attached the following patch that adds recursive directory adding
and the selectable "return to last file" to the file selection window.  


diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/base/include/preferences.h ./freeamp/base/include/preferences.h
--- ../freeamp/base/include/preferences.h	Tue Oct 16 01:23:08 2001
+++ ./freeamp/base/include/preferences.h	Fri Apr 12 20:47:43 2002
@@ -81,6 +81,7 @@
 extern const char* kViewMusicBrowserPref;
 extern const char* kWelcomePref;
 extern const char* kPlayImmediatelyPref;
+extern const char* kSetLastResumePref;
 extern const char* kNumberOfURLsToRememberPref;
 extern const char* kCDDevicePathPref;
 extern const char* kCheckCDAutomaticallyPref;
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/base/src/preferences.cpp ./freeamp/base/src/preferences.cpp
--- ../freeamp/base/src/preferences.cpp	Tue Oct 16 01:23:08 2001
+++ ./freeamp/base/src/preferences.cpp	Fri Apr 12 20:47:43 2002
@@ -79,6 +79,7 @@
 const char* kWindowModePref = "WindowMode";
 const char* kWelcomePref = "Welcome";
 const char* kPlayImmediatelyPref = "PlayImmediately";
+const char* kSetLastResumePref = "SetLastResume";
 const char* kNumberOfURLsToRememberPref = "NumberOfURLsToRemember";
 const char* kCDDevicePathPref = "CDDevice";
 const char* kCheckCDAutomaticallyPref = "AutoUpdateCD";
@@ -156,6 +157,7 @@
 const bool kDefaultViewMusicBrowser = true;
 const bool kDefaultWelcome = true;
 const bool kDefaultPlayImmediately = true;
+const bool kDefaultSetLastResume = true;
 const int32 kDefaultNumberOfURLsToRemember = 10;
 const char* kDefaultMBServer = "http://www.musicbrainz.org:80";;
 const bool kDefaultConvertUnderscoresToSpaces = true;
@@ -346,6 +348,9 @@
 
     if (GetPrefBoolean(kPlayImmediatelyPref, &dummyBool) == kError_NoPrefValue)
         SetPrefBoolean(kPlayImmediatelyPref, kDefaultPlayImmediately);
+	
+    if (GetPrefBoolean(kSetLastResumePref, &dummyBool) == kError_NoPrefValue)
+	SetPrefBoolean(kSetLastResumePref, kDefaultSetLastResume);
 
     if (GetPrefInt32(kNumberOfURLsToRememberPref, &dummyInt) == kError_NoPrefValue)
         SetPrefInt32(kNumberOfURLsToRememberPref, kDefaultNumberOfURLsToRemember);
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/freeamp/unix/include/GTKFileSelector.h ./freeamp/ui/freeamp/unix/include/GTKFileSelector.h
--- ../freeamp/ui/freeamp/unix/include/GTKFileSelector.h	Sat Oct 27 19:20:21 2001
+++ ./freeamp/ui/freeamp/unix/include/GTKFileSelector.h	Fri Apr 12 23:45:30 2002
@@ -34,7 +34,7 @@
 
 class GTKFileSelector {
  public:
-    GTKFileSelector(const char *);
+    GTKFileSelector(FAContext *,const char *);
   
     bool Run(bool runMain = true);
     void SetExtended() { extended = true; }
@@ -42,7 +42,9 @@
                                 return (char *)returnpath.c_str(); 
                             else return NULL; 
                           }
-
+    FAContext *GetContext(void) { return m_context; }
+ protected:
+    FAContext *m_context;
  private:
     string returnpath;
     string title;
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/freeamp/unix/include/GTKPreferenceWindow.h ./freeamp/ui/freeamp/unix/include/GTKPreferenceWindow.h
--- ../freeamp/ui/freeamp/unix/include/GTKPreferenceWindow.h	Tue Oct 16 01:03:41 2001
+++ ./freeamp/ui/freeamp/unix/include/GTKPreferenceWindow.h	Fri Apr 12 20:47:43 2002
@@ -77,6 +77,7 @@
     bool useImages; 
     bool savePlaylistOnExit;
     bool playImmediately;
+    bool setLastResume;
     bool allowMultipleInstances;
  
     string saveMusicDirectory;
@@ -107,6 +108,7 @@
             convertUnderscores == pref.convertUnderscores &&
             allowMultipleInstances == pref.allowMultipleInstances &&
             playImmediately == pref.playImmediately &&
+	    setLastResume == pref.setLastResume &&
             useTextLabels == pref.useTextLabels &&
             useImages == pref.useImages &&
             savePlaylistOnExit == pref.savePlaylistOnExit &&
@@ -316,6 +318,7 @@
       void SetToolbar(bool text, bool pics);
       void SaveOnExitToggle(int active);
       void PlayImmediatelyToggle(int active);
+      void SetLastResumeToggle(int active);
       void AllowMultipleToggle(int active);
       void ConvertUnderscoresToggle(int active);
       void ReclaimTypesToggle(int active);
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/freeamp/unix/src/GTKFileSelector.cpp ./freeamp/ui/freeamp/unix/src/GTKFileSelector.cpp
--- ../freeamp/ui/freeamp/unix/src/GTKFileSelector.cpp	Wed May 24 13:08:34 2000
+++ ./freeamp/ui/freeamp/unix/src/GTKFileSelector.cpp	Fri Apr 12 23:46:14 2002
@@ -23,9 +23,13 @@
 
 #include "GTKFileSelector.h"
 #include <unistd.h>
+#include <dirent.h>
 
-GTKFileSelector::GTKFileSelector(const char *windowtitle)
+char old_path[PATH_MAX];
+
+GTKFileSelector::GTKFileSelector(FAContext *context,const char *windowtitle)
 {
+	m_context = context;
     title = windowtitle;
     returnpath = "";
     extended = false;
@@ -51,6 +55,34 @@
     p->CancelEvent();
 }
 
+string GTKrecursive_path(char subdirs[PATH_MAX], string returnpath,int *sub_rnum)
+{  
+    DIR *dir=NULL;
+    struct dirent *current=NULL;
+    if ((dir = opendir(subdirs))!=NULL){
+        current = readdir(dir);
+        current = readdir(dir); 
+        while((current=readdir(dir))!=NULL){ 
+            if(current->d_type==DT_DIR){  
+                char temp_subdir[PATH_MAX];
+                strncpy(temp_subdir, subdirs,PATH_MAX);
+                strcat(temp_subdir,"/");
+                strncat(temp_subdir,current->d_name,FILENAME_MAX);
+                returnpath = GTKrecursive_path(temp_subdir,returnpath,sub_rnum);
+            }
+            else {
+                returnpath += "\n";
+                returnpath += subdirs;
+		returnpath += "/";
+                returnpath += current->d_name;
+                sub_rnum++;
+            }
+        }
+    }
+    closedir(dir);
+    return (returnpath);
+}                    
+
 void GTKFileSelector::CancelEvent()
 {
     gtk_widget_destroy(filesel);
@@ -64,6 +96,7 @@
     char *raw_path = NULL;
     GList *row = GTK_CLIST(gfile->file_list)->row_list;
     gint rownum = 0;
+    gint sub_rnum = 0;
     char *temp, *path_temp;
 
     returnpath = gtk_file_selection_get_filename(gfile);
@@ -78,23 +111,33 @@
         tempdir[0] = '\0';
 
     raw_path = gtk_entry_get_text(GTK_ENTRY(gfile->selection_entry));
-    while (row) {
-        if (GTK_CLIST_ROW(row)->state == GTK_STATE_SELECTED) {
-            if (gtk_clist_get_cell_type(GTK_CLIST(gfile->file_list), rownum, 0)
-                == GTK_CELL_TEXT) {
-                gtk_clist_get_text(GTK_CLIST(gfile->file_list), rownum, 0, &temp);
-                if (!strcmp(temp, raw_path))
-                    goto next_iter;
-                returnpath += "\n";
-                returnpath += path_temp;
-                returnpath += "/";
-                returnpath += temp;
-            }
-        }
-    next_iter:
-        rownum++;
-        row = g_list_next(row);
+    strncpy(old_path,path_temp,PATH_MAX);
+    if(row){
+	while (row) {
+    	    if (GTK_CLIST_ROW(row)->state == GTK_STATE_SELECTED) {
+        	if (gtk_clist_get_cell_type(GTK_CLIST(gfile->file_list), rownum, 0)
+            	    == GTK_CELL_TEXT) {
+            	    gtk_clist_get_text(GTK_CLIST(gfile->file_list), rownum, 0, &temp);
+            	    if (!strcmp(temp, raw_path))
+                	goto next_iter;
+            	    returnpath += "\n";
+            	    returnpath += path_temp;
+            	    returnpath += "/";
+            	    returnpath += temp;
+        	}
+    	    }
+	    next_iter:
+    	    rownum++;
+    	    row = g_list_next(row);
+	}
+    }
+    else {
+	char subdirs[PATH_MAX];
+	strncpy(subdirs,old_path,PATH_MAX);
+	returnpath="";
+	returnpath = GTKrecursive_path(subdirs,returnpath,&sub_rnum);
     }
+    rownum += sub_rnum;
     gtk_widget_destroy(GTK_WIDGET(gfile));
     free(path_temp);
 
@@ -104,11 +147,14 @@
 
 bool GTKFileSelector::Run(bool runMain)
 {
+	bool dummyBool;
     if (!runMain)
         gdk_threads_enter();
 
     filesel = gtk_file_selection_new(title.c_str());
-
+    m_context->prefs->GetPrefBoolean(kSetLastResumePref, &dummyBool);
+    if(dummyBool)
+		gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), old_path);
     gtk_window_set_modal(GTK_WINDOW(filesel), TRUE);
     gtk_signal_connect(GTK_OBJECT(filesel), "destroy",
                        GTK_SIGNAL_FUNC(filesel_destroy), (gpointer)runMain);
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/freeamp/unix/src/GTKPreferenceWindow.cpp ./freeamp/ui/freeamp/unix/src/GTKPreferenceWindow.cpp
--- ../freeamp/ui/freeamp/unix/src/GTKPreferenceWindow.cpp	Tue Oct 16 01:03:41 2001
+++ ./freeamp/ui/freeamp/unix/src/GTKPreferenceWindow.cpp	Sat Apr 13 00:15:40 2002
@@ -447,6 +447,9 @@
     prefs->GetPrefBoolean(kShowToolbarImagesPref, &values->useImages);
     prefs->GetPrefBoolean(kSaveCurrentPlaylistOnExitPref, &values->savePlaylistOnExit);
     prefs->GetPrefBoolean(kPlayImmediatelyPref, &values->playImmediately);
+    
+    prefs->GetPrefBoolean(kSetLastResumePref, &values->setLastResume);
+    
     prefs->GetPrefBoolean(kAllowMultipleInstancesPref, &values->allowMultipleInstances);
 
     if(kError_BufferTooSmall == prefs->GetPrefString(kSaveMusicDirPref, buffer, &size))
@@ -540,6 +543,9 @@
     prefs->SetPrefBoolean(kShowToolbarImagesPref, values->useImages);
     prefs->SetPrefBoolean(kSaveCurrentPlaylistOnExitPref, values->savePlaylistOnExit);
     prefs->SetPrefBoolean(kPlayImmediatelyPref, values->playImmediately);
+    
+    prefs->SetPrefBoolean(kSetLastResumePref, values->setLastResume);
+    
     prefs->SetPrefBoolean(kAllowMultipleInstancesPref, values->allowMultipleInstances);
     prefs->SetPrefBoolean(kAskToReclaimFiletypesPref, values->askReclaimFiletypes);
     prefs->SetPrefBoolean(kReclaimFiletypesPref, values->reclaimFiletypes);
@@ -657,6 +663,19 @@
     p->PlayImmediatelyToggle(i);
 }
 
+void GTKPreferenceWindow::SetLastResumeToggle(int active)
+{
+    proposedValues.setLastResume = active;
+    if(!firsttime)
+	gtk_widget_set_sensitive(applyButton,TRUE);
+}
+
+static void set_last_toggle(GtkWidget *w, GTKPreferenceWindow *p)
+{
+    int i = GTK_TOGGLE_BUTTON(w)->active;
+    p->SetLastResumeToggle(i);
+}
+
 void GTKPreferenceWindow::AllowMultipleToggle(int active)
 {
     proposedValues.allowMultipleInstances = active;
@@ -791,6 +810,14 @@
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
     gtk_widget_show(check);
 
+    check = gtk_check_button_new_with_label("Open File to Last Selected");
+    gtk_box_pack_start(GTK_BOX(vbox), check, FALSE,FALSE,0);
+    gtk_signal_connect(GTK_OBJECT(check), "toggled",
+		       GTK_SIGNAL_FUNC(set_last_toggle), this);
+    if(originalValues.setLastResume)
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
+    gtk_widget_show(check);
+
     frame = gtk_frame_new("Miscellaneous");
     gtk_box_pack_start(GTK_BOX(pane), frame, FALSE, FALSE, 5);
     gtk_widget_show(frame);
@@ -918,7 +945,7 @@
 
 static void save_stream_browse(GtkWidget *w, GTKPreferenceWindow *p)
 {
-    GTKFileSelector *filesel = new GTKFileSelector("Select a New Directory");
+    GTKFileSelector *filesel = new GTKFileSelector(p->GetContext(),"Select a New Directory");
     if (filesel->Run(true)) {
         char *returnpath = filesel->GetReturnPath();
  
@@ -1653,7 +1680,7 @@
 
 static void add_theme_press(GtkWidget *w, GTKPreferenceWindow *p)
 {
-    GTKFileSelector *filesel = new GTKFileSelector("Select a Theme to Add");
+    GTKFileSelector *filesel = new GTKFileSelector(p->GetContext(),"Select a Theme to Add");
     if (filesel->Run(true)) {
         char *returnpath = filesel->GetReturnPath();
         p->AddThemeEvent(returnpath);
@@ -2122,7 +2149,7 @@
 
 static void save_music_browse(GtkWidget *w, GTKPreferenceWindow *p)
 {
-    GTKFileSelector *filesel = new GTKFileSelector("Select a New Directory");
+    GTKFileSelector *filesel = new GTKFileSelector(p->GetContext(),"Select a New Directory");
     if (filesel->Run(true)) {
         char *returnpath = filesel->GetReturnPath();
 
@@ -2157,7 +2184,7 @@
 
 static void watch_dir_browse(GtkWidget *w, GTKPreferenceWindow *p)
 {
-    GTKFileSelector *filesel = new GTKFileSelector("Select a New Directory");
+    GTKFileSelector *filesel = new GTKFileSelector(p->GetContext(),"Select a New Directory");
     if (filesel->Run(true)) {
         char *returnpath = filesel->GetReturnPath();
 
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/include/fileselector.h ./freeamp/ui/musicbrowser/unix/include/fileselector.h
--- ../freeamp/ui/musicbrowser/unix/include/fileselector.h	Sat Oct 27 19:20:21 2001
+++ ./freeamp/ui/musicbrowser/unix/include/fileselector.h	Sat Apr 13 00:23:29 2002
@@ -34,8 +34,7 @@
 
 class FileSelector {
  public:
-    FileSelector(const char *);
-  
+    FileSelector(FAContext *,const char *);
     bool Run(bool runMain = true);
     void SetExtended() { extended = true; }
     char *GetReturnPath() { if (returnpath != "")
@@ -43,6 +42,9 @@
                             else return NULL; 
                           }
 
+ 	FAContext *GetContext(void) { return m_context; }
+ protected:
+    FAContext *m_context;
  private:
     string returnpath;
     string title;
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/include/introwizard.h ./freeamp/ui/musicbrowser/unix/include/introwizard.h
--- ../freeamp/ui/musicbrowser/unix/include/introwizard.h	Tue Aug 14 16:33:53 2001
+++ ./freeamp/ui/musicbrowser/unix/include/introwizard.h	Fri Apr 12 23:34:42 2002
@@ -73,6 +73,7 @@
     bool mbEnabled;
 
     GtkWidget *m_window;
+	FAContext *GetContext(void) { return m_context; }
     
  protected:
     FAContext *m_context;
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/include/missingfileui.h ./freeamp/ui/musicbrowser/unix/include/missingfileui.h
--- ../freeamp/ui/musicbrowser/unix/include/missingfileui.h	Fri May 12 02:29:08 2000
+++ ./freeamp/ui/musicbrowser/unix/include/missingfileui.h	Fri Apr 12 23:35:49 2002
@@ -41,7 +41,7 @@
     void SetFunc(int func);
     void EnableEntry(bool enable);
     void ChangeTextEntry(const char *text, bool set = false);
-
+	FAContext *GetContext(void) { return m_context; }
  protected:
     FAContext *m_context;
 
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/include/musicbrowserui.h ./freeamp/ui/musicbrowser/unix/include/musicbrowserui.h
--- ../freeamp/ui/musicbrowser/unix/include/musicbrowserui.h	Thu Apr 12 22:28:10 2001
+++ ./freeamp/ui/musicbrowser/unix/include/musicbrowserui.h	Sat Apr 13 00:01:23 2002
@@ -54,7 +54,7 @@
     void SearchClose(void);
     void WizardClose(void);
     void BitziLookup(const string &URL);
-
+	FAContext *GetContext(void) { return m_context; }
  protected:
     FAContext *m_context;
 
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/include/musicsearchui.h ./freeamp/ui/musicbrowser/unix/include/musicsearchui.h
--- ../freeamp/ui/musicbrowser/unix/include/musicsearchui.h	Wed May 24 13:08:34 2000
+++ ./freeamp/ui/musicbrowser/unix/include/musicsearchui.h	Fri Apr 12 23:25:08 2002
@@ -55,7 +55,7 @@
     bool searchInProgress;
     bool searchDone;
     bool done;
-
+	FAContext *GetContext(void) { return m_context; }
     GtkWidget *m_window;
  protected:
     FAContext *m_context;
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/src/browsermenu.cpp ./freeamp/ui/musicbrowser/unix/src/browsermenu.cpp
--- ../freeamp/ui/musicbrowser/unix/src/browsermenu.cpp	Mon Apr 16 21:51:14 2001
+++ ./freeamp/ui/musicbrowser/unix/src/browsermenu.cpp	Sat Apr 13 00:03:58 2002
@@ -46,7 +46,7 @@
 static void add_tool(GtkWidget *widget, GTKMusicBrowser *p)
 {
     p->SetClickState(kContextPlaylist);
-    FileSelector *filesel = new FileSelector("Add a Track");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Add a Track");
     filesel->SetExtended();
     if (filesel->Run()) {
         char *returnpath = filesel->GetReturnPath();
@@ -105,7 +105,7 @@
 
 static void import_tool(GtkWidget *w, GTKMusicBrowser *p)
 {
-    FileSelector *filesel = new FileSelector("Import a Track or Playlist into My Music");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Import a Track or Playlist into My Music");
     if (filesel->Run()) {
         FAContext *m_context = p->GetContext();
         char *returnpath = filesel->GetReturnPath();
@@ -177,7 +177,7 @@
 {
     p->SaveCurrentPlaylist();
 
-    FileSelector *filesel = new FileSelector("Open a Playlist from Disk");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Open a Playlist from Disk");
     if (filesel->Run())
         p->CreateNewEditor(filesel->GetReturnPath());
     delete filesel;
@@ -232,7 +232,7 @@
 
 static void export_list(GTKMusicBrowser *p, guint action, GtkWidget *w)
 {
-    FileSelector *filesel = new FileSelector("Export This Playlist to Disk");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Export This Playlist to Disk");
     if (filesel->Run())
         p->SaveCurrentPlaylist(filesel->GetReturnPath());
     delete filesel;
@@ -263,7 +263,7 @@
 
 static void add_track(GTKMusicBrowser *p, guint action, GtkWidget *w)
 {   
-    FileSelector *filesel = new FileSelector("Add a Track");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Add a Track");
     filesel->SetExtended();
     if (filesel->Run()) {
         char *filereturn = strdup_new(filesel->GetReturnPath());
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/src/fileselector.cpp ./freeamp/ui/musicbrowser/unix/src/fileselector.cpp
--- ../freeamp/ui/musicbrowser/unix/src/fileselector.cpp	Thu Sep 28 04:08:03 2000
+++ ./freeamp/ui/musicbrowser/unix/src/fileselector.cpp	Sat Apr 13 00:51:28 2002
@@ -24,6 +24,7 @@
 #include "config.h"
 
 #include <unistd.h>
+#include <dirent.h>
 
 #ifdef __QNX__
 #include <strings.h>
@@ -31,9 +32,13 @@
 
 #include "fileselector.h"
 #include "utility.h"
+#include "preferences.h"
 
-FileSelector::FileSelector(const char *windowtitle)
+char old_path[PATH_MAX]="/\0";
+
+FileSelector::FileSelector(FAContext *context,const char *windowtitle)
 {
+	m_context = context;
     title = windowtitle;
     returnpath = "";
     extended = true;
@@ -59,6 +64,34 @@
     p->CancelEvent();
 }
 
+string recursive_path(char subdirs[PATH_MAX], string returnpath,int *sub_rnum)
+{
+    DIR *dir=NULL;
+    struct dirent *current=NULL;
+    if ((dir = opendir(subdirs))!=NULL){
+        current = readdir(dir);
+        current = readdir(dir);
+        while((current=readdir(dir))!=NULL){
+            if(current->d_type==DT_DIR){
+		char temp_subdir[PATH_MAX];
+		strncpy(temp_subdir, subdirs,PATH_MAX);
+		strcat(temp_subdir,"/");
+		strncat(temp_subdir,current->d_name,FILENAME_MAX);
+		returnpath = recursive_path(temp_subdir,returnpath,sub_rnum);
+	    }
+	    else {
+    	    returnpath += "\n";
+	    returnpath += subdirs;
+	    returnpath += "/";
+	    returnpath += current->d_name;
+	    sub_rnum++;
+	    }
+	}
+    }
+    closedir(dir);
+    return (returnpath);
+}
+
 void FileSelector::CancelEvent()
 {
     gtk_widget_destroy(filesel);
@@ -72,6 +105,7 @@
     char *raw_path = NULL;
     GList *row = GTK_CLIST(gfile->file_list)->row_list;
     gint rownum = 0;
+    gint sub_rnum = 0;
     char *temp, *path_temp;
 
     char *rawtext = gtk_entry_get_text(GTK_ENTRY(gfile->selection_entry));
@@ -79,7 +113,6 @@
         !strncasecmp("rtp://", rawtext, 6)) {
         returnpath = strdup_new(rawtext);
         gtk_widget_destroy(GTK_WIDGET(gfile));
-
         ok = true;
         done = true;
 
@@ -88,33 +121,41 @@
 
     returnpath = gtk_file_selection_get_filename(gfile);
     path_temp = strdup(returnpath.c_str());
-
+    raw_path = 	gtk_entry_get_text(GTK_ENTRY(gfile->selection_entry));
     char *tempdir = strrchr(path_temp, '/');
+    strncpy(old_path,path_temp,PATH_MAX);
     if (!tempdir) {
         strcpy(path_temp, "./");
         path_temp = (char *)realloc(path_temp, strlen(path_temp) + 1);
     }
     else
         tempdir[0] = '\0';
-
-    raw_path = gtk_entry_get_text(GTK_ENTRY(gfile->selection_entry));
-    while (row) {
-        if (GTK_CLIST_ROW(row)->state == GTK_STATE_SELECTED) {
-            if (gtk_clist_get_cell_type(GTK_CLIST(gfile->file_list), rownum, 0)
-                == GTK_CELL_TEXT) {
-                gtk_clist_get_text(GTK_CLIST(gfile->file_list), rownum, 0, &temp);
-                if (!strcmp(temp, raw_path))
-                    goto next_iter;
-                returnpath += "\n";
-                returnpath += path_temp;
-                returnpath += "/";
-                returnpath += temp;
-            }
-        }
-    next_iter:
-        rownum++;
-        row = g_list_next(row);
+    if(row){
+	while (row) {
+    	    if (GTK_CLIST_ROW(row)->state == GTK_STATE_SELECTED) {
+        	if (gtk_clist_get_cell_type(GTK_CLIST(gfile->file_list), rownum, 0)
+            	    == GTK_CELL_TEXT) {
+            	    gtk_clist_get_text(GTK_CLIST(gfile->file_list), rownum, 0, &temp);
+		    if (!strcmp(temp, raw_path))
+                	goto next_iter;
+		    returnpath += "\n";
+            	    returnpath += path_temp;
+            	    returnpath += "/";
+            	    returnpath += temp;
+        	}
+    	    }
+	    next_iter:
+    	    rownum++;
+    	    row = g_list_next(row);
+	}
+    } 
+    else {
+	char subdirs[PATH_MAX];
+	strncpy(subdirs,old_path,PATH_MAX);
+	returnpath="";
+	returnpath = recursive_path(subdirs, returnpath,&sub_rnum);
     }
+    rownum += sub_rnum;
     gtk_widget_destroy(GTK_WIDGET(gfile));
     free(path_temp);
 
@@ -124,11 +165,14 @@
 
 bool FileSelector::Run(bool runMain)
 {
+    bool dummyBool;
     if (!runMain)
         gdk_threads_enter();
 
     filesel = gtk_file_selection_new(title.c_str());
-
+    m_context->prefs->GetPrefBoolean(kSetLastResumePref, &dummyBool);
+    if(dummyBool)
+		gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), old_path);
     gtk_window_set_modal(GTK_WINDOW(filesel), TRUE);
     gtk_signal_connect(GTK_OBJECT(filesel), "destroy",
                        GTK_SIGNAL_FUNC(filesel_destroy), (gpointer)runMain);
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/src/gtkmusicbrowser.cpp ./freeamp/ui/musicbrowser/unix/src/gtkmusicbrowser.cpp
--- ../freeamp/ui/musicbrowser/unix/src/gtkmusicbrowser.cpp	Mon Dec 10 15:41:54 2001
+++ ./freeamp/ui/musicbrowser/unix/src/gtkmusicbrowser.cpp	Fri Apr 12 23:59:49 2002
@@ -756,7 +756,7 @@
     bool playNow = true;
     m_context->prefs->GetPrefBoolean(kPlayImmediatelyPref, &playNow);
 
-    FileSelector *filesel = new FileSelector("Select a file to play");
+    FileSelector *filesel = new FileSelector(m_context,"Select a file to play");
     if (filesel->Run(false)) {
         char *returnpath = filesel->GetReturnPath();
         char *ext = m_context->player->GetExtension(returnpath);
@@ -1877,7 +1877,7 @@
             if (oBox.Show(oMessage.c_str(), "Save Confirmation", kMessageYesNo,
                           inMain) == kMessageReturnYes) {
 
-                FileSelector *filesel = new FileSelector("Save This Playlist to Disk");
+                FileSelector *filesel = new FileSelector(m_context,"Save This Playlist to Disk");
                 if (filesel->Run())
                     m_currentListName = filesel->GetReturnPath();
 
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/src/introwizard.cpp ./freeamp/ui/musicbrowser/unix/src/introwizard.cpp
--- ../freeamp/ui/musicbrowser/unix/src/introwizard.cpp	Tue Aug 14 16:33:53 2001
+++ ./freeamp/ui/musicbrowser/unix/src/introwizard.cpp	Fri Apr 12 23:33:52 2002
@@ -188,7 +188,7 @@
 
 static void search_browse(GtkWidget *w, IntroWizardUI *p)
 {
-    FileSelector *filesel = new FileSelector("Select a Directory to begin searching in..");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Select a Directory to begin searching in..");
     
     if (filesel->Run()) {
         char *filepath = filesel->GetReturnPath();
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/src/missingfileui.cpp ./freeamp/ui/musicbrowser/unix/src/missingfileui.cpp
--- ../freeamp/ui/musicbrowser/unix/src/missingfileui.cpp	Thu Oct 12 16:22:41 2000
+++ ./freeamp/ui/musicbrowser/unix/src/missingfileui.cpp	Fri Apr 12 23:35:51 2002
@@ -96,7 +96,7 @@
 
 static void browse_click(GtkWidget *w, MissingFileUI *p)
 {
-    FileSelector *filesel = new FileSelector("Browse to Missing File");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Browse to Missing File");
     if (filesel->Run()) {
         string filepath = filesel->GetReturnPath();
         struct stat st;
diff -urN -x corba -x CVS -x config.status -x configure -x config.h -x config.log -x Makefile* -x aclocal* -x config.cache ../freeamp/ui/musicbrowser/unix/src/musicsearch.cpp ./freeamp/ui/musicbrowser/unix/src/musicsearch.cpp
--- ../freeamp/ui/musicbrowser/unix/src/musicsearch.cpp	Wed Feb  7 12:13:42 2001
+++ ./freeamp/ui/musicbrowser/unix/src/musicsearch.cpp	Fri Apr 12 23:25:29 2002
@@ -114,7 +114,7 @@
 
 static void search_browse(GtkWidget *w, musicsearchUI *p)
 {
-    FileSelector *filesel = new FileSelector("Select a Directory to begin searching in..");
+    FileSelector *filesel = new FileSelector(p->GetContext(),"Select a Directory to begin searching in..");
     
     if (filesel->Run()) {
         char *filepath = filesel->GetReturnPath();

Reply via email to