mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-06 08:34:56 +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
|
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;
|
g_return_if_fail(value != NULL);
|
||||||
zathura_t* zathura = setting->data;
|
|
||||||
|
int pages_per_row = *(int*) value;
|
||||||
|
zathura_t* zathura = data;
|
||||||
|
|
||||||
if (pages_per_row < 1) {
|
if (pages_per_row < 1) {
|
||||||
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 session The current girara session
|
||||||
* @param setting The "pages-per-row" setting
|
* @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)
|
* Called when an index element is activated (e.g.: double click)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/* See LICENSE file for license and copyright information */
|
/* See LICENSE file for license and copyright information */
|
||||||
|
|
||||||
|
#define _POSIX_SOURCE
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -295,28 +297,26 @@ zathura_db_read_key_file_from_file(const char* path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open file */
|
/* open file */
|
||||||
int fd = open(path, O_RDWR);
|
FILE* file = fopen(path, "r");
|
||||||
if (fd == -1) {
|
if (file == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GKeyFile* key_file = g_key_file_new();
|
GKeyFile* key_file = g_key_file_new();
|
||||||
if (key_file == NULL) {
|
if (key_file == NULL) {
|
||||||
close(fd);
|
fclose(file);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read config file */
|
/* read config file */
|
||||||
file_lock_set(fd, F_WRLCK);
|
file_lock_set(fileno(file), F_WRLCK);
|
||||||
char* content = girara_file_read_from_fd(fd);
|
char* content = girara_file_read2(file);
|
||||||
|
file_lock_set(fileno(file), F_UNLCK);
|
||||||
|
fclose(file);
|
||||||
if (content == NULL) {
|
if (content == NULL) {
|
||||||
file_lock_set(fd, F_UNLCK);
|
g_key_file_free(key_file);
|
||||||
close(fd);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
file_lock_set(fd, F_UNLCK);
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
/* parse config file */
|
/* parse config file */
|
||||||
size_t contentlen = strlen(content);
|
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);
|
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);
|
file_lock_set(fd, F_UNLCK);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
@ -42,6 +42,7 @@ zathura_document_plugins_load(zathura_t* zathura)
|
||||||
DIR* dir = opendir(plugindir);
|
DIR* dir = opendir(plugindir);
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
girara_error("could not open plugin directory: %s", plugindir);
|
girara_error("could not open plugin directory: %s", plugindir);
|
||||||
|
girara_list_iterator_next(iter);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,7 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
|
||||||
int* tmp = girara_setting_get(session, "pages-per-row");
|
int* tmp = girara_setting_get(session, "pages-per-row");
|
||||||
if (tmp != NULL) {
|
if (tmp != NULL) {
|
||||||
pages_per_row = *tmp;
|
pages_per_row = *tmp;
|
||||||
free(tmp);
|
g_free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set single view */
|
/* set single view */
|
||||||
|
|
10
zathura.h
10
zathura.h
|
@ -5,16 +5,10 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <girara/types.h>
|
#include <girara/types.h>
|
||||||
|
#include <girara/macros.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#ifdef UNUSED
|
#define UNUSED(x) GIRARA_UNUSED(x)
|
||||||
#elif defined(__GNUC__)
|
|
||||||
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
|
|
||||||
#elif defined(__LCINT__)
|
|
||||||
# define UNUSED(x) /*@unused@*/ x
|
|
||||||
#else
|
|
||||||
# define UNUSED(x) x
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
||||||
DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
|
DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
|
||||||
|
|
Loading…
Reference in a new issue