Update style

This commit is contained in:
Moritz Lipp 2012-10-09 01:12:18 +02:00
parent 41cb60e5c6
commit 89e7832047
20 changed files with 451 additions and 460 deletions

View file

@ -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);

View file

@ -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
}; };
@ -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, 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);

View file

@ -33,8 +33,7 @@ typedef struct zathura_sqldatabase_private_s {
#define ZATHURA_SQLDATABASE_GET_PRIVATE(obj) \ #define ZATHURA_SQLDATABASE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_SQLDATABASE, zathura_sqldatabase_private_t)) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_SQLDATABASE, zathura_sqldatabase_private_t))
enum enum {
{
PROP_0, PROP_0,
PROP_PATH PROP_PATH
}; };

View file

@ -36,8 +36,7 @@ static const gchar* guess_type(const char* path);
/** /**
* Document * Document
*/ */
struct zathura_document_s struct zathura_document_s {
{
char* file_path; /**< File path of the document */ char* file_path; /**< File path of the document */
const char* password; /**< Password of the document */ const char* password; /**< Password of the document */
unsigned int current_page_number; /**< Current page number */ unsigned int current_page_number; /**< Current page number */

View file

@ -10,8 +10,7 @@
#include "document.h" #include "document.h"
#include "utils.h" #include "utils.h"
struct zathura_link_s struct zathura_link_s {
{
zathura_rectangle_t position; /**< Position of the link */ zathura_rectangle_t position; /**< Position of the link */
zathura_link_type_t type; /**< Link type */ zathura_link_type_t type; /**< Link type */
zathura_link_target_t target; /**< Link target */ zathura_link_target_t target; /**< Link target */

View file

@ -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_copy(GtkMenuItem* item, ZathuraPage* page);
static void cb_menu_image_save(GtkMenuItem* item, ZathuraPage* page); static void cb_menu_image_save(GtkMenuItem* item, ZathuraPage* page);
enum properties_e enum properties_e {
{
PROP_0, PROP_0,
PROP_PAGE, PROP_PAGE,
PROP_ZATHURA, PROP_ZATHURA,

View file

@ -14,8 +14,7 @@
/** /**
* Document plugin structure * Document plugin structure
*/ */
struct zathura_plugin_s struct zathura_plugin_s {
{
girara_list_t* content_types; /**< List of supported content types */ girara_list_t* content_types; /**< List of supported content types */
zathura_plugin_register_function_t register_function; /**< Document open function */ zathura_plugin_register_function_t register_function; /**< Document open function */
zathura_plugin_functions_t functions; /**< Document functions */ zathura_plugin_functions_t functions; /**< Document functions */
@ -28,8 +27,7 @@ struct zathura_plugin_s
/** /**
* Plugin mapping * Plugin mapping
*/ */
typedef struct zathura_type_plugin_mapping_s typedef struct zathura_type_plugin_mapping_s {
{
const gchar* type; /**< Plugin type */ const gchar* type; /**< Plugin type */
zathura_plugin_t* plugin; /**< Mapped plugin */ zathura_plugin_t* plugin; /**< Mapped plugin */
} zathura_type_plugin_mapping_t; } zathura_type_plugin_mapping_t;
@ -37,8 +35,7 @@ typedef struct zathura_type_plugin_mapping_s
/** /**
* Plugin manager * Plugin manager
*/ */
struct zathura_plugin_manager_s struct zathura_plugin_manager_s {
{
girara_list_t* plugins; /**< List of plugins */ girara_list_t* plugins; /**< List of plugins */
girara_list_t* path; /**< List of plugin paths */ girara_list_t* path; /**< List of plugin paths */
girara_list_t* type_plugin_mapping; /**< List of type -> plugin mappings */ 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*/ /* resolve symbols and check API and ABI version*/
zathura_plugin_api_version_t api_version = NULL; zathura_plugin_api_version_t api_version = NULL;
if (g_module_symbol(handle, PLUGIN_API_VERSION_FUNCTION, (gpointer*) &api_version) == FALSE || 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); girara_error("could not find '%s' function in plugin %s", PLUGIN_API_VERSION_FUNCTION, path);
g_free(path); g_free(path);
g_module_close(handle); 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; zathura_plugin_abi_version_t abi_version = NULL;
if (g_module_symbol(handle, PLUGIN_ABI_VERSION_FUNCTION, (gpointer*) &abi_version) == FALSE || 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); girara_error("could not find '%s' function in plugin %s", PLUGIN_ABI_VERSION_FUNCTION, path);
g_free(path); g_free(path);
g_module_close(handle); 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; zathura_plugin_register_service_t register_service = NULL;
if (g_module_symbol(handle, PLUGIN_REGISTER_FUNCTION, (gpointer*) &register_service) == FALSE || if (g_module_symbol(handle, PLUGIN_REGISTER_FUNCTION, (gpointer*) &register_service) == FALSE ||
register_service == NULL) register_service == NULL) {
{
girara_error("could not find '%s' function in plugin %s", PLUGIN_REGISTER_FUNCTION, path); girara_error("could not find '%s' function in plugin %s", PLUGIN_REGISTER_FUNCTION, path);
g_free(path); g_free(path);
g_module_close(handle); g_module_close(handle);

View file

@ -17,8 +17,7 @@ static void render_job(void* data, void* user_data);
static bool render(zathura_t* zathura, zathura_page_t* page); static bool render(zathura_t* zathura, zathura_page_t* page);
static gint render_thread_sort(gconstpointer a, gconstpointer b, gpointer data); static gint render_thread_sort(gconstpointer a, gconstpointer b, gpointer data);
struct render_thread_s struct render_thread_s {
{
GThreadPool* pool; /**< Pool of threads */ GThreadPool* pool; /**< Pool of threads */
GStaticMutex mutex; /**< Render lock */ GStaticMutex mutex; /**< Render lock */
bool about_to_close; /**< Render thread is to be freed */ bool about_to_close; /**< Render thread is to be freed */

View file

@ -103,7 +103,8 @@ synctex_record_hits(zathura_t* zathura, int page_idx, girara_list_t* hits, bool
} }
static double static double
scan_float(GScanner* scanner) { scan_float(GScanner* scanner)
{
switch (g_scanner_get_next_token(scanner)) { switch (g_scanner_get_next_token(scanner)) {
case G_TOKEN_FLOAT: case G_TOKEN_FLOAT:
return g_scanner_cur_value(scanner).v_float; return g_scanner_cur_value(scanner).v_float;

View file

@ -34,8 +34,7 @@ file_get_extension(const char* path)
} }
unsigned int i = strlen(path); unsigned int i = strlen(path);
for (; i > 0; i--) for (; i > 0; i--) {
{
if (*(path + i) != '.') { if (*(path + i) != '.') {
continue; continue;
} else { } else {

View file

@ -33,21 +33,18 @@
#include "page-widget.h" #include "page-widget.h"
#include "plugin.h" #include "plugin.h"
typedef struct zathura_document_info_s typedef struct zathura_document_info_s {
{
zathura_t* zathura; zathura_t* zathura;
const char* path; const char* path;
const char* password; const char* password;
} zathura_document_info_t; } zathura_document_info_t;
typedef struct page_set_delayed_s typedef struct page_set_delayed_s {
{
zathura_t* zathura; zathura_t* zathura;
unsigned int page; unsigned int page;
} page_set_delayed_t; } page_set_delayed_t;
typedef struct position_set_delayed_s typedef struct position_set_delayed_s {
{
zathura_t* zathura; zathura_t* zathura;
double position_x; double position_x;
double position_y; double position_y;
@ -755,8 +752,7 @@ document_save(zathura_t* zathura, const char* path, bool overwrite)
g_return_val_if_fail(path, false); g_return_val_if_fail(path, false);
gchar* file_path = girara_fix_path(path); 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); girara_error("File already exists: %s. Use :write! to overwrite it.", file_path);
g_free(file_path); g_free(file_path);
return false; return false;
@ -1054,7 +1050,8 @@ position_set_delayed(zathura_t* zathura, double position_x, double position_y)
zathura_jump_t* zathura_jump_t*
zathura_jumplist_current(zathura_t* zathura) { zathura_jumplist_current(zathura_t* zathura)
{
if (zathura->jumplist.cur != NULL) { if (zathura->jumplist.cur != NULL) {
return girara_list_iterator_data(zathura->jumplist.cur); return girara_list_iterator_data(zathura->jumplist.cur);
} else { } else {
@ -1063,21 +1060,24 @@ zathura_jumplist_current(zathura_t* zathura) {
} }
void void
zathura_jumplist_forward(zathura_t* zathura) { zathura_jumplist_forward(zathura_t* zathura)
{
if (girara_list_iterator_has_next(zathura->jumplist.cur)) { if (girara_list_iterator_has_next(zathura->jumplist.cur)) {
girara_list_iterator_next(zathura->jumplist.cur); girara_list_iterator_next(zathura->jumplist.cur);
} }
} }
void void
zathura_jumplist_backward(zathura_t* zathura) { zathura_jumplist_backward(zathura_t* zathura)
{
if (girara_list_iterator_has_previous(zathura->jumplist.cur)) { if (girara_list_iterator_has_previous(zathura->jumplist.cur)) {
girara_list_iterator_previous(zathura->jumplist.cur); girara_list_iterator_previous(zathura->jumplist.cur);
} }
} }
void 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)); zathura_jump_t *jump = g_malloc(sizeof(zathura_jump_t));
if (jump != NULL) { if (jump != NULL) {
jump->page = 0; jump->page = 0;
@ -1109,7 +1109,8 @@ zathura_jumplist_append_jump(zathura_t* zathura) {
} }
void void
zathura_jumplist_add(zathura_t* zathura) { zathura_jumplist_add(zathura_t* zathura)
{
if (zathura->jumplist.list != NULL) { if (zathura->jumplist.list != NULL) {
unsigned int pagenum = zathura_document_get_current_page_number(zathura->document); unsigned int pagenum = zathura_document_get_current_page_number(zathura->document);
zathura_jump_t* cur = zathura_jumplist_current(zathura); zathura_jump_t* cur = zathura_jumplist_current(zathura);
@ -1125,7 +1126,8 @@ zathura_jumplist_add(zathura_t* zathura) {
void void
zathura_jumplist_save(zathura_t* zathura) { zathura_jumplist_save(zathura_t* zathura)
{
zathura_jump_t* cur = zathura_jumplist_current(zathura); zathura_jump_t* cur = zathura_jumplist_current(zathura);
unsigned int pagenum = zathura_document_get_current_page_number(zathura->document); unsigned int pagenum = zathura_document_get_current_page_number(zathura->document);