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

Update style

parent 41cb60e5
......@@ -87,7 +87,8 @@ zathura_bookmark_free(zathura_bookmark_t* bookmark)
}
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(file, false);
......
......@@ -84,7 +84,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
GdkRectangle page_rect;
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
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.height = zathura_page_get_height(page) * scale;
......@@ -156,7 +156,7 @@ cb_first_page_column_value_changed(girara_session_t* session, const char* UNUSED
void
cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
GtkTreeViewColumn* UNUSED(column), void* data)
GtkTreeViewColumn* UNUSED(column), void* data)
{
zathura_t* zathura = data;
if (tree_view == NULL || zathura == NULL || zathura->ui.session == NULL) {
......@@ -269,13 +269,13 @@ password_dialog(gpointer data)
if (dialog != NULL) {
girara_dialog(
dialog->zathura->ui.session,
"Incorrect password. Enter password:",
true,
NULL,
(girara_callback_inputbar_activate_t) cb_password_dialog,
dialog
);
dialog->zathura->ui.session,
"Incorrect password. Enter password:",
true,
NULL,
(girara_callback_inputbar_activate_t) cb_password_dialog,
dialog
);
}
return FALSE;
......@@ -323,8 +323,8 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog)
error_free:
g_free(dialog->path);
free(dialog);
g_free(dialog->path);
free(dialog);
error_ret:
......@@ -355,7 +355,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t*
void
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(session != NULL);
......@@ -373,7 +373,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name,
void
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(session != NULL);
......
......@@ -165,15 +165,15 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
GString* string = g_string_new(NULL);
GIRARA_LIST_FOREACH(information, zathura_document_information_entry_t*, iter, entry)
if (entry != NULL) {
for (unsigned int i = 0; i < LENGTH(meta_fields); i++) {
if (meta_fields[i].field == entry->type) {
char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, entry->value);
g_string_append(string, text);
g_free(text);
}
if (entry != NULL) {
for (unsigned int i = 0; i < LENGTH(meta_fields); i++) {
if (meta_fields[i].field == entry->type) {
char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, entry->value);
g_string_append(string, text);
g_free(text);
}
}
}
GIRARA_LIST_FOREACH_END(information, zathura_document_information_entry_t*, iter, entry);
if (strlen(string->str) > 0) {
......@@ -190,7 +190,7 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
bool
cmd_help(girara_session_t* UNUSED(session), girara_list_t*
UNUSED(argument_list))
UNUSED(argument_list))
{
return true;
}
......@@ -426,7 +426,7 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
} else {
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) {
/* parse page id */
const char* input = file_identifier + strlen("image-p");
......@@ -479,7 +479,7 @@ image_error:
girara_notify(session, GIRARA_ERROR, _("Unknown image '%s'."), file_identifier);
goto error_ret;
/* unknown */
/* unknown */
} else {
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)
const char* path = zathura_document_get_path(zathura->document);
GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
char* r = NULL;
if ((r = replace_substring(value, "$FILE", path)) != NULL) {
girara_list_iterator_set(iter, r);
}
char* r = NULL;
if ((r = replace_substring(value, "$FILE", path)) != NULL) {
girara_list_iterator_set(iter, r);
}
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))
zathura_t* zathura = session->global.data;
char* string = zathura_get_version_string(zathura, true);
if (string == NULL) {
return false;
}
if (string == NULL) {
return false;
}
/* display information */
girara_notify(session, GIRARA_INFO, "%s", string);
......
......@@ -32,7 +32,7 @@ compare_case_insensitive(const char* str1, const char* str2)
static girara_list_t*
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) {
return NULL;
......@@ -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_free_function_t)g_free);
(girara_free_function_t)g_free);
bool show_hidden = false;
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)
}
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_free(names);
}
......@@ -246,11 +246,11 @@ cc_bookmarks(girara_session_t* session, const char* input)
const size_t input_length = strlen(input);
GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark)
if (input_length <= strlen(bookmark->id) && !strncmp(input, bookmark->id, input_length)) {
gchar* paged = g_strdup_printf(_("Page %d"), bookmark->page);
girara_completion_group_add_element(group, bookmark->id, paged);
g_free(paged);
}
if (input_length <= strlen(bookmark->id) && !strncmp(input, bookmark->id, input_length)) {
gchar* paged = g_strdup_printf(_("Page %d"), bookmark->page);
girara_completion_group_add_element(group, bookmark->id, paged);
g_free(paged);
}
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark);
girara_completion_add_group(completion, group);
......@@ -302,12 +302,12 @@ cc_export(girara_session_t* session, const char* input)
bool added = false;
GIRARA_LIST_FOREACH(attachments, const char*, iter, attachment)
if (input_length <= strlen(attachment) && !strncmp(input, attachment, input_length)) {
char* attachment_string = g_strdup_printf("attachment-%s", attachment);
girara_completion_group_add_element(attachment_group, attachment_string, NULL);
g_free(attachment_string);
added = true;
}
if (input_length <= strlen(attachment) && !strncmp(input, attachment, input_length)) {
char* attachment_string = g_strdup_printf("attachment-%s", attachment);
girara_completion_group_add_element(attachment_group, attachment_string, NULL);
g_free(attachment_string);
added = true;
}
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark);
if (added == true) {
......@@ -339,12 +339,12 @@ cc_export(girara_session_t* session, const char* input)
if (images != NULL) {
unsigned int image_number = 1;
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);
girara_completion_group_add_element(image_group, image_string, NULL);
g_free(image_string);
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);
g_free(image_string);
added = true;
image_number++;
added = true;
image_number++;
GIRARA_LIST_FOREACH_END(images, zathura_image_t*, iter, image);
girara_list_free(images);
}
......
......@@ -20,7 +20,7 @@
static void
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(session != NULL);
......@@ -35,7 +35,7 @@ cb_jumplist_change(girara_session_t* session, const char* name,
static void
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(session != NULL);
......@@ -59,7 +59,7 @@ cb_color_change(girara_session_t* session, const char* name,
static void
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(session != NULL);
......@@ -80,7 +80,7 @@ cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name),
static void
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(session != NULL);
......@@ -93,7 +93,7 @@ cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name),
static void
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(session != NULL);
......
......@@ -39,28 +39,28 @@
static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
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 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,
const char* id);
const char* id);
static girara_list_t* plain_load_bookmarks(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,
zathura_fileinfo_t* file_info);
zathura_fileinfo_t* file_info);
static void plain_set_property(GObject* object, guint prop_id,
const GValue* value, GParamSpec* pspec);
const GValue* value, GParamSpec* pspec);
/* forward declaration */
static bool zathura_db_check_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 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 {
char* bookmark_path;
......@@ -75,8 +75,7 @@ typedef struct zathura_plaindatabase_private_s {
#define ZATHURA_PLAINDATABASE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PLAINDATABASE, zathura_plaindatabase_private_t))
enum
{
enum {
PROP_0,
PROP_PATH
};
......@@ -118,8 +117,8 @@ zathura_plaindatabase_class_init(ZathuraPlainDatabaseClass* class)
object_class->set_property = plain_set_property;
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",
NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_param_spec_string("path", "path", "path to directory where the bookmarks and history are locates",
NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
static void
......@@ -171,10 +170,10 @@ plain_db_init(ZathuraPlainDatabase* db, const char* dir)
g_object_unref(bookmark_file);
g_signal_connect(
G_OBJECT(priv->bookmark_monitor),
"changed",
G_CALLBACK(cb_zathura_db_watch_file),
db
G_OBJECT(priv->bookmark_monitor),
"changed",
G_CALLBACK(cb_zathura_db_watch_file),
db
);
priv->bookmarks = zathura_db_read_key_file_from_file(priv->bookmark_path);
......@@ -198,10 +197,10 @@ plain_db_init(ZathuraPlainDatabase* db, const char* dir)
g_object_unref(history_file);
g_signal_connect(
G_OBJECT(priv->history_monitor),
"changed",
G_CALLBACK(cb_zathura_db_watch_file),
db
G_OBJECT(priv->history_monitor),
"changed",
G_CALLBACK(cb_zathura_db_watch_file),
db
);
priv->history = zathura_db_read_key_file_from_file(priv->history_path);
......@@ -289,7 +288,7 @@ plain_finalize(GObject* object)
static bool
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);
if (priv->bookmarks == NULL || priv->bookmark_path == NULL ||
......@@ -308,7 +307,7 @@ plain_add_bookmark(zathura_database_t* db, const char* file,
static bool
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);
if (priv->bookmarks == NULL || priv->bookmark_path == NULL) {
......@@ -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)
zathura_bookmarks_compare, (girara_free_function_t)
zathura_bookmark_free);
zathura_bookmarks_compare, (girara_free_function_t)
zathura_bookmark_free);
gsize length;
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)
static bool
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);
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*
static bool
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) {
return false;
......@@ -519,9 +518,9 @@ zathura_db_read_key_file_from_file(const char* path)
GError* error = NULL;
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) {
if (error->code != 1) /* ignore empty file */ {
if (error->code != 1) { /* ignore empty file */
free(content);
g_key_file_free(key_file);
g_error_free(error);
......@@ -568,7 +567,7 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file)
static void
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) {
return;
......
......@@ -10,21 +10,21 @@
static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
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))
static void sqlite_finalize(GObject* object);
static bool sqlite_add_bookmark(zathura_database_t* db, const char* file,
zathura_bookmark_t* bookmark);
zathura_bookmark_t* bookmark);
static bool sqlite_remove_bookmark(zathura_database_t* db, const char* file,
const char* id);
const char* id);
static girara_list_t* sqlite_load_bookmarks(zathura_database_t* db,
const char* file);
static bool sqlite_set_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info);
zathura_fileinfo_t* file_info);
static bool sqlite_get_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info);
zathura_fileinfo_t* file_info);
static void sqlite_set_property(GObject* object, guint prop_id,
const GValue* value, GParamSpec* pspec);
const GValue* value, GParamSpec* pspec);
typedef struct zathura_sqldatabase_private_s {
sqlite3* session;
......@@ -33,8 +33,7 @@ typedef struct zathura_sqldatabase_private_s {
#define ZATHURA_SQLDATABASE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_SQLDATABASE, zathura_sqldatabase_private_t))
enum
{
enum {
PROP_0,
PROP_PATH
};
......@@ -62,7 +61,7 @@ zathura_sqldatabase_class_init(ZathuraSQLDatabaseClass* class)
object_class->set_property = sqlite_set_property;
g_object_class_install_property(object_class, PROP_PATH,
g_param_spec_string("path", "path", "path to the database", NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_param_spec_string("path", "path", "path to the database", NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
static void
......@@ -107,23 +106,23 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
/* create bookmarks database */
static const char SQL_BOOKMARK_INIT[] =
"CREATE TABLE IF NOT EXISTS bookmarks ("
"file TEXT,"
"id TEXT,"
"page INTEGER,"
"PRIMARY KEY(file, id));";
"file TEXT,"
"id TEXT,"
"page INTEGER,"
"PRIMARY KEY(file, id));";
static const char SQL_FILEINFO_INIT[] =
"CREATE TABLE IF NOT EXISTS fileinfo ("
"file TEXT PRIMARY KEY,"
"page INTEGER,"
"offset INTEGER,"
"scale FLOAT,"
"rotation INTEGER,"
"pages_per_row INTEGER,"
"first_page_column INTEGER,"
"position_x FLOAT,"
"position_y FLOAT"
");";
"file TEXT PRIMARY KEY,"
"page INTEGER,"
"offset INTEGER,"
"scale FLOAT,"
"rotation INTEGER,"
"pages_per_row INTEGER,"
"first_page_column INTEGER,"
"position_x FLOAT,"
"position_y FLOAT"
");";
static const char SQL_FILEINFO_ALTER[] =
"ALTER TABLE fileinfo ADD COLUMN pages_per_row INTEGER;"
......@@ -211,7 +210,7 @@ prepare_statement(sqlite3* session, const char* statement)
static bool
sqlite_add_bookmark(zathura_database_t* db, const char* file,
zathura_bookmark_t* bookmark)
zathura_bookmark_t* bookmark)
{
zathura_sqldatabase_private_t* priv = ZATHURA_SQLDATABASE_GET_PRIVATE(db);
......@@ -239,7 +238,7 @@ sqlite_add_bookmark(zathura_database_t* db, const char* file,
static bool
sqlite_remove_bookmark(zathura_database_t* db, const char* file, const char*
id)
id)
{
zathura_sqldatabase_private_t* priv = ZATHURA_SQLDATABASE_GET_PRIVATE(db);
......@@ -284,7 +283,7 @@ sqlite_load_bookmarks(zathura_database_t* db, const char* file)
}
girara_list_t* result = girara_sorted_list_new2((girara_compare_function_t) zathura_bookmarks_compare,
(girara_free_function_t) zathura_bookmark_free);
(girara_free_function_t) zathura_bookmark_free);
while (sqlite3_step(stmt) == SQLITE_ROW) {
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
......@@ -302,7 +301,7 @@ sqlite_load_bookmarks(zathura_database_t* db, const char* file)
static bool
sqlite_set_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info)
zathura_fileinfo_t* file_info)
{
if (db == NULL || file == NULL || file_info == NULL) {
return false;
......@@ -340,7 +339,7 @@ sqlite_set_fileinfo(zathura_database_t* db, const char* file,
static bool
sqlite_get_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info)
zathura_fileinfo_t* file_info)
{
if (db == NULL || file == NULL || file_info == NULL) {
return false;
......
......@@ -21,7 +21,7 @@ zathura_db_free(zathura_database_t* db)
bool
zathura_db_add_bookmark(zathura_database_t* db, const char* file,
zathura_bookmark_t* bookmark)
zathura_bookmark_t* bookmark)
{
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && bookmark != NULL, false);
......@@ -30,7 +30,7 @@ zathura_db_add_bookmark(zathura_database_t* db, const char* file,
bool
zathura_db_remove_bookmark(zathura_database_t* db, const char* file, const char*
id)
id)
{
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && id != NULL, false);
......@@ -45,9 +45,9 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file)
return ZATHURA_DATABASE_GET_INTERFACE(db)->load_bookmarks(db, file);
}
bool
bool
zathura_db_set_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info)
zathura_fileinfo_t* file_info)
{
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && file_info != NULL, false);
......@@ -56,7 +56,7 @@ zathura_db_set_fileinfo(zathura_database_t* db, const char* file,
bool
zathura_db_get_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info)
zathura_fileinfo_t* file_info)
{
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && file_info != NULL, false);
......
......@@ -36,8 +36,7 @@ static const gchar* guess_type(const char* path);
/**
* Document
*/
struct zathura_document_s
{
struct zathura_document_s {
char* file_path; /**< File path of the document */
const char* password; /**< Password of the document */
unsigned int current_page_number; /**< Current page number */
......@@ -62,7 +61,7 @@ struct zathura_document_s
zathura_document_t*
zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char*
path, const char* password, zathura_error_t* error)
path, const char* password, zathura_error_t* error)
{
if (path == NULL) {
return NULL;
......
......@@ -10,8 +10,7 @@
#include "document.h"
#include "utils.h"
struct zathura_link_s
{
struct zathura_link_s {
zathura_rectangle_t position; /**< Position of the link */
zathura_link_type_t type; /**< Link type */
zathura_link_target_t target; /**< Link target */
......@@ -23,7 +22,7 @@ static void link_launch(zathura_t* zathura, zathura_link_t* link);
zathura_link_t*
zathura_link_new(zathura_link_type_t type, zathura_rectangle_t position,
zathura_link_target_t target)
zathura_link_target_t target)
{
zathura_link_t* link = g_malloc0(sizeof(zathura_link_t));
......@@ -130,12 +129,12 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
/* get page */
zathura_page_t* page = zathura_document_get_page(zathura->document,
link->target.page_number);
link->target.page_number);
if (page == NULL) {
return;
}
zathura_document_set_current_page_number(zathura->document, link->target.page_number);
zathura_document_set_current_page_number(zathura->document, link->target.page_number);
/* get page offset */
page_offset_t offset;
......@@ -152,8 +151,8 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
position_set_delayed(zathura, offset.x, offset.y);
statusbar_page_number_update(zathura);
}
break;
}
break;
default:
break;
}
......
......@@ -28,7 +28,7 @@ struct zathura_mark_s {
bool
sc_mark_add(girara_session_t* session, girara_argument_t* UNUSED(argument),
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(session->gtk.view != NULL, FALSE);
......@@ -36,14 +36,14 @@ sc_mark_add(girara_session_t* session, girara_argument_t* UNUSED(argument),
/* redirect signal handler */
g_signal_handler_disconnect(G_OBJECT(session->gtk.view), session->signals.view_key_pressed);
session->signals.view_key_pressed = g_signal_connect(G_OBJECT(session->gtk.view), "key-press-event",
G_CALLBACK(cb_marks_view_key_press_event_add), session);
G_CALLBACK(cb_marks_view_key_press_event_add), session);
return true;
}
bool
sc_mark_evaluate(girara_session_t* session, girara_argument_t* UNUSED(argument),
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(session->gtk.view != NULL, FALSE);
......@@ -51,14 +51,14 @@ sc_mark_evaluate(girara_session_t* session, girara_argument_t* UNUSED(argument),
/* redirect signal handler */
g_signal_handler_disconnect(G_OBJECT(session->gtk.view), session->signals.view_key_pressed);
session->signals.view_key_pressed = g_signal_connect(G_OBJECT(session->gtk.view), "key-press-event",
G_CALLBACK(cb_marks_view_key_press_event_evaluate), session);
G_CALLBACK(cb_marks_view_key_press_event_evaluate), session);
return true;
}
bool
cb_marks_view_key_press_event_add(GtkWidget* UNUSED(widget), GdkEventKey* event,
girara_session_t* session)
girara_session_t* session)
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(session->gtk.view != NULL, FALSE);
......@@ -68,11 +68,11 @@ cb_marks_view_key_press_event_add(GtkWidget* UNUSED(widget), GdkEventKey* event,
/* reset signal handler */
g_signal_handler_disconnect(G_OBJECT(session->gtk.view), session->signals.view_key_pressed);
session->signals.view_key_pressed = g_signal_connect(G_OBJECT(session->gtk.view), "key-press-event",
G_CALLBACK(girara_callback_view_key_press_event), session);
G_CALLBACK(girara_callback_view_key_press_event), session);
/* evaluate key */
if (((event->keyval >= 0x41 && event->keyval <= 0x5A) || (event->keyval >=
0x61 && event->keyval <= 0x7A)) == false) {
0x61 && event->keyval <= 0x7A)) == false) {
return false;
}
......@@ -92,11 +92,11 @@ bool cb_marks_view_key_press_event_evaluate(GtkWidget* UNUSED(widget), GdkEventK
/* reset signal handler */
g_signal_handler_disconnect(G_OBJECT(session->gtk.view), session->signals.view_key_pressed);
session->signals.view_key_pressed = g_signal_connect(G_OBJECT(session->gtk.view), "key-press-event",
G_CALLBACK(girara_callback_view_key_press_event), session);
G_CALLBACK(girara_callback_view_key_press_event), session);
/* evaluate key */
if (((event->keyval >= 0x41 && event->keyval <= 0x5A) || (event->keyval >=
0x61 && event->keyval <= 0x7A)) == false) {
0x61 && event->keyval <= 0x7A)) == false) {
return true;
}
......@@ -129,7 +129,7 @@ cmd_marks_add(girara_session_t* session, girara_list_t* argument_list)
char key = key_string[0];
if (((key >= 0x41 && key <= 0x5A) || (key >=
0x61 && key <= 0x7A)) == false) {
0x61 && key <= 0x7A)) == false) {
return false;
}
......@@ -154,32 +154,32 @@ cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list)
}
GIRARA_LIST_FOREACH(argument_list, char*, iter, key_string)
if (key_string == NULL) {
if (key_string == NULL) {
continue;
}
for (unsigned int i = 0; i < strlen(key_string); i++) {
char key = key_string[i];
if (((key >= 0x41 && key <= 0x5A) || (key >=
0x61 && key <= 0x7A)) == false) {