int sort_inode (file_entry_t * a, file_entry_t * b) { int ad = MY_ISDIR (a); int bd = MY_ISDIR (b); if (ad == bd || panels_options.mix_all_files) return (a->st.st_ino - b->st.st_ino) * reverse; else return bd - ad; }
int sort_vers (file_entry_t * a, file_entry_t * b) { int ad = MY_ISDIR (a); int bd = MY_ISDIR (b); if (ad == bd || panels_options.mix_all_files) { return str_verscmp (a->fname, b->fname) * reverse; } else { return bd - ad; } }
int sort_size (file_entry_t * a, file_entry_t * b) { int ad = MY_ISDIR (a); int bd = MY_ISDIR (b); int result = 0; if (ad != bd && !panels_options.mix_all_files) return bd - ad; result = a->st.st_size < b->st.st_size ? -1 : a->st.st_size > b->st.st_size; if (result != 0) return result * reverse; else return sort_name (a, b); }
int sort_atime (file_entry_t * a, file_entry_t * b) { int ad = MY_ISDIR (a); int bd = MY_ISDIR (b); if (ad == bd || panels_options.mix_all_files) { int result = a->st.st_atime < b->st.st_atime ? -1 : a->st.st_atime > b->st.st_atime; if (result != 0) return result * reverse; else return sort_name (a, b); } else return bd - ad; }
int sort_name (file_entry_t * a, file_entry_t * b) { int ad = MY_ISDIR (a); int bd = MY_ISDIR (b); if (ad == bd || panels_options.mix_all_files) { /* create key if does not exist, key will be freed after sorting */ if (a->sort_key == NULL) a->sort_key = str_create_key_for_filename (a->fname, case_sensitive); if (b->sort_key == NULL) b->sort_key = str_create_key_for_filename (b->fname, case_sensitive); return key_collate (a->sort_key, b->sort_key); } return bd - ad; }
int sort_ext (file_entry * a, file_entry * b) { int r; int ad = MY_ISDIR (a); int bd = MY_ISDIR (b); if (ad == bd || panels_options.mix_all_files) { if (a->second_sort_key == NULL) a->second_sort_key = str_create_key (extension (a->fname), case_sensitive); if (b->second_sort_key == NULL) b->second_sort_key = str_create_key (extension (b->fname), case_sensitive); r = str_key_collate (a->second_sort_key, b->second_sort_key, case_sensitive); if (r) return r * reverse; else return sort_name (a, b); } else return bd - ad; }