From 509c70381ce8847866bb84ce398d074a749a6abf Mon Sep 17 00:00:00 2001 From: Vladimir Nadvornik Date: Sun, 4 May 2008 21:54:20 +0000 Subject: [PATCH] dropped path_list functions, use filelist functions everywhere --- src/bar_sort.c | 18 ++--- src/cache_maint.c | 158 +++++++++++++++++++++++--------------------- src/collect-io.c | 21 +++--- src/collect-table.c | 2 +- src/filelist.c | 95 -------------------------- src/filelist.h | 5 -- src/info.c | 2 +- src/main.c | 36 +++++----- src/ui_fileops.c | 97 +-------------------------- src/ui_fileops.h | 5 -- src/ui_pathsel.c | 10 +-- 11 files changed, 126 insertions(+), 323 deletions(-) diff --git a/src/bar_sort.c b/src/bar_sort.c index 9ea31f34..d4a37ea5 100644 --- a/src/bar_sort.c +++ b/src/bar_sort.c @@ -95,33 +95,33 @@ static void bar_sort_collection_list_build(GtkWidget *bookmarks) bookmark_list_set_key(bookmarks, SORT_KEY_COLLECTIONS); collect_path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL); - path_list(collect_path, &list, NULL); + filelist_read(collect_path, &list, NULL); g_free(collect_path); - list = path_list_sort(list); + list = filelist_sort_path(list); work = list; while (work) { - const gchar *path; + FileData *fd; gchar *name; - path = work->data; + fd = work->data; work = work->next; - if (file_extension_match(path, ".gqv")) + if (file_extension_match(fd->path, ".gqv")) { - name = remove_extension_from_path(filename_from_path(path)); + name = remove_extension_from_path(fd->name); } else { - name = g_strdup(filename_from_path(path)); + name = g_strdup(fd->name); } - bookmark_list_add(bookmarks, name, path); + bookmark_list_add(bookmarks, name, fd->path); g_free(name); } - string_list_free(list); + filelist_free(list); } static void bar_sort_mode_sync(SortData *sd, SortModeType mode) diff --git a/src/cache_maint.c b/src/cache_maint.c index 34f4627e..dff3e414 100644 --- a/src/cache_maint.c +++ b/src/cache_maint.c @@ -111,7 +111,7 @@ static void cache_maintain_home_close(CMData *cm) { if (cm->idle_id != -1) g_source_remove(cm->idle_id); if (cm->gd) generic_dialog_close(cm->gd); - path_list_free(cm->list); + filelist_free(cm->list); g_list_free(cm->done_list); g_free(cm); } @@ -136,7 +136,7 @@ static gint cache_maintain_home_cb(gpointer data) CMData *cm = data; GList *dlist = NULL; GList *list = NULL; - gchar *path; + FileData *fd; gint just_done = FALSE; gint still_have_a_file = TRUE; gint base_length; @@ -161,15 +161,15 @@ static gint cache_maintain_home_cb(gpointer data) return FALSE; } - path = cm->list->data; + fd = cm->list->data; - DEBUG_1("purge chk (%d) \"%s\"", (cm->clear && !cm->metadata), path); + DEBUG_1("purge chk (%d) \"%s\"", (cm->clear && !cm->metadata), fd->path); - if (g_list_find(cm->done_list, path) == NULL) + if (g_list_find(cm->done_list, fd) == NULL) { - cm->done_list = g_list_prepend(cm->done_list, path); + cm->done_list = g_list_prepend(cm->done_list, fd); - if (path_list(path, &list, &dlist)) + if (filelist_read(fd->path, &list, &dlist)) { GList *work; @@ -179,7 +179,8 @@ static gint cache_maintain_home_cb(gpointer data) work = list; while (work) { - gchar *path_buf = work->data; + FileData *fd_list = work->data; + gchar *path_buf = strdup(fd_list->path); gchar *dot; dot = extension_find_dot(path_buf); @@ -195,11 +196,12 @@ static gint cache_maintain_home_cb(gpointer data) { still_have_a_file = TRUE; } + g_free(path_buf); work = work->next; } } } - path_list_free(list); + filelist_free(list); cm->list = g_list_concat(dlist, cm->list); @@ -207,36 +209,36 @@ static gint cache_maintain_home_cb(gpointer data) { /* check if the dir is empty */ - if (cm->list->data == path && just_done) + if (cm->list->data == fd && just_done) { - if (!still_have_a_file && !dlist && cm->list->next && !rmdir_utf8(path)) + if (!still_have_a_file && !dlist && cm->list->next && !rmdir_utf8(fd->path)) { - printf("Unable to delete dir: %s\n", path); + printf("Unable to delete dir: %s\n", fd->path); } } else { /* must re-check for an empty dir */ - if (isempty(path) && cm->list->next && !rmdir_utf8(path)) + if (isempty(fd->path) && cm->list->next && !rmdir_utf8(fd->path)) { - printf("Unable to delete dir: %s\n", path); + printf("Unable to delete dir: %s\n", fd->path); } } - path = cm->list->data; - cm->done_list = g_list_remove(cm->done_list, path); - cm->list = g_list_remove(cm->list, path); - g_free(path); + fd = cm->list->data; + cm->done_list = g_list_remove(cm->done_list, fd); + cm->list = g_list_remove(cm->list, fd); + file_data_unref(fd); } if (cm->list) { const gchar *buf; - path = cm->list->data; - if (strlen(path) > base_length) + fd = cm->list->data; + if (strlen(fd->path) > base_length) { - buf = path + base_length; + buf = fd->path + base_length; } else { @@ -285,13 +287,13 @@ void cache_maintain_home(gint metadata, gint clear, GtkWidget *parent) base = g_strconcat(homedir(), "/", cache_folder, NULL); - if (!path_list(base, NULL, &dlist)) + if (!filelist_read(base, NULL, &dlist)) { g_free(base); return; } - dlist = g_list_append(dlist, base); + dlist = g_list_append(dlist, file_data_new_simple(base)); cm = g_new0(CMData, 1); cm->list = dlist; @@ -362,21 +364,21 @@ gint cache_maintain_home_dir(const gchar *dir, gint recursive, gint clear) base_length = strlen(homedir()) + strlen("/") + strlen(GQ_CACHE_RC_THUMB); base = g_strconcat(homedir(), "/", GQ_CACHE_RC_THUMB, dir, NULL); - if (path_list(base, &flist, &dlist)) + if (filelist_read(base, &flist, &dlist)) { GList *work; work = dlist; while (work) { - gchar *path = work->data; - if (recursive && strlen(path) > base_length && - !cache_maintain_home_dir(path + base_length, recursive, clear)) + FileData *fd = work->data; + if (recursive && strlen(fd->path) > base_length && + !cache_maintain_home_dir(fd->path + base_length, recursive, clear)) { - DEBUG_1("Deleting thumb dir: %s", path); - if (!rmdir_utf8(path)) + DEBUG_1("Deleting thumb dir: %s", fd->path); + if (!rmdir_utf8(fd->path)) { - printf("Unable to delete dir: %s\n", path); + printf("Unable to delete dir: %s\n", fd->path); } } else @@ -389,7 +391,8 @@ gint cache_maintain_home_dir(const gchar *dir, gint recursive, gint clear) work = flist; while (work) { - gchar *path = work->data; + FileData *fd = work->data; + gchar *path = g_strdup(fd->path); gchar *dot; dot = extension_find_dot(path); @@ -405,13 +408,14 @@ gint cache_maintain_home_dir(const gchar *dir, gint recursive, gint clear) { still_have_a_file = TRUE; } + g_free(path); work = work->next; } } - path_list_free(dlist); - path_list_free(flist); + filelist_free(dlist); + filelist_free(flist); g_free(base); return still_have_a_file; @@ -429,18 +433,18 @@ gint cache_maintain_dir(const gchar *dir, gint recursive, gint clear) cachedir = g_strconcat(dir, "/", GQ_CACHE_LOCAL_THUMB, NULL); - path_list(cachedir, &list, NULL); + filelist_read(cachedir, &list, NULL); work = list; while (work) { - const gchar *path; + FileData *fd; gchar *source; - path = work->data; + fd = work->data; work = work->next; - source = g_strconcat(dir, "/", filename_from_path(path), NULL); + source = g_strconcat(dir, "/", fd->name, NULL); if (clear || extension_truncate(source, GQ_CACHE_EXT_THUMB) || @@ -452,9 +456,9 @@ gint cache_maintain_dir(const gchar *dir, gint recursive, gint clear) } else { - if (!unlink_file(path)) + if (!unlink_file(fd->path)) { - DEBUG_1("Failed to remove cache file %s", path); + DEBUG_1("Failed to remove cache file %s", fd->path); still_have_a_file = TRUE; } } @@ -466,24 +470,24 @@ gint cache_maintain_dir(const gchar *dir, gint recursive, gint clear) g_free(source); } - path_list_free(list); + filelist_free(list); g_free(cachedir); if (recursive) { list = NULL; - path_list(dir, NULL, &list); + filelist_read(dir, NULL, &list); work = list; while (work) { - const gchar *path = work->data; + FileData *fd = work->data; work = work->next; - still_have_a_file |= cache_maintain_dir(path, recursive, clear); + still_have_a_file |= cache_maintain_dir(fd->path, recursive, clear); } - path_list_free(list); + filelist_free(list); } return still_have_a_file; @@ -657,10 +661,10 @@ struct _CleanData static void cache_manager_render_reset(CleanData *cd) { - path_list_free(cd->list); + filelist_free(cd->list); cd->list = NULL; - path_list_free(cd->list_dir); + filelist_free(cd->list_dir); cd->list_dir = NULL; thumb_loader_free((ThumbLoader *)cd->tl); @@ -705,15 +709,15 @@ static void cache_manager_render_folder(CleanData *cd, const gchar *path) if (cd->recurse) { - path_list(path, &list_f, &list_d); + filelist_read(path, &list_f, &list_d); } else { - path_list(path, &list_f, NULL); + filelist_read(path, &list_f, NULL); } - list_f = path_list_filter(list_f, FALSE); - list_d = path_list_filter(list_d, TRUE); + list_f = filelist_filter(list_f, FALSE); + list_d = filelist_filter(list_d, TRUE); cd->list = g_list_concat(list_f, cd->list); cd->list_dir = g_list_concat(list_d, cd->list_dir); @@ -735,11 +739,11 @@ static gint cache_manager_render_file(CleanData *cd) { if (cd->list) { - gchar *path; + FileData *fd; gint success; - path = cd->list->data; - cd->list = g_list_remove(cd->list, path); + fd = cd->list->data; + cd->list = g_list_remove(cd->list, fd); cd->tl = (ThumbLoaderStd *)thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height); thumb_loader_set_callbacks((ThumbLoader *)cd->tl, @@ -747,10 +751,10 @@ static gint cache_manager_render_file(CleanData *cd) cache_manager_render_thumb_done_cb, NULL, cd); thumb_loader_set_cache((ThumbLoader *)cd->tl, TRUE, cd->local, TRUE); - success = thumb_loader_start((ThumbLoader *)cd->tl, path); + success = thumb_loader_start((ThumbLoader *)cd->tl, fd->path); if (success) { - gtk_entry_set_text(GTK_ENTRY(cd->progress), path); + gtk_entry_set_text(GTK_ENTRY(cd->progress), fd->path); } else { @@ -758,20 +762,20 @@ static gint cache_manager_render_file(CleanData *cd) cd->tl = NULL; } - g_free(path); + file_data_unref(fd); return (!success); } else if (cd->list_dir) { - gchar *path; + FileData *fd; - path = cd->list_dir->data; - cd->list_dir = g_list_remove(cd->list_dir, path); + fd = cd->list_dir->data; + cd->list_dir = g_list_remove(cd->list_dir, fd); - cache_manager_render_folder(cd, path); + cache_manager_render_folder(cd, fd->path); - g_free(path); + file_data_unref(fd); return TRUE; } @@ -885,7 +889,7 @@ static void cache_manager_standard_clean_close_cb(GenericDialog *gd, gpointer da generic_dialog_close(cd->gd); thumb_loader_std_thumb_file_validate_cancel(cd->tl); - path_list_free(cd->list); + filelist_free(cd->list); g_free(cd); } @@ -906,7 +910,7 @@ static void cache_manager_standard_clean_done(CleanData *cd) thumb_loader_std_thumb_file_validate_cancel(cd->tl); cd->tl = NULL; - path_list_free(cd->list); + filelist_free(cd->list); cd->list = NULL; } @@ -923,15 +927,15 @@ static gint cache_manager_standard_clean_clear_cb(gpointer data) if (cd->list) { - gchar *next_path; + FileData *next_fd; - next_path = cd->list->data; - cd->list = g_list_remove(cd->list, next_path); + next_fd = cd->list->data; + cd->list = g_list_remove(cd->list, next_fd); - DEBUG_1("thumb removed: %s", next_path); + DEBUG_1("thumb removed: %s", next_fd->path); - unlink_file(next_path); - g_free(next_path); + unlink_file(next_fd->path); + file_data_unref(next_fd); cd->count_done++; if (cd->count_total != 0) @@ -971,14 +975,14 @@ static void cache_manager_standard_clean_valid_cb(const gchar *path, gint valid, cd->tl = NULL; if (cd->list) { - gchar *next_path; + FileData *next_fd; - next_path = cd->list->data; - cd->list = g_list_remove(cd->list, next_path); + next_fd = cd->list->data; + cd->list = g_list_remove(cd->list, next_fd); - cd->tl = thumb_loader_std_thumb_file_validate(next_path, cd->days, + cd->tl = thumb_loader_std_thumb_file_validate(next_fd->path, cd->days, cache_manager_standard_clean_valid_cb, cd); - g_free(next_path); + file_data_unref(next_fd); } else { @@ -1002,19 +1006,19 @@ static void cache_manager_standard_clean_start_cb(GenericDialog *gd, gpointer da path = g_strconcat(homedir(), "/", THUMB_FOLDER_GLOBAL, "/", THUMB_FOLDER_NORMAL, NULL); list = NULL; - path_list(path, &list, NULL); + filelist_read(path, &list, NULL); cd->list = list; g_free(path); path = g_strconcat(homedir(), "/", THUMB_FOLDER_GLOBAL, "/", THUMB_FOLDER_LARGE, NULL); list = NULL; - path_list(path, &list, NULL); + filelist_read(path, &list, NULL); cd->list = g_list_concat(cd->list, list); g_free(path); path = g_strconcat(homedir(), "/", THUMB_FOLDER_GLOBAL, "/", THUMB_FOLDER_FAIL, NULL); list = NULL; - path_list(path, &list, NULL); + filelist_read(path, &list, NULL); cd->list = g_list_concat(cd->list, list); g_free(path); diff --git a/src/collect-io.c b/src/collect-io.c index 376f86e7..c61be6ae 100644 --- a/src/collect-io.c +++ b/src/collect-io.c @@ -671,7 +671,7 @@ static void collect_manager_refresh(void) gchar *base; base = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL); - path_list(base, &list, NULL); + filelist_read(base, &list, NULL); g_free(base); work = collection_manager_entry_list; @@ -686,15 +686,15 @@ static void collect_manager_refresh(void) list_step = list; while (list_step && entry) { - gchar *path; + FileData *fd; - path = list_step->data; + fd = list_step->data; list_step = list_step->next; - if (strcmp(path, entry->path) == 0) + if (strcmp(fd->path, entry->path) == 0) { - list = g_list_remove(list, path); - g_free(path); + list = g_list_remove(list, fd); + file_data_unref(fd); entry = NULL; } @@ -708,16 +708,15 @@ static void collect_manager_refresh(void) work = list; while (work) { - gchar *path; + FileData *fd; - path = work->data; + fd = work->data; work = work->next; - collect_manager_entry_new(path); - g_free(path); + collect_manager_entry_new(fd->path); } - g_list_free(list); + filelist_free(list); } static void collect_manager_process_actions(gint max) diff --git a/src/collect-table.c b/src/collect-table.c index 643c08c7..2f37c1e0 100644 --- a/src/collect-table.c +++ b/src/collect-table.c @@ -758,7 +758,7 @@ static void collection_table_popup_destroy_cb(GtkWidget *widget, gpointer data) ct->click_info = NULL; ct->popup = NULL; - path_list_free(ct->drop_list); + filelist_free(ct->drop_list); ct->drop_list = NULL; ct->drop_info = NULL; } diff --git a/src/filelist.c b/src/filelist.c index 43151656..f4e39888 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -426,41 +426,6 @@ void filter_parse(const gchar *text) g_free(desc); } -GList *path_list_filter(GList *list, gint is_dir_list) -{ - GList *work; - - if (!is_dir_list && options->file_filter.disable && options->file_filter.show_hidden_files) return list; - - work = list; - while (work) - { - gchar *name = work->data; - const gchar *base; - - base = filename_from_path(name); - - if ((!options->file_filter.show_hidden_files && ishidden(base)) || - (!is_dir_list && !filter_name_exists(base)) || - (is_dir_list && base[0] == '.' && (strcmp(base, GQ_CACHE_LOCAL_THUMB) == 0 || - strcmp(base, GQ_CACHE_LOCAL_METADATA) == 0)) ) - { - GList *link = work; - work = work->next; - list = g_list_remove_link(list, link); - g_free(name); - g_list_free(link); - } - else - { - work = work->next; - } - } - - return list; -} - - /* *----------------------------------------------------------------------------- * sidecar extension list @@ -525,66 +490,6 @@ void sidecar_ext_add_defaults() sidecar_ext_parse(".jpg;.cr2;.nef;.crw;.xmp", FALSE); } -/* - *----------------------------------------------------------------------------- - * path list recursive - *----------------------------------------------------------------------------- - */ - -static gint path_list_sort_cb(gconstpointer a, gconstpointer b) -{ - return CASE_SORT((gchar *)a, (gchar *)b); -} - -GList *path_list_sort(GList *list) -{ - return g_list_sort(list, path_list_sort_cb); -} - -static void path_list_recursive_append(GList **list, GList *dirs) -{ - GList *work; - - work = dirs; - while (work) - { - const gchar *path = work->data; - GList *f = NULL; - GList *d = NULL; - - if (path_list(path, &f, &d)) - { - f = path_list_filter(f, FALSE); - f = path_list_sort(f); - *list = g_list_concat(*list, f); - - d = path_list_filter(d, TRUE); - d = path_list_sort(d); - path_list_recursive_append(list, d); - path_list_free(d); - } - - work = work->next; - } -} - -GList *path_list_recursive(const gchar *path) -{ - GList *list = NULL; - GList *d = NULL; - - if (!path_list(path, &list, &d)) return NULL; - list = path_list_filter(list, FALSE); - list = path_list_sort(list); - - d = path_list_filter(d, TRUE); - d = path_list_sort(d); - path_list_recursive_append(&list, d); - path_list_free(d); - - return list; -} - /* *----------------------------------------------------------------------------- * text conversion utils diff --git a/src/filelist.h b/src/filelist.h index e29f1c56..eb713fa0 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -49,11 +49,6 @@ void sidecar_ext_add_defaults(); gint ishidden(const gchar *name); -GList *path_list_filter(GList *list, gint is_dir_list); - -GList *path_list_sort(GList *list); -GList *path_list_recursive(const gchar *path); - gchar *text_from_size(gint64 size); gchar *text_from_size_abrev(gint64 size); const gchar *text_from_time(time_t t); diff --git a/src/info.c b/src/info.c index 3c1a24c6..24b16e3a 100644 --- a/src/info.c +++ b/src/info.c @@ -168,7 +168,7 @@ static GList *info_tab_meta_list_cb(gpointer data) { InfoData *id = data; - return path_list_copy(id->list); + return filelist_copy(id->list); } static TabData *info_tab_meta_new(InfoData *id) diff --git a/src/main.c b/src/main.c index 38ce586b..9c047f7d 100644 --- a/src/main.c +++ b/src/main.c @@ -369,7 +369,7 @@ static void gr_slideshow_start_rec(const gchar *text, gpointer data) { GList *list; - list = path_list_recursive(text); + list = filelist_recursive(text); if (!list) return; //printf("length: %d\n", g_list_length(list)); layout_image_slideshow_stop(NULL); @@ -751,13 +751,13 @@ static void remote_control(const gchar *arg_exec, GList *remote_list, const gcha work = cmd_list; while (work) { - const gchar *name; + FileData *fd; gchar *text; - name = work->data; + fd = work->data; work = work->next; - text = g_strconcat(prefix, name, NULL); + text = g_strconcat(prefix, fd->path, NULL); remote_client_send(rc, text); g_free(text); @@ -832,7 +832,7 @@ static void parse_command_line_add_file(const gchar *file_path, gchar **path, gc { if (!*path) *path = remove_level_from_path(path_parsed); if (!*file) *file = g_strdup(path_parsed); - *list = g_list_prepend(*list, path_parsed); + *list = g_list_prepend(*list, file_data_new_simple(path_parsed)); } } @@ -845,22 +845,20 @@ static void parse_command_line_add_dir(const gchar *dir, gchar **path, gchar **f path_parsed = g_strdup(dir); parse_out_relatives(path_parsed); - if (path_list(path_parsed, &files, NULL)) + if (filelist_read(path_parsed, &files, NULL)) { GList *work; - files = path_list_filter(files, FALSE); - files = path_list_sort(files); + files = filelist_filter(files, FALSE); + files = filelist_sort_path(files); work = files; while (work) { - gchar *p; - - p = work->data; - if (!*path) *path = remove_level_from_path(p); - if (!*file) *file = g_strdup(p); - *list = g_list_prepend(*list, p); + FileData *fd = work->data; + if (!*path) *path = remove_level_from_path(fd->path); + if (!*file) *file = g_strdup(fd->path); + *list = g_list_prepend(*list, fd); work = work->next; } @@ -1074,7 +1072,7 @@ static void parse_command_line(int argc, char *argv[], gchar **path, gchar **fil } else { - path_list_free(list); + filelist_free(list); *cmd_list = NULL; } } @@ -1374,9 +1372,9 @@ int main (int argc, char *argv[]) cmd_path = NULL; g_free(cmd_file); cmd_file = NULL; - path_list_free(cmd_list); + filelist_free(cmd_list); cmd_list = NULL; - path_list_free(collection_list); + string_list_free(collection_list); collection_list = NULL; path = NULL; @@ -1485,8 +1483,8 @@ int main (int argc, char *argv[]) g_free(geometry); g_free(cmd_path); g_free(cmd_file); - path_list_free(cmd_list); - path_list_free(collection_list); + filelist_free(cmd_list); + string_list_free(collection_list); g_free(path); if (startup_full_screen) layout_image_full_screen_start(lw); diff --git a/src/ui_fileops.c b/src/ui_fileops.c index 8dd43e8b..c8efc5f0 100644 --- a/src/ui_fileops.c +++ b/src/ui_fileops.c @@ -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; diff --git a/src/ui_fileops.h b/src/ui_fileops.h index f8acd25a..840dbe00 100644 --- a/src/ui_fileops.h +++ b/src/ui_fileops.h @@ -58,13 +58,8 @@ gchar *get_current_dir(void); /* return True on success, it is up to you to free * the lists with string_list_free() */ -gint path_list(const gchar *path, GList **files, GList **dirs); -gint path_list_lstat(const gchar *path, GList **files, GList **dirs); void string_list_free(GList *list); -#define path_list_free string_list_free GList *string_list_copy(GList *list); -#define path_list_copy string_list_copy - gchar *unique_filename(const gchar *path, const gchar *ext, const gchar *divider, gint pad); gchar *unique_filename_simple(const gchar *path); diff --git a/src/ui_pathsel.c b/src/ui_pathsel.c index a03e2be3..cf7a1674 100644 --- a/src/ui_pathsel.c +++ b/src/ui_pathsel.c @@ -240,7 +240,7 @@ static void dest_populate(Dest_Data *dd, const gchar *path) list = list->next; } - path_list_free(path_list); + string_list_free(path_list); if (dd->f_view) @@ -264,7 +264,7 @@ static void dest_populate(Dest_Data *dd, const gchar *path) list = list->next; } - path_list_free(file_list); + string_list_free(file_list); } g_free(dd->path); @@ -355,7 +355,7 @@ static void dest_dnd_set_data(GtkWidget *view, break; } - path_list_free(list); + string_list_free(list); if (!uri_text) return; @@ -970,10 +970,10 @@ static void dest_filter_add(Dest_Data *dd, const gchar *filter, const gchar *des static void dest_filter_clear(Dest_Data *dd) { - path_list_free(dd->filter_list); + string_list_free(dd->filter_list); dd->filter_list = NULL; - path_list_free(dd->filter_text_list); + string_list_free(dd->filter_text_list); dd->filter_text_list = NULL; dest_filter_add(dd, "*", _("All Files"), TRUE); -- 2.20.1