mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-14 17:53:47 +01:00
Add option to disable auto-generated bookmarks (closes #73)
Applying patch from Minoru with some modifications since we already have read_bookmarks_file.
This commit is contained in:
parent
7627aa1752
commit
205298bce7
@ -29,6 +29,7 @@ static const char DATA_DIR[] = "~/.local/share/zathura";
|
||||
/* bookmarks */
|
||||
static const char BM_PAGE_ENTRY[] = "page";
|
||||
static const char BM_PAGE_OFFSET[] = "offset";
|
||||
int save_position = 1;
|
||||
|
||||
/* look */
|
||||
char* font = "monospace normal 9";
|
||||
@ -248,6 +249,7 @@ Setting settings[] = {
|
||||
{"recolor", &(Zathura.Global.recolor), 'b', TRUE, FALSE, "Invert the image" },
|
||||
{"recolor_darkcolor", &(recolor_darkcolor), 's', FALSE, TRUE, "Recoloring (dark color)"},
|
||||
{"recolor_lightcolor", &(recolor_lightcolor), 's', FALSE, TRUE, "Recoloring (light color)"},
|
||||
{"save_position", &(save_position), 'b', FALSE, FALSE, "Save position in file on quit and restore it on open"},
|
||||
{"scroll_step", &(scroll_step), 'f', FALSE, FALSE, "Scroll step"},
|
||||
{"scroll_wrap", &(scroll_wrap), 'b', FALSE, FALSE, "Wrap scolling at last page"},
|
||||
{"scrollbars", &(show_scrollbars), 'b', FALSE, TRUE, "Show scrollbars"},
|
||||
|
19
zathura.c
19
zathura.c
@ -1043,13 +1043,16 @@ close_file(gboolean keep_monitor)
|
||||
{
|
||||
read_bookmarks_file();
|
||||
|
||||
/* set current page */
|
||||
g_key_file_set_integer(Zathura.Bookmarks.data, Zathura.PDF.file,
|
||||
BM_PAGE_ENTRY, Zathura.PDF.page_number);
|
||||
if(save_position)
|
||||
{
|
||||
/* set current page */
|
||||
g_key_file_set_integer(Zathura.Bookmarks.data, Zathura.PDF.file,
|
||||
BM_PAGE_ENTRY, Zathura.PDF.page_number);
|
||||
|
||||
/* set page offset */
|
||||
g_key_file_set_integer(Zathura.Bookmarks.data, Zathura.PDF.file,
|
||||
BM_PAGE_OFFSET, Zathura.PDF.page_offset);
|
||||
/* set page offset */
|
||||
g_key_file_set_integer(Zathura.Bookmarks.data, Zathura.PDF.file,
|
||||
BM_PAGE_OFFSET, Zathura.PDF.page_offset);
|
||||
}
|
||||
|
||||
/* save bookmarks */
|
||||
int i;
|
||||
@ -1365,11 +1368,11 @@ open_file(char* path, char* password)
|
||||
if(Zathura.Bookmarks.data && g_key_file_has_group(Zathura.Bookmarks.data, file))
|
||||
{
|
||||
/* get last opened page */
|
||||
if(g_key_file_has_key(Zathura.Bookmarks.data, file, BM_PAGE_ENTRY, NULL))
|
||||
if(save_position && g_key_file_has_key(Zathura.Bookmarks.data, file, BM_PAGE_ENTRY, NULL))
|
||||
start_page = g_key_file_get_integer(Zathura.Bookmarks.data, file, BM_PAGE_ENTRY, NULL);
|
||||
|
||||
/* get page offset */
|
||||
if(g_key_file_has_key(Zathura.Bookmarks.data, file, BM_PAGE_OFFSET, NULL))
|
||||
if(save_position && g_key_file_has_key(Zathura.Bookmarks.data, file, BM_PAGE_OFFSET, NULL))
|
||||
Zathura.PDF.page_offset = g_key_file_get_integer(Zathura.Bookmarks.data, file, BM_PAGE_OFFSET, NULL);
|
||||
if((Zathura.PDF.page_offset != 0) && (Zathura.PDF.page_offset != GOTO_OFFSET))
|
||||
Zathura.PDF.page_offset = GOTO_OFFSET;
|
||||
|
Loading…
Reference in New Issue
Block a user