mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 08:06:00 +01:00
Update style
This commit is contained in:
parent
7db78012de
commit
394fbd934d
2 changed files with 14 additions and 10 deletions
20
bookmarks.c
20
bookmarks.c
|
@ -32,8 +32,9 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
|
||||||
bookmark->id = g_strdup(id);
|
bookmark->id = g_strdup(id);
|
||||||
bookmark->page = page;
|
bookmark->page = page;
|
||||||
girara_list_append(zathura->bookmarks.bookmarks, bookmark);
|
girara_list_append(zathura->bookmarks.bookmarks, bookmark);
|
||||||
if (zathura->database) {
|
|
||||||
if (!zathura_db_add_bookmark(zathura->database, zathura->document->file_path, bookmark)) {
|
if (zathura->database != NULL) {
|
||||||
|
if (zathura_db_add_bookmark(zathura->database, zathura->document->file_path, bookmark) == false) {
|
||||||
girara_warning("Failed to add bookmark to database.");
|
girara_warning("Failed to add bookmark to database.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,15 +49,16 @@ zathura_bookmark_remove(zathura_t* zathura, const gchar* id)
|
||||||
g_return_val_if_fail(id, false);
|
g_return_val_if_fail(id, false);
|
||||||
|
|
||||||
zathura_bookmark_t* bookmark = zathura_bookmark_get(zathura, id);
|
zathura_bookmark_t* bookmark = zathura_bookmark_get(zathura, id);
|
||||||
if (!bookmark) {
|
if (bookmark == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zathura->database) {
|
if (zathura->database != NULL) {
|
||||||
if (!zathura_db_remove_bookmark(zathura->database, zathura->document->file_path, bookmark->id)) {
|
if (zathura_db_remove_bookmark(zathura->database, zathura->document->file_path, bookmark->id) == false) {
|
||||||
girara_warning("Failed to remove bookmark from database.");
|
girara_warning("Failed to remove bookmark from database.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
girara_list_remove(zathura->bookmarks.bookmarks, bookmark);
|
girara_list_remove(zathura->bookmarks.bookmarks, bookmark);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -74,7 +76,7 @@ zathura_bookmark_get(zathura_t* zathura, const gchar* id)
|
||||||
void
|
void
|
||||||
zathura_bookmark_free(zathura_bookmark_t* bookmark)
|
zathura_bookmark_free(zathura_bookmark_t* bookmark)
|
||||||
{
|
{
|
||||||
if (!bookmark) {
|
if (bookmark == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,17 +88,19 @@ bool
|
||||||
zathura_bookmarks_load(zathura_t* zathura, const gchar* file) {
|
zathura_bookmarks_load(zathura_t* zathura, const gchar* file) {
|
||||||
g_return_val_if_fail(zathura, false);
|
g_return_val_if_fail(zathura, false);
|
||||||
g_return_val_if_fail(file, false);
|
g_return_val_if_fail(file, false);
|
||||||
|
|
||||||
if (zathura->database == NULL) {
|
if (zathura->database == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
girara_list_t* bookmarks = zathura_db_load_bookmarks(zathura->database, file);
|
girara_list_t* bookmarks = zathura_db_load_bookmarks(zathura->database, file);
|
||||||
if (!bookmarks) {
|
if (bookmarks == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
girara_list_free(zathura->bookmarks.bookmarks);
|
girara_list_free(zathura->bookmarks.bookmarks);
|
||||||
zathura->bookmarks.bookmarks = bookmarks;
|
zathura->bookmarks.bookmarks = bookmarks;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +110,11 @@ zathura_bookmarks_compare(zathura_bookmark_t* lhs, zathura_bookmark_t* rhs)
|
||||||
if (lhs == NULL && rhs == NULL) {
|
if (lhs == NULL && rhs == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lhs == NULL) {
|
if (lhs == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rhs == NULL) {
|
if (rhs == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,9 +431,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bookmarks */
|
/* bookmarks */
|
||||||
if (zathura_bookmarks_load(zathura, zathura->document->file_path) == false) {
|
zathura_bookmarks_load(zathura, zathura->document->file_path);
|
||||||
girara_warning("Failed to load bookmarks for %s.\n", zathura->document->file_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
page_set_delayed(zathura, document->current_page_number - 1);
|
page_set_delayed(zathura, document->current_page_number - 1);
|
||||||
cb_view_vadjustment_value_changed(NULL, zathura);
|
cb_view_vadjustment_value_changed(NULL, zathura);
|
||||||
|
|
Loading…
Reference in a new issue