mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-06 05:34:57 +01:00
Merge branch 'develop' of pwmt.org:zathura into develop
This commit is contained in:
commit
90eb74102e
6 changed files with 23 additions and 24 deletions
|
@ -82,10 +82,12 @@ cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
|
|||
}
|
||||
|
||||
void
|
||||
cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), girara_setting_t* setting)
|
||||
cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* data)
|
||||
{
|
||||
int pages_per_row = setting->value.i;
|
||||
zathura_t* zathura = setting->data;
|
||||
g_return_if_fail(value != NULL);
|
||||
|
||||
int pages_per_row = *(int*) value;
|
||||
zathura_t* zathura = data;
|
||||
|
||||
if (pages_per_row < 1) {
|
||||
pages_per_row = 1;
|
||||
|
|
|
@ -39,7 +39,7 @@ void cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
|
|||
* @param session The current girara session
|
||||
* @param setting The "pages-per-row" setting
|
||||
*/
|
||||
void cb_pages_per_row_value_changed(girara_session_t* session, girara_setting_t* setting);
|
||||
void cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* data);
|
||||
|
||||
/**
|
||||
* Called when an index element is activated (e.g.: double click)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#define _POSIX_SOURCE
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -295,28 +297,26 @@ zathura_db_read_key_file_from_file(const char* path)
|
|||
}
|
||||
|
||||
/* open file */
|
||||
int fd = open(path, O_RDWR);
|
||||
if (fd == -1) {
|
||||
FILE* file = fopen(path, "r");
|
||||
if (file == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GKeyFile* key_file = g_key_file_new();
|
||||
if (key_file == NULL) {
|
||||
close(fd);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read config file */
|
||||
file_lock_set(fd, F_WRLCK);
|
||||
char* content = girara_file_read_from_fd(fd);
|
||||
file_lock_set(fileno(file), F_WRLCK);
|
||||
char* content = girara_file_read2(file);
|
||||
file_lock_set(fileno(file), F_UNLCK);
|
||||
fclose(file);
|
||||
if (content == NULL) {
|
||||
file_lock_set(fd, F_UNLCK);
|
||||
close(fd);
|
||||
g_key_file_free(key_file);
|
||||
return NULL;
|
||||
}
|
||||
file_lock_set(fd, F_UNLCK);
|
||||
|
||||
close(fd);
|
||||
|
||||
/* parse config file */
|
||||
size_t contentlen = strlen(content);
|
||||
|
@ -369,7 +369,9 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file)
|
|||
}
|
||||
|
||||
file_lock_set(fd, F_WRLCK);
|
||||
write(fd, content, strlen(content));
|
||||
if (write(fd, content, strlen(content)) == 0) {
|
||||
girara_error("Failed to write to %s", file);
|
||||
}
|
||||
file_lock_set(fd, F_UNLCK);
|
||||
|
||||
close(fd);
|
||||
|
|
|
@ -42,6 +42,7 @@ zathura_document_plugins_load(zathura_t* zathura)
|
|||
DIR* dir = opendir(plugindir);
|
||||
if (dir == NULL) {
|
||||
girara_error("could not open plugin directory: %s", plugindir);
|
||||
girara_list_iterator_next(iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
|
|||
int* tmp = girara_setting_get(session, "pages-per-row");
|
||||
if (tmp != NULL) {
|
||||
pages_per_row = *tmp;
|
||||
free(tmp);
|
||||
g_free(tmp);
|
||||
}
|
||||
|
||||
/* set single view */
|
||||
|
|
10
zathura.h
10
zathura.h
|
@ -5,16 +5,10 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <girara/types.h>
|
||||
#include <girara/macros.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef UNUSED
|
||||
#elif defined(__GNUC__)
|
||||
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
|
||||
#elif defined(__LCINT__)
|
||||
# define UNUSED(x) /*@unused@*/ x
|
||||
#else
|
||||
# define UNUSED(x) x
|
||||
#endif
|
||||
#define UNUSED(x) GIRARA_UNUSED(x)
|
||||
|
||||
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
||||
DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
|
||||
|
|
Loading…
Reference in a new issue