Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
eda1dcec
Commit
eda1dcec
authored
Feb 24, 2016
by
Sebastian Ramacher
Browse files
Split out fileinfo save
Signed-off-by:
Sebastian Ramacher
<
sebastian+dev@ramacher.at
>
parent
1c6d31a8
Changes
1
Show whitespace changes
Inline
Side-by-side
zathura/zathura.c
View file @
eda1dcec
...
...
@@ -1193,6 +1193,35 @@ remove_page_from_table(GtkWidget* page, gpointer UNUSED(permanent))
gtk_container_remove
(
GTK_CONTAINER
(
gtk_widget_get_parent
(
page
)),
page
);
}
static
void
save_fileinfo_to_db
(
zathura_t
*
zathura
)
{
const
char
*
path
=
zathura_document_get_path
(
zathura
->
document
);
zathura_fileinfo_t
file_info
=
{
.
current_page
=
zathura_document_get_current_page_number
(
zathura
->
document
),
.
page_offset
=
zathura_document_get_page_offset
(
zathura
->
document
),
.
scale
=
zathura_document_get_scale
(
zathura
->
document
),
.
rotation
=
zathura_document_get_rotation
(
zathura
->
document
),
.
pages_per_row
=
1
,
.
first_page_column_list
=
"1:2"
,
.
position_x
=
zathura_document_get_position_x
(
zathura
->
document
),
.
position_y
=
zathura_document_get_position_y
(
zathura
->
document
)
};
girara_setting_get
(
zathura
->
ui
.
session
,
"pages-per-row"
,
&
(
file_info
.
pages_per_row
));
girara_setting_get
(
zathura
->
ui
.
session
,
"first-page-column"
,
&
(
file_info
.
first_page_column_list
));
/* save file info */
zathura_db_set_fileinfo
(
zathura
->
database
,
path
,
&
file_info
);
/* save jumplist */
zathura_db_save_jumplist
(
zathura
->
database
,
path
,
zathura
->
jumplist
.
list
);
g_free
(
file_info
.
first_page_column_list
);
}
bool
document_close
(
zathura_t
*
zathura
,
bool
keep_monitor
)
{
...
...
@@ -1234,32 +1263,10 @@ document_close(zathura_t* zathura, bool keep_monitor)
}
/* store file information */
const
char
*
path
=
zathura_document_get_path
(
zathura
->
document
);
zathura_fileinfo_t
file_info
=
{
0
,
0
,
1
,
0
,
1
,
"1:2"
,
0
,
0
};
file_info
.
current_page
=
zathura_document_get_current_page_number
(
zathura
->
document
);
file_info
.
page_offset
=
zathura_document_get_page_offset
(
zathura
->
document
);
file_info
.
scale
=
zathura_document_get_scale
(
zathura
->
document
);
file_info
.
rotation
=
zathura_document_get_rotation
(
zathura
->
document
);
girara_setting_get
(
zathura
->
ui
.
session
,
"pages-per-row"
,
&
(
file_info
.
pages_per_row
));
girara_setting_get
(
zathura
->
ui
.
session
,
"first-page-column"
,
&
(
file_info
.
first_page_column_list
));
/* get position */
file_info
.
position_x
=
zathura_document_get_position_x
(
zathura
->
document
);
file_info
.
position_y
=
zathura_document_get_position_y
(
zathura
->
document
);
if
(
zathura
->
database
!=
NULL
)
{
/* save file info */
zathura_db_set_fileinfo
(
zathura
->
database
,
path
,
&
file_info
);
/* save jumplist */
zathura_db_save_jumplist
(
zathura
->
database
,
path
,
zathura
->
jumplist
.
list
);
save_fileinfo_to_db
(
zathura
);
}
/* free buffers */
g_free
(
file_info
.
first_page_column_list
);
girara_list_iterator_free
(
zathura
->
jumplist
.
cur
);
zathura
->
jumplist
.
cur
=
NULL
;
girara_list_free
(
zathura
->
jumplist
.
list
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment