Commit 81385dba authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add option to hide directories in cc_open.

parent 81e5d60a
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment