mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-06 05:24:57 +01:00
Update style
This commit is contained in:
parent
41cb60e5c6
commit
89e7832047
20 changed files with 451 additions and 460 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
@ -521,7 +520,7 @@ zathura_db_read_key_file_from_file(const char* path)
|
|||
if (g_key_file_load_from_data(key_file, content, contentlen,
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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 */
|
||||
|
|
3
links.c
3
links.c
|
@ -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 */
|
||||
|
|
|
@ -74,8 +74,7 @@ static gboolean cb_zathura_page_widget_popup_menu(GtkWidget* widget);
|
|||
static void cb_menu_image_copy(GtkMenuItem* item, ZathuraPage* page);
|
||||
static void cb_menu_image_save(GtkMenuItem* item, ZathuraPage* page);
|
||||
|
||||
enum properties_e
|
||||
{
|
||||
enum properties_e {
|
||||
PROP_0,
|
||||
PROP_PAGE,
|
||||
PROP_ZATHURA,
|
||||
|
|
18
plugin.c
18
plugin.c
|
@ -14,8 +14,7 @@
|
|||
/**
|
||||
* Document plugin structure
|
||||
*/
|
||||
struct zathura_plugin_s
|
||||
{
|
||||
struct zathura_plugin_s {
|
||||
girara_list_t* content_types; /**< List of supported content types */
|
||||
zathura_plugin_register_function_t register_function; /**< Document open function */
|
||||
zathura_plugin_functions_t functions; /**< Document functions */
|
||||
|
@ -28,8 +27,7 @@ struct zathura_plugin_s
|
|||
/**
|
||||
* Plugin mapping
|
||||
*/
|
||||
typedef struct zathura_type_plugin_mapping_s
|
||||
{
|
||||
typedef struct zathura_type_plugin_mapping_s {
|
||||
const gchar* type; /**< Plugin type */
|
||||
zathura_plugin_t* plugin; /**< Mapped plugin */
|
||||
} zathura_type_plugin_mapping_t;
|
||||
|
@ -37,8 +35,7 @@ typedef struct zathura_type_plugin_mapping_s
|
|||
/**
|
||||
* Plugin manager
|
||||
*/
|
||||
struct zathura_plugin_manager_s
|
||||
{
|
||||
struct zathura_plugin_manager_s {
|
||||
girara_list_t* plugins; /**< List of plugins */
|
||||
girara_list_t* path; /**< List of plugin paths */
|
||||
girara_list_t* type_plugin_mapping; /**< List of type -> plugin mappings */
|
||||
|
@ -121,8 +118,7 @@ zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager)
|
|||
/* resolve symbols and check API and ABI version*/
|
||||
zathura_plugin_api_version_t api_version = NULL;
|
||||
if (g_module_symbol(handle, PLUGIN_API_VERSION_FUNCTION, (gpointer*) &api_version) == FALSE ||
|
||||
api_version == NULL)
|
||||
{
|
||||
api_version == NULL) {
|
||||
girara_error("could not find '%s' function in plugin %s", PLUGIN_API_VERSION_FUNCTION, path);
|
||||
g_free(path);
|
||||
g_module_close(handle);
|
||||
|
@ -139,8 +135,7 @@ zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager)
|
|||
|
||||
zathura_plugin_abi_version_t abi_version = NULL;
|
||||
if (g_module_symbol(handle, PLUGIN_ABI_VERSION_FUNCTION, (gpointer*) &abi_version) == FALSE ||
|
||||
abi_version == NULL)
|
||||
{
|
||||
abi_version == NULL) {
|
||||
girara_error("could not find '%s' function in plugin %s", PLUGIN_ABI_VERSION_FUNCTION, path);
|
||||
g_free(path);
|
||||
g_module_close(handle);
|
||||
|
@ -157,8 +152,7 @@ zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager)
|
|||
|
||||
zathura_plugin_register_service_t register_service = NULL;
|
||||
if (g_module_symbol(handle, PLUGIN_REGISTER_FUNCTION, (gpointer*) ®ister_service) == FALSE ||
|
||||
register_service == NULL)
|
||||
{
|
||||
register_service == NULL) {
|
||||
girara_error("could not find '%s' function in plugin %s", PLUGIN_REGISTER_FUNCTION, path);
|
||||
g_free(path);
|
||||
g_module_close(handle);
|
||||
|
|
3
render.c
3
render.c
|
@ -17,8 +17,7 @@ static void render_job(void* data, void* user_data);
|
|||
static bool render(zathura_t* zathura, zathura_page_t* page);
|
||||
static gint render_thread_sort(gconstpointer a, gconstpointer b, gpointer data);
|
||||
|
||||
struct render_thread_s
|
||||
{
|
||||
struct render_thread_s {
|
||||
GThreadPool* pool; /**< Pool of threads */
|
||||
GStaticMutex mutex; /**< Render lock */
|
||||
bool about_to_close; /**< Render thread is to be freed */
|
||||
|
|
|
@ -103,7 +103,8 @@ synctex_record_hits(zathura_t* zathura, int page_idx, girara_list_t* hits, bool
|
|||
}
|
||||
|
||||
static double
|
||||
scan_float(GScanner* scanner) {
|
||||
scan_float(GScanner* scanner)
|
||||
{
|
||||
switch (g_scanner_get_next_token(scanner)) {
|
||||
case G_TOKEN_FLOAT:
|
||||
return g_scanner_cur_value(scanner).v_float;
|
||||
|
|
3
utils.c
3
utils.c
|
@ -34,8 +34,7 @@ file_get_extension(const char* path)
|
|||
}
|
||||
|
||||
unsigned int i = strlen(path);
|
||||
for (; i > 0; i--)
|
||||
{
|
||||
for (; i > 0; i--) {
|
||||
if (*(path + i) != '.') {
|
||||
continue;
|
||||
} else {
|
||||
|
|
30
zathura.c
30
zathura.c
|
@ -33,21 +33,18 @@
|
|||
#include "page-widget.h"
|
||||
#include "plugin.h"
|
||||
|
||||
typedef struct zathura_document_info_s
|
||||
{
|
||||
typedef struct zathura_document_info_s {
|
||||
zathura_t* zathura;
|
||||
const char* path;
|
||||
const char* password;
|
||||
} zathura_document_info_t;
|
||||
|
||||
typedef struct page_set_delayed_s
|
||||
{
|
||||
typedef struct page_set_delayed_s {
|
||||
zathura_t* zathura;
|
||||
unsigned int page;
|
||||
} page_set_delayed_t;
|
||||
|
||||
typedef struct position_set_delayed_s
|
||||
{
|
||||
typedef struct position_set_delayed_s {
|
||||
zathura_t* zathura;
|
||||
double position_x;
|
||||
double position_y;
|
||||
|
@ -755,8 +752,7 @@ document_save(zathura_t* zathura, const char* path, bool overwrite)
|
|||
g_return_val_if_fail(path, false);
|
||||
|
||||
gchar* file_path = girara_fix_path(path);
|
||||
if ((overwrite == false) && g_file_test(file_path, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
if ((overwrite == false) && g_file_test(file_path, G_FILE_TEST_EXISTS)) {
|
||||
girara_error("File already exists: %s. Use :write! to overwrite it.", file_path);
|
||||
g_free(file_path);
|
||||
return false;
|
||||
|
@ -1054,7 +1050,8 @@ position_set_delayed(zathura_t* zathura, double position_x, double position_y)
|
|||
|
||||
|
||||
zathura_jump_t*
|
||||
zathura_jumplist_current(zathura_t* zathura) {
|
||||
zathura_jumplist_current(zathura_t* zathura)
|
||||
{
|
||||
if (zathura->jumplist.cur != NULL) {
|
||||
return girara_list_iterator_data(zathura->jumplist.cur);
|
||||
} else {
|
||||
|
@ -1063,21 +1060,24 @@ zathura_jumplist_current(zathura_t* zathura) {
|
|||
}
|
||||
|
||||
void
|
||||
zathura_jumplist_forward(zathura_t* zathura) {
|
||||
zathura_jumplist_forward(zathura_t* zathura)
|
||||
{
|
||||
if (girara_list_iterator_has_next(zathura->jumplist.cur)) {
|
||||
girara_list_iterator_next(zathura->jumplist.cur);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
zathura_jumplist_backward(zathura_t* zathura) {
|
||||
zathura_jumplist_backward(zathura_t* zathura)
|
||||
{
|
||||
if (girara_list_iterator_has_previous(zathura->jumplist.cur)) {
|
||||
girara_list_iterator_previous(zathura->jumplist.cur);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
zathura_jumplist_append_jump(zathura_t* zathura) {
|
||||
zathura_jumplist_append_jump(zathura_t* zathura)
|
||||
{
|
||||
zathura_jump_t *jump = g_malloc(sizeof(zathura_jump_t));
|
||||
if (jump != NULL) {
|
||||
jump->page = 0;
|
||||
|
@ -1109,7 +1109,8 @@ zathura_jumplist_append_jump(zathura_t* zathura) {
|
|||
}
|
||||
|
||||
void
|
||||
zathura_jumplist_add(zathura_t* zathura) {
|
||||
zathura_jumplist_add(zathura_t* zathura)
|
||||
{
|
||||
if (zathura->jumplist.list != NULL) {
|
||||
unsigned int pagenum = zathura_document_get_current_page_number(zathura->document);
|
||||
zathura_jump_t* cur = zathura_jumplist_current(zathura);
|
||||
|
@ -1125,7 +1126,8 @@ zathura_jumplist_add(zathura_t* zathura) {
|
|||
|
||||
|
||||
void
|
||||
zathura_jumplist_save(zathura_t* zathura) {
|
||||
zathura_jumplist_save(zathura_t* zathura)
|
||||
{
|
||||
zathura_jump_t* cur = zathura_jumplist_current(zathura);
|
||||
|
||||
unsigned int pagenum = zathura_document_get_current_page_number(zathura->document);
|
||||
|
|
Loading…
Reference in a new issue