mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-14 21:56:01 +01:00
Add option to hide directories in cc_open.
This commit is contained in:
parent
81e5d60ad7
commit
81385dba21
2 changed files with 9 additions and 0 deletions
|
@ -45,6 +45,8 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
|
|||
|
||||
bool show_hidden = false;
|
||||
girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden);
|
||||
bool show_directories = true;
|
||||
girara_setting_get(zathura->ui.session, "show-directories", &show_directories);
|
||||
|
||||
/* read files */
|
||||
char* name = NULL;
|
||||
|
@ -74,6 +76,11 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
|
|||
char* full_path = g_strdup_printf("%s%s%s", current_path, tmp, e_name);
|
||||
|
||||
if (g_file_test(full_path, G_FILE_TEST_IS_DIR) == true) {
|
||||
if (show_directories == false) {
|
||||
g_free(e_name);
|
||||
g_free(full_path);
|
||||
continue;
|
||||
}
|
||||
char* tmp_path = full_path;
|
||||
full_path = g_strdup_printf("%s/", full_path);
|
||||
g_free(tmp_path);
|
||||
|
|
2
config.c
2
config.c
|
@ -94,6 +94,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_setting_add(gsession, "adjust-open", "best-fit", STRING, false, "Adjust to when opening file", NULL, NULL);
|
||||
bool_value = false;
|
||||
girara_setting_add(gsession, "show-hidden", &bool_value, BOOLEAN, false, "Show hidden files and directories", NULL, NULL);
|
||||
bool_value = true;
|
||||
girara_setting_add(gsession, "show-directories", &bool_value, BOOLEAN, false, "Show directories", NULL, NULL);
|
||||
|
||||
/* define default shortcuts */
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);
|
||||
|
|
Loading…
Reference in a new issue