Update style

This commit is contained in:
Moritz Lipp 2012-02-17 00:43:01 +01:00
parent 7db78012de
commit 394fbd934d
2 changed files with 14 additions and 10 deletions

View file

@ -32,8 +32,9 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
bookmark->id = g_strdup(id);
bookmark->page = page;
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.");
}
}
@ -48,15 +49,16 @@ zathura_bookmark_remove(zathura_t* zathura, const gchar* id)
g_return_val_if_fail(id, false);
zathura_bookmark_t* bookmark = zathura_bookmark_get(zathura, id);
if (!bookmark) {
if (bookmark == NULL) {
return false;
}
if (zathura->database) {
if (!zathura_db_remove_bookmark(zathura->database, zathura->document->file_path, bookmark->id)) {
if (zathura->database != NULL) {
if (zathura_db_remove_bookmark(zathura->database, zathura->document->file_path, bookmark->id) == false) {
girara_warning("Failed to remove bookmark from database.");
}
}
girara_list_remove(zathura->bookmarks.bookmarks, bookmark);
return true;
@ -74,7 +76,7 @@ zathura_bookmark_get(zathura_t* zathura, const gchar* id)
void
zathura_bookmark_free(zathura_bookmark_t* bookmark)
{
if (!bookmark) {
if (bookmark == NULL) {
return;
}
@ -86,17 +88,19 @@ bool
zathura_bookmarks_load(zathura_t* zathura, const gchar* file) {
g_return_val_if_fail(zathura, false);
g_return_val_if_fail(file, false);
if (zathura->database == NULL) {
return false;
}
girara_list_t* bookmarks = zathura_db_load_bookmarks(zathura->database, file);
if (!bookmarks) {
if (bookmarks == NULL) {
return false;
}
girara_list_free(zathura->bookmarks.bookmarks);
zathura->bookmarks.bookmarks = bookmarks;
return true;
}
@ -106,9 +110,11 @@ zathura_bookmarks_compare(zathura_bookmark_t* lhs, zathura_bookmark_t* rhs)
if (lhs == NULL && rhs == NULL) {
return 0;
}
if (lhs == NULL) {
return -1;
}
if (rhs == NULL) {
return 1;
}

View file

@ -431,9 +431,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
}
/* bookmarks */
if (zathura_bookmarks_load(zathura, zathura->document->file_path) == false) {
girara_warning("Failed to load bookmarks for %s.\n", zathura->document->file_path);
}
zathura_bookmarks_load(zathura, zathura->document->file_path);
page_set_delayed(zathura, document->current_page_number - 1);
cb_view_vadjustment_value_changed(NULL, zathura);