mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-20 21:55:30 +01:00
Do not display recent files if there aren't any
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
5d490f6895
commit
7da7bcb4c1
2 changed files with 26 additions and 7 deletions
|
@ -2,11 +2,25 @@
|
||||||
#
|
#
|
||||||
# See LICENSE file for license and copyright information
|
# See LICENSE file for license and copyright information
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
import glob
|
||||||
|
import time
|
||||||
|
|
||||||
|
dirname = os.path.dirname(__file__)
|
||||||
|
files = glob.glob(os.path.join(dirname, '*.rst'))
|
||||||
|
files.extend(glob.glob(os.path.join(dirname, '*.txt')))
|
||||||
|
|
||||||
|
maxdate = 0
|
||||||
|
for path in files:
|
||||||
|
s = os.stat(path)
|
||||||
|
maxdate = max(maxdate, s.st_mtime)
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
source_suffix = '.rst'
|
source_suffix = '.rst'
|
||||||
master_doc = 'zathura.1'
|
master_doc = 'zathura.1'
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
|
today = time.strftime('%Y-%m-%d', time.gmtime(maxdate))
|
||||||
|
|
||||||
# -- Project configuration ------------------------------------------------
|
# -- Project configuration ------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -196,13 +196,18 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext, in
|
||||||
goto error_free;
|
goto error_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t path_len = strlen(path);
|
if (girara_list_size(recent_files) != 0) {
|
||||||
GIRARA_LIST_FOREACH(recent_files, const char*, iter, file)
|
const size_t path_len = strlen(path);
|
||||||
if (strncmp(path, file, path_len) == 0) {
|
GIRARA_LIST_FOREACH(recent_files, const char*, iter, file)
|
||||||
girara_completion_group_add_element(history_group, file, NULL);
|
if (strncmp(path, file, path_len) == 0) {
|
||||||
}
|
girara_completion_group_add_element(history_group, file, NULL);
|
||||||
GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file);
|
}
|
||||||
girara_list_free(recent_files);
|
GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file);
|
||||||
|
girara_list_free(recent_files);
|
||||||
|
} else {
|
||||||
|
girara_completion_group_free(history_group);
|
||||||
|
history_group = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(path);
|
g_free(path);
|
||||||
|
|
Loading…
Add table
Reference in a new issue