Commit 89e78320 authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Update style

parent 41cb60e5
...@@ -87,7 +87,8 @@ zathura_bookmark_free(zathura_bookmark_t* bookmark) ...@@ -87,7 +87,8 @@ zathura_bookmark_free(zathura_bookmark_t* bookmark)
} }
bool 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);
......
...@@ -84,7 +84,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi ...@@ -84,7 +84,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
GdkRectangle page_rect; GdkRectangle page_rect;
GtkWidget* page_widget = zathura_page_get_widget(zathura, page); GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
gtk_widget_translate_coordinates(page_widget, gtk_widget_translate_coordinates(page_widget,
zathura->ui.session->gtk.view, 0, 0, &page_rect.x, &page_rect.y); zathura->ui.session->gtk.view, 0, 0, &page_rect.x, &page_rect.y);
page_rect.width = zathura_page_get_width(page) * scale; page_rect.width = zathura_page_get_width(page) * scale;
page_rect.height = zathura_page_get_height(page) * scale; page_rect.height = zathura_page_get_height(page) * scale;
...@@ -156,7 +156,7 @@ cb_first_page_column_value_changed(girara_session_t* session, const char* UNUSED ...@@ -156,7 +156,7 @@ cb_first_page_column_value_changed(girara_session_t* session, const char* UNUSED
void void
cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path, cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
GtkTreeViewColumn* UNUSED(column), void* data) GtkTreeViewColumn* UNUSED(column), void* data)
{ {
zathura_t* zathura = data; zathura_t* zathura = data;
if (tree_view == NULL || zathura == NULL || zathura->ui.session == NULL) { if (tree_view == NULL || zathura == NULL || zathura->ui.session == NULL) {
...@@ -269,13 +269,13 @@ password_dialog(gpointer data) ...@@ -269,13 +269,13 @@ password_dialog(gpointer data)
if (dialog != NULL) { if (dialog != NULL) {
girara_dialog( girara_dialog(
dialog->zathura->ui.session, dialog->zathura->ui.session,
"Incorrect password. Enter password:", "Incorrect password. Enter password:",
true, true,
NULL, NULL,
(girara_callback_inputbar_activate_t) cb_password_dialog, (girara_callback_inputbar_activate_t) cb_password_dialog,
dialog dialog
); );
} }
return FALSE; return FALSE;
...@@ -323,8 +323,8 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog) ...@@ -323,8 +323,8 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog)
error_free: error_free:
g_free(dialog->path); g_free(dialog->path);
free(dialog); free(dialog);
error_ret: error_ret:
...@@ -355,7 +355,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t* ...@@ -355,7 +355,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t*
void void
cb_setting_recolor_change(girara_session_t* session, const char* name, cb_setting_recolor_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -373,7 +373,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name, ...@@ -373,7 +373,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name,
void void
cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
......
...@@ -165,15 +165,15 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list)) ...@@ -165,15 +165,15 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
GString* string = g_string_new(NULL); GString* string = g_string_new(NULL);
GIRARA_LIST_FOREACH(information, zathura_document_information_entry_t*, iter, entry) GIRARA_LIST_FOREACH(information, zathura_document_information_entry_t*, iter, entry)
if (entry != NULL) { if (entry != NULL) {
for (unsigned int i = 0; i < LENGTH(meta_fields); i++) { for (unsigned int i = 0; i < LENGTH(meta_fields); i++) {
if (meta_fields[i].field == entry->type) { if (meta_fields[i].field == entry->type) {
char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, entry->value); char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, entry->value);
g_string_append(string, text); g_string_append(string, text);
g_free(text); g_free(text);
}
} }
} }
}
GIRARA_LIST_FOREACH_END(information, zathura_document_information_entry_t*, iter, entry); GIRARA_LIST_FOREACH_END(information, zathura_document_information_entry_t*, iter, entry);
if (strlen(string->str) > 0) { if (strlen(string->str) > 0) {
...@@ -190,7 +190,7 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list)) ...@@ -190,7 +190,7 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
bool bool
cmd_help(girara_session_t* UNUSED(session), girara_list_t* cmd_help(girara_session_t* UNUSED(session), girara_list_t*
UNUSED(argument_list)) UNUSED(argument_list))
{ {
return true; return true;
} }
...@@ -426,7 +426,7 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list) ...@@ -426,7 +426,7 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
} else { } else {
girara_notify(session, GIRARA_INFO, _("Wrote attachment '%s' to '%s'."), file_identifier, export_path); girara_notify(session, GIRARA_INFO, _("Wrote attachment '%s' to '%s'."), file_identifier, export_path);
} }
/* image */ /* image */
} else if (strncmp(file_identifier, "image-p", strlen("image-p")) == 0 && strlen(file_identifier) >= 10) { } else if (strncmp(file_identifier, "image-p", strlen("image-p")) == 0 && strlen(file_identifier) >= 10) {
/* parse page id */ /* parse page id */
const char* input = file_identifier + strlen("image-p"); const char* input = file_identifier + strlen("image-p");
...@@ -479,7 +479,7 @@ image_error: ...@@ -479,7 +479,7 @@ image_error:
girara_notify(session, GIRARA_ERROR, _("Unknown image '%s'."), file_identifier); girara_notify(session, GIRARA_ERROR, _("Unknown image '%s'."), file_identifier);
goto error_ret; goto error_ret;
/* unknown */ /* unknown */
} else { } else {
girara_notify(session, GIRARA_ERROR, _("Unknown attachment or image '%s'."), file_identifier); girara_notify(session, GIRARA_ERROR, _("Unknown attachment or image '%s'."), file_identifier);
} }
...@@ -502,10 +502,10 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list) ...@@ -502,10 +502,10 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
const char* path = zathura_document_get_path(zathura->document); const char* path = zathura_document_get_path(zathura->document);
GIRARA_LIST_FOREACH(argument_list, char*, iter, value) GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
char* r = NULL; char* r = NULL;
if ((r = replace_substring(value, "$FILE", path)) != NULL) { if ((r = replace_substring(value, "$FILE", path)) != NULL) {
girara_list_iterator_set(iter, r); girara_list_iterator_set(iter, r);
} }
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value); GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
} }
...@@ -553,9 +553,9 @@ cmd_version(girara_session_t* session, girara_list_t* UNUSED(argument_list)) ...@@ -553,9 +553,9 @@ cmd_version(girara_session_t* session, girara_list_t* UNUSED(argument_list))
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
char* string = zathura_get_version_string(zathura, true); char* string = zathura_get_version_string(zathura, true);
if (string == NULL) { if (string == NULL) {
return false; return false;
} }
/* display information */ /* display information */
girara_notify(session, GIRARA_INFO, "%s", string); girara_notify(session, GIRARA_INFO, "%s", string);
......
...@@ -32,7 +32,7 @@ compare_case_insensitive(const char* str1, const char* str2) ...@@ -32,7 +32,7 @@ compare_case_insensitive(const char* str1, const char* str2)
static girara_list_t* static girara_list_t*
list_files(zathura_t* zathura, const char* current_path, const char* current_file, list_files(zathura_t* zathura, const char* current_path, const char* current_file,
unsigned int current_file_length, bool is_dir, bool check_file_ext) unsigned int current_file_length, bool is_dir, bool check_file_ext)
{ {
if (zathura == NULL || zathura->ui.session == NULL || current_path == NULL) { if (zathura == NULL || zathura->ui.session == NULL || current_path == NULL) {
return NULL; return NULL;
...@@ -45,7 +45,7 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil ...@@ -45,7 +45,7 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
} }
girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)compare_case_insensitive, girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)compare_case_insensitive,
(girara_free_function_t)g_free); (girara_free_function_t)g_free);
bool show_hidden = false; bool show_hidden = false;
girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden); girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden);
...@@ -179,7 +179,7 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext) ...@@ -179,7 +179,7 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext)
} }
GIRARA_LIST_FOREACH(names, const char*, iter, file) GIRARA_LIST_FOREACH(names, const char*, iter, file)
girara_completion_group_add_element(group, file, NULL); girara_completion_group_add_element(group, file, NULL);
GIRARA_LIST_FOREACH_END(names, const char*, iter, file); GIRARA_LIST_FOREACH_END(names, const char*, iter, file);
girara_list_free(names); girara_list_free(names);
} }
...@@ -246,11 +246,11 @@ cc_bookmarks(girara_session_t* session, const char* input) ...@@ -246,11 +246,11 @@ cc_bookmarks(girara_session_t* session, const char* input)
const size_t input_length = strlen(input); const size_t input_length = strlen(input);
GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark) GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark)
if (input_length <= strlen(bookmark->id) && !strncmp(input, bookmark->id, input_length)) { if (input_length <= strlen(bookmark->id) && !strncmp(input, bookmark->id, input_length)) {
gchar* paged = g_strdup_printf(_("Page %d"), bookmark->page); gchar* paged = g_strdup_printf(_("Page %d"), bookmark->page);
girara_completion_group_add_element(group, bookmark->id, paged); girara_completion_group_add_element(group, bookmark->id, paged);
g_free(paged); g_free(paged);
} }
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark); GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark);
girara_completion_add_group(completion, group); girara_completion_add_group(completion, group);
...@@ -302,12 +302,12 @@ cc_export(girara_session_t* session, const char* input) ...@@ -302,12 +302,12 @@ cc_export(girara_session_t* session, const char* input)
bool added = false; bool added = false;
GIRARA_LIST_FOREACH(attachments, const char*, iter, attachment) GIRARA_LIST_FOREACH(attachments, const char*, iter, attachment)
if (input_length <= strlen(attachment) && !strncmp(input, attachment, input_length)) { if (input_length <= strlen(attachment) && !strncmp(input, attachment, input_length)) {
char* attachment_string = g_strdup_printf("attachment-%s", attachment); char* attachment_string = g_strdup_printf("attachment-%s", attachment);
girara_completion_group_add_element(attachment_group, attachment_string, NULL); girara_completion_group_add_element(attachment_group, attachment_string, NULL);
g_free(attachment_string); g_free(attachment_string);
added = true; added = true;
} }
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark); GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark);
if (added == true) { if (added == true) {
...@@ -339,12 +339,12 @@ cc_export(girara_session_t* session, const char* input) ...@@ -339,12 +339,12 @@ cc_export(girara_session_t* session, const char* input)
if (images != NULL) { if (images != NULL) {
unsigned int image_number = 1; unsigned int image_number = 1;
GIRARA_LIST_FOREACH(images, zathura_image_t*, iter, UNUSED(image)) GIRARA_LIST_FOREACH(images, zathura_image_t*, iter, UNUSED(image))
char* image_string = g_strdup_printf("image-p%d-%d", page_id + 1, image_number); char* image_string = g_strdup_printf("image-p%d-%d", page_id + 1, image_number);
girara_completion_group_add_element(image_group, image_string, NULL); girara_completion_group_add_element(image_group, image_string, NULL);
g_free(image_string); g_free(image_string);
added = true; added = true;
image_number++; image_number++;
GIRARA_LIST_FOREACH_END(images, zathura_image_t*, iter, image); GIRARA_LIST_FOREACH_END(images, zathura_image_t*, iter, image);
girara_list_free(images); girara_list_free(images);
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
static void static void
cb_jumplist_change(girara_session_t* session, const char* name, cb_jumplist_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -35,7 +35,7 @@ cb_jumplist_change(girara_session_t* session, const char* name, ...@@ -35,7 +35,7 @@ cb_jumplist_change(girara_session_t* session, const char* name,
static void static void
cb_color_change(girara_session_t* session, const char* name, cb_color_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -59,7 +59,7 @@ cb_color_change(girara_session_t* session, const char* name, ...@@ -59,7 +59,7 @@ cb_color_change(girara_session_t* session, const char* name,
static void static void
cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name), cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -80,7 +80,7 @@ cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name), ...@@ -80,7 +80,7 @@ cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name),
static void static void
cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name), cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -93,7 +93,7 @@ cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name), ...@@ -93,7 +93,7 @@ cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name),
static void static void
cb_incsearch_changed(girara_session_t* session, const char* UNUSED(name), cb_incsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
......
...@@ -39,28 +39,28 @@ ...@@ -39,28 +39,28 @@
static void zathura_database_interface_init(ZathuraDatabaseInterface* iface); static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
G_DEFINE_TYPE_WITH_CODE(ZathuraPlainDatabase, zathura_plaindatabase, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE(ZathuraPlainDatabase, zathura_plaindatabase, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(ZATHURA_TYPE_DATABASE, zathura_database_interface_init)) G_IMPLEMENT_INTERFACE(ZATHURA_TYPE_DATABASE, zathura_database_interface_init))
static void plain_finalize(GObject* object); static void plain_finalize(GObject* object);
static bool plain_add_bookmark(zathura_database_t* db, const char* file, static bool plain_add_bookmark(zathura_database_t* db, const char* file,
zathura_bookmark_t* bookmark); zathura_bookmark_t* bookmark);
static bool plain_remove_bookmark(zathura_database_t* db, const char* file, static bool plain_remove_bookmark(zathura_database_t* db, const char* file,
const char* id); const char* id);
static girara_list_t* plain_load_bookmarks(zathura_database_t* db, static girara_list_t* plain_load_bookmarks(zathura_database_t* db,
const char* file); const char* file);
static bool plain_set_fileinfo(zathura_database_t* db, const char* file, static bool plain_set_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info); zathura_fileinfo_t* file_info);
static bool plain_get_fileinfo(zathura_database_t* db, const char* file, static bool plain_get_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info); zathura_fileinfo_t* file_info);
static void plain_set_property(GObject* object, guint prop_id, static void plain_set_property(GObject* object, guint prop_id,
const GValue* value, GParamSpec* pspec); const GValue* value, GParamSpec* pspec);
/* forward declaration */ /* forward declaration */
static bool zathura_db_check_file(const char* path); static bool zathura_db_check_file(const char* path);
static GKeyFile* zathura_db_read_key_file_from_file(const char* path); static GKeyFile* zathura_db_read_key_file_from_file(const char* path);
static void zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file); static void zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file);
static void cb_zathura_db_watch_file(GFileMonitor* monitor, GFile* file, GFile* static void cb_zathura_db_watch_file(GFileMonitor* monitor, GFile* file, GFile*
other_file, GFileMonitorEvent event, zathura_database_t* database); other_file, GFileMonitorEvent event, zathura_database_t* database);
typedef struct zathura_plaindatabase_private_s { typedef struct zathura_plaindatabase_private_s {
char* bookmark_path; char* bookmark_path;
...@@ -75,8 +75,7 @@ typedef struct zathura_plaindatabase_private_s { ...@@ -75,8 +75,7 @@ typedef struct zathura_plaindatabase_private_s {
#define ZATHURA_PLAINDATABASE_GET_PRIVATE(obj) \ #define ZATHURA_PLAINDATABASE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PLAINDATABASE, zathura_plaindatabase_private_t)) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PLAINDATABASE, zathura_plaindatabase_private_t))
enum enum {
{
PROP_0, PROP_0,
PROP_PATH PROP_PATH
}; };
...@@ -118,8 +117,8 @@ zathura_plaindatabase_class_init(ZathuraPlainDatabaseClass* class) ...@@ -118,8 +117,8 @@ zathura_plaindatabase_class_init(ZathuraPlainDatabaseClass* class)
object_class->set_property = plain_set_property; object_class->set_property = plain_set_property;
g_object_class_install_property(object_class, PROP_PATH, g_object_class_install_property(object_class, PROP_PATH,
g_param_spec_string("path", "path", "path to directory where the bookmarks and history are locates", g_param_spec_string("path", "path", "path to directory where the bookmarks and history are locates",
NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
} }
static void static void
...@@ -171,10 +170,10 @@ plain_db_init(ZathuraPlainDatabase* db, const char* dir) ...@@ -171,10 +170,10 @@ plain_db_init(ZathuraPlainDatabase* db, const char* dir)
g_object_unref(bookmark_file); g_object_unref(bookmark_file);
g_signal_connect( g_signal_connect(
G_OBJECT(priv->bookmark_monitor), G_OBJECT(priv->bookmark_monitor),
"changed", "changed",
G_CALLBACK(cb_zathura_db_watch_file), G_CALLBACK(cb_zathura_db_watch_file),
db db
); );
priv->bookmarks = zathura_db_read_key_file_from_file(priv->bookmark_path); priv->bookmarks = zathura_db_read_key_file_from_file(priv->bookmark_path);
...@@ -198,10 +197,10 @@ plain_db_init(ZathuraPlainDatabase* db, const char* dir) ...@@ -198,10 +197,10 @@ plain_db_init(ZathuraPlainDatabase* db, const char* dir)
g_object_unref(history_file); g_object_unref(history_file);
g_signal_connect( g_signal_connect(
G_OBJECT(priv->history_monitor), G_OBJECT(priv->history_monitor),
"changed", "changed",
G_CALLBACK(cb_zathura_db_watch_file), G_CALLBACK(cb_zathura_db_watch_file),
db db
); );
priv->history = zathura_db_read_key_file_from_file(priv->history_path); priv->history = zathura_db_read_key_file_from_file(priv->history_path);
...@@ -289,7 +288,7 @@ plain_finalize(GObject* object) ...@@ -289,7 +288,7 @@ plain_finalize(GObject* object)
static bool static bool
plain_add_bookmark(zathura_database_t* db, const char* file, plain_add_bookmark(zathura_database_t* db, const char* file,
zathura_bookmark_t* bookmark) zathura_bookmark_t* bookmark)
{ {
zathura_plaindatabase_private_t* priv = ZATHURA_PLAINDATABASE_GET_PRIVATE(db); zathura_plaindatabase_private_t* priv = ZATHURA_PLAINDATABASE_GET_PRIVATE(db);
if (priv->bookmarks == NULL || priv->bookmark_path == NULL || if (priv->bookmarks == NULL || priv->bookmark_path == NULL ||
...@@ -308,7 +307,7 @@ plain_add_bookmark(zathura_database_t* db, const char* file, ...@@ -308,7 +307,7 @@ plain_add_bookmark(zathura_database_t* db, const char* file,
static bool static bool
plain_remove_bookmark(zathura_database_t* db, const char* file, const char* plain_remove_bookmark(zathura_database_t* db, const char* file, const char*
GIRARA_UNUSED(id)) GIRARA_UNUSED(id))
{ {
zathura_plaindatabase_private_t* priv = ZATHURA_PLAINDATABASE_GET_PRIVATE(db); zathura_plaindatabase_private_t* priv = ZATHURA_PLAINDATABASE_GET_PRIVATE(db);
if (priv->bookmarks == NULL || priv->bookmark_path == NULL) { if (priv->bookmarks == NULL || priv->bookmark_path == NULL) {
...@@ -344,8 +343,8 @@ plain_load_bookmarks(zathura_database_t* db, const char* file) ...@@ -344,8 +343,8 @@ plain_load_bookmarks(zathura_database_t* db, const char* file)
} }
girara_list_t* result = girara_sorted_list_new2((girara_compare_function_t) girara_list_t* result = girara_sorted_list_new2((girara_compare_function_t)
zathura_bookmarks_compare, (girara_free_function_t) zathura_bookmarks_compare, (girara_free_function_t)
zathura_bookmark_free); zathura_bookmark_free);
gsize length; gsize length;
char** keys = g_key_file_get_keys(priv->bookmarks, name, &length, NULL); char** keys = g_key_file_get_keys(priv->bookmarks, name, &length, NULL);
...@@ -372,7 +371,7 @@ plain_load_bookmarks(zathura_database_t* db, const char* file) ...@@ -372,7 +371,7 @@ plain_load_bookmarks(zathura_database_t* db, const char* file)
static bool static bool
plain_set_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t* plain_set_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
file_info) file_info)
{ {
zathura_plaindatabase_private_t* priv = ZATHURA_PLAINDATABASE_GET_PRIVATE(db); zathura_plaindatabase_private_t* priv = ZATHURA_PLAINDATABASE_GET_PRIVATE(db);
if (priv->history == NULL || file_info == NULL || file == NULL) { if (priv->history == NULL || file_info == NULL || file == NULL) {
...@@ -409,7 +408,7 @@ plain_set_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t* ...@@ -409,7 +408,7 @@ plain_set_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
static bool static bool
plain_get_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t* plain_get_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
file_info) file_info)
{ {
if (db == NULL || file == NULL || file_info == NULL) { if (db == NULL || file == NULL || file_info == NULL) {
return false; return false;
...@@ -519,9 +518,9 @@ zathura_db_read_key_file_from_file(const char* path) ...@@ -519,9 +518,9 @@ zathura_db_read_key_file_from_file(const char* path)
GError* error = NULL; GError* error = NULL;
if (g_key_file_load_from_data(key_file, content, contentlen, if (g_key_file_load_from_data(key_file, content, contentlen,
G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error) == G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error) ==
FALSE) { FALSE) {
if (error->code != 1) /* ignore empty file */ { if (error->code != 1) { /* ignore empty file */
free(content); free(content);
g_key_file_free(key_file); g_key_file_free(key_file);
g_error_free(error); g_error_free(error);
...@@ -568,7 +567,7 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file) ...@@ -568,7 +567,7 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file)
static void static void
cb_zathura_db_watch_file(GFileMonitor* UNUSED(monitor), GFile* file, GFile* UNUSED(other_file), cb_zathura_db_watch_file(GFileMonitor* UNUSED(monitor), GFile* file, GFile* UNUSED(other_file),
GFileMonitorEvent event, zathura_database_t* database) GFileMonitorEvent event, zathura_database_t* database)
{ {
if (event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT || database == NULL) { if (event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT || database == NULL) {
return; return;
......
...@@ -10,21 +10,21 @@ ...@@ -10,21 +10,21 @@
static void zathura_database_interface_init(ZathuraDatabaseInterface* iface); static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
G_DEFINE_TYPE_WITH_CODE(ZathuraSQLDatabase, zathura_sqldatabase, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE(ZathuraSQLDatabase, zathura_sqldatabase, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(ZATHURA_TYPE_DATABASE, zathura_database_interface_init)) G_IMPLEMENT_INTERFACE(ZATHURA_TYPE_DATABASE, zathura_database_interface_init))