the patch should work now.
with
cat fileselector_recursive-resume.patch | patch
--- ./fileselector.cpp Fri Mar 29 20:39:05 2002
+++ ./fileselector.cpp Fri Mar 29 20:38:38 2002
@@ -24,6 +24,7 @@
#include "config.h"
#include <unistd.h>
+#include <dirent.h>
#ifdef __QNX__
#include <strings.h>
@@ -32,6 +33,8 @@
#include "fileselector.h"
#include "utility.h"
+char old_path[1024]="/\0";
+
FileSelector::FileSelector(const char *windowtitle)
{
title = windowtitle;
@@ -59,6 +62,34 @@
p->CancelEvent();
}
+string recursive_path(char *subdirs, string returnpath,int *sub_rnum)
+{
+ int i;
+ DIR *dir;
+ struct dirent *current;
+ if ((dir = opendir(subdirs))!=NULL){
+ current = readdir(dir);
+ current = readdir(dir);
+ for(i=0;(current=readdir(dir))!=NULL;i++){
+ if(current->d_type==DT_DIR){
+ char *temp_subdir = new char[1024];
+ strcpy(temp_subdir, subdirs);
+ strcat(temp_subdir,current->d_name);
+ returnpath = recursive_path(temp_subdir,returnpath,sub_rnum);
+ delete [] temp_subdir;
+ }
+ else {
+ returnpath += "\n";
+ returnpath += subdirs;
+ returnpath += "/";
+ returnpath += current->d_name;
+ sub_rnum++;
+ }
+ }
+ }
+ return (returnpath);
+}
+
void FileSelector::CancelEvent()
{
gtk_widget_destroy(filesel);
@@ -72,6 +103,9 @@
char *raw_path = NULL;
GList *row = GTK_CLIST(gfile->file_list)->row_list;
gint rownum = 0;
+ gint sub_rnum = 0;
+ DIR *dir;
+ struct dirent *current;
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,42 @@
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, '/');
+ strcpy(old_path,path_temp);
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 = new char[1024];
+ strcpy(subdirs,old_path);
+ returnpath="";
+ returnpath = recursive_path(subdirs, returnpath,&sub_rnum);
+ delete [] subdirs;
}
+ rownum += sub_rnum;
gtk_widget_destroy(GTK_WIDGET(gfile));
free(path_temp);
@@ -128,7 +170,7 @@
gdk_threads_enter();
filesel = gtk_file_selection_new(title.c_str());
-
+ 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);