From 5ba898be2dc980923161092dc607ec89dc2d8655 Mon Sep 17 00:00:00 2001 From: Frederic Back Date: Wed, 27 Sep 2006 17:23:20 +0000 Subject: * removed obsolete TODO items * merged extension back from c_walker git-svn-id: file:///home/lennart/svn/public/fring/trunk@34 d0d2c35f-0a1e-0410-abeb-dabff30a67ee --- TODO | 11 ----------- src/extension/fringtools.cpp | 16 +++++++--------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/TODO b/TODO index e3da299..55f731d 100644 --- a/TODO +++ b/TODO @@ -19,14 +19,3 @@ TODO [ ] make sure that filenames are always visible [ ] do more magic adjustments [ ] clean gui -> renderer interface - -========================= PARSING / C-PORTAGE -[ ] port pure walking function to c or c++ - [ ] check if unsigned long is long enough - [ ] raise python errors (instead of returning None) - [ ] catch all possible errors - - [ ] enable threading while running c function (?) - currently, gtk is not responsive while walking the tree. - -[ ] walk remote directories (use gnomevfs?) diff --git a/src/extension/fringtools.cpp b/src/extension/fringtools.cpp index 9205816..88ec037 100644 --- a/src/extension/fringtools.cpp +++ b/src/extension/fringtools.cpp @@ -29,7 +29,7 @@ Instead of using SumList, the new build_tree will use a tuple */ /// recursive function to build a list system with directory information -PyObject* build_tree( std::string path, const bool& skipHidden) { +PyObject* build_tree( std::string path, const bool& showHidden) { PyObject* l = PyList_New(0); DIR* d = opendir(path.c_str()); if(d == 0) Py_RETURN_NONE; @@ -39,18 +39,16 @@ PyObject* build_tree( std::string path, const bool& skipHidden) { while((e = readdir(d)) != NULL) { std::string fn = e->d_name; - if(skipHidden) if(e->d_name[0] == '.') continue; + + if(!showHidden) if(e->d_name[0] == '.') continue; if(fn == "." || fn == "..") continue; fn = path+"/" +fn; struct stat s; lstat(fn.c_str(), &s); - if (s.st_size < 0) - std::cout << "alert2 " << path << ", " << total << std::endl << std::flush; - if(S_ISDIR(s.st_mode)) { - PyObject* sub = build_tree(fn,skipHidden); + PyObject* sub = build_tree(fn,showHidden); PyTuple_SetItem(sub,0,PyString_FromString(e->d_name)); PyList_Append(l, sub ); total += PyLong_AsUnsignedLong( PyTuple_GET_ITEM(sub,2) ); @@ -67,9 +65,9 @@ PyObject* build_tree( std::string path, const bool& skipHidden) { /// initial function call. static PyObject* fringtools_build_tree(PyObject *self, PyObject *args) { const char *path; - int skip_hidden = 1; - if (!PyArg_ParseTuple(args, "si", &path, &skip_hidden)) return NULL; - return build_tree(std::string(path),(skip_hidden==1)); + int show_hidden = 1; + if (!PyArg_ParseTuple(args, "si", &path, &show_hidden)) return NULL; + return build_tree(std::string(path),(show_hidden==1)); } //============================================================================== -- cgit