dropped path_list functions, use filelist functions everywhere
[geeqie.git] / src / ui_fileops.c
index 8dd43e8..c8efc5f 100644 (file)
@@ -505,106 +505,13 @@ gchar *get_current_dir(void)
        return path8;
 }
 
-static gint path_list_real(const gchar *path, GList **files, GList **dirs,
-                          gint follow_links)
-{
-       DIR *dp;
-       struct dirent *dir;
-       GList *f_list = NULL;
-       GList *d_list = NULL;
-       gchar *pathl;
-
-       if (!path) return FALSE;
-
-       pathl = path_from_utf8(path);
-       dp = opendir(pathl);
-       if (!dp)
-               {
-               /* dir not found */
-               g_free(pathl);
-               return FALSE;
-               }
-
-       /* root dir fix */
-       if (pathl[0] == '/' && pathl[1] == '\0')
-               {
-               g_free(pathl);
-               pathl = g_strdup("");
-               }
-
-       while ((dir = readdir(dp)) != NULL)
-               {
-               struct stat st_buf;
-               gchar *name;
-               gchar *filepath;
-               gint result;
-
-               name = dir->d_name;
-               filepath = g_strconcat(pathl, "/", name, NULL);
-
-               if (follow_links)
-                       {
-                       result = stat(filepath, &st_buf);
-                       }
-               else
-                       {
-                       result = lstat(filepath, &st_buf);
-                       }
-
-               if (result == 0)
-                       {
-                       gchar *path8;
-                       gchar *name8;
-
-                       name8 = path_to_utf8(name);
-                       path8 = g_strconcat(path, "/", name8, NULL);
-                       g_free(name8);
-
-                       if (dirs && S_ISDIR(st_buf.st_mode) &&
-                           !(name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))) )
-                               {
-                               d_list = g_list_prepend(d_list, path8);
-                               path8 = NULL;
-                               }
-                       else if (files &&
-                                (S_ISREG(st_buf.st_mode) || (!follow_links && S_ISLNK(st_buf.st_mode))) )
-                               {
-                               f_list = g_list_prepend(f_list, path8);
-                               path8 = NULL;
-                               }
-                       g_free(path8);
-                       }
-
-               g_free(filepath);
-               }
-
-       closedir(dp);
-
-       g_free(pathl);
-
-       if (dirs) *dirs = g_list_reverse(d_list);
-       if (files) *files = g_list_reverse(f_list);
-
-       return TRUE;
-}
-
-gint path_list(const gchar *path, GList **files, GList **dirs)
-{
-       return path_list_real(path, files, dirs, TRUE);
-}
-
-gint path_list_lstat(const gchar *path, GList **files, GList **dirs)
-{
-       return path_list_real(path, files, dirs, FALSE);
-}
-
-void path_list_free(GList *list)
+void string_list_free(GList *list)
 {
        g_list_foreach(list, (GFunc)g_free, NULL);
        g_list_free(list);
 }
 
-GList *path_list_copy(GList *list)
+GList *string_list_copy(GList *list)
 {
        GList *new_list = NULL;
        GList *work;