mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 18:36:00 +01:00
adopt to changes from girara
This commit is contained in:
parent
8d2d6ec0ec
commit
083a40f447
3 changed files with 29 additions and 50 deletions
12
render.c
12
render.c
|
@ -325,14 +325,10 @@ page_expose_event(GtkWidget* UNUSED(widget), GdkEventExpose* UNUSED(event),
|
|||
cairo_rectangle(cairo, 0, 0, page_width, page->height * page->height);
|
||||
cairo_fill(cairo);
|
||||
|
||||
bool render_loading = false;
|
||||
bool* tmp = (page->document != NULL && page->document->zathura != NULL &&
|
||||
page->document->zathura->ui.session != NULL) ?
|
||||
girara_setting_get(page->document->zathura->ui.session, "render-loading") : NULL;
|
||||
if (tmp != NULL) {
|
||||
render_loading = *tmp;
|
||||
g_free(tmp);
|
||||
}
|
||||
bool render_loading = true;
|
||||
if (page->document != NULL && page->document->zathura != NULL &&
|
||||
page->document->zathura->ui.session != NULL)
|
||||
girara_setting_get(page->document->zathura->ui.session, "render-loading", &render_loading);
|
||||
|
||||
/* write text */
|
||||
if (render_loading == true) {
|
||||
|
|
48
shortcuts.c
48
shortcuts.c
|
@ -33,9 +33,10 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
|
|||
zathura_t* zathura = session->global.data;
|
||||
g_return_val_if_fail(argument != NULL, false);
|
||||
|
||||
unsigned int* pages_per_row = girara_setting_get(session, "pages-per-row");
|
||||
unsigned int pages_per_row = 1;
|
||||
girara_setting_get(session, "pages-per-row", &pages_per_row);
|
||||
|
||||
if (zathura->ui.page_view == NULL || zathura->document == NULL || pages_per_row == NULL) {
|
||||
if (zathura->ui.page_view == NULL || zathura->document == NULL) {
|
||||
goto error_ret;
|
||||
}
|
||||
|
||||
|
@ -49,14 +50,14 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
|
|||
double total_width = 0;
|
||||
double max_height = 0;
|
||||
|
||||
for (unsigned int page_id = 0; page_id < *pages_per_row; page_id++) {
|
||||
for (unsigned int page_id = 0; page_id < pages_per_row; page_id++) {
|
||||
if (page_id == zathura->document->number_of_pages) {
|
||||
break;
|
||||
}
|
||||
|
||||
zathura_page_t* page = zathura->document->pages[page_id];
|
||||
if (page == NULL) {
|
||||
goto error_free;
|
||||
goto error_ret;
|
||||
}
|
||||
|
||||
if (page->height > max_height) {
|
||||
|
@ -71,17 +72,12 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
|
|||
} else if (argument->n == ADJUST_BESTFIT) {
|
||||
zathura->document->scale = height / max_height;
|
||||
} else {
|
||||
goto error_free;
|
||||
goto error_ret;
|
||||
}
|
||||
|
||||
/* re-render all pages */
|
||||
render_all(zathura);
|
||||
|
||||
error_free:
|
||||
|
||||
/* cleanup */
|
||||
g_free(pages_per_row);
|
||||
|
||||
error_ret:
|
||||
|
||||
return false;
|
||||
|
@ -110,14 +106,11 @@ sc_follow(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
|||
return false;
|
||||
}
|
||||
|
||||
char* font = girara_setting_get(session, "font");
|
||||
char* font = NULL;
|
||||
girara_setting_get(session, "font", &font);
|
||||
|
||||
float transparency = 0.5;
|
||||
float* tmp = girara_setting_get(session, "highlight-transparency");
|
||||
if (tmp != NULL) {
|
||||
transparency = *tmp;
|
||||
g_free(tmp);
|
||||
}
|
||||
girara_setting_get(session, "highlight-transparency", &transparency);
|
||||
|
||||
unsigned int link_id = 0;
|
||||
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; page_id++) {
|
||||
|
@ -296,12 +289,8 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
|
|||
gdouble view_size = gtk_adjustment_get_page_size(adjustment);
|
||||
gdouble value = gtk_adjustment_get_value(adjustment);
|
||||
gdouble max = gtk_adjustment_get_upper(adjustment) - view_size;
|
||||
gdouble scroll_step = 40;
|
||||
float* tmp = girara_setting_get(session, "scroll-step");
|
||||
if (tmp != NULL) {
|
||||
scroll_step = *tmp;
|
||||
g_free(tmp);
|
||||
}
|
||||
float scroll_step = 40;
|
||||
girara_setting_get(session, "scroll-step", &scroll_step);
|
||||
gdouble new_value;
|
||||
|
||||
switch(argument->n) {
|
||||
|
@ -566,11 +555,7 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
|
|||
render_all(zathura);
|
||||
} else {
|
||||
/* backup pages per row */
|
||||
int* tmp = girara_setting_get(session, "pages-per-row");
|
||||
if (tmp != NULL) {
|
||||
pages_per_row = *tmp;
|
||||
g_free(tmp);
|
||||
}
|
||||
girara_setting_get(session, "pages-per-row", &pages_per_row);
|
||||
|
||||
/* set single view */
|
||||
int int_value = 1;
|
||||
|
@ -621,13 +606,10 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
|||
g_return_val_if_fail(zathura->document != NULL, false);
|
||||
|
||||
/* retreive zoom step value */
|
||||
int* value = girara_setting_get(zathura->ui.session, "zoom-step");
|
||||
if (value == NULL) {
|
||||
return false;
|
||||
}
|
||||
int value = 1;
|
||||
girara_setting_get(zathura->ui.session, "zoom-step", &value);
|
||||
|
||||
float zoom_step = *value / 100.0f;
|
||||
g_free(value);
|
||||
float zoom_step = value / 100.0f;
|
||||
|
||||
if (argument->n == ZOOM_IN) {
|
||||
zathura->document->scale += zoom_step;
|
||||
|
|
19
zathura.c
19
zathura.c
|
@ -212,27 +212,29 @@ zathura_init(int argc, char* argv[])
|
|||
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL);
|
||||
|
||||
/* save page padding */
|
||||
int* page_padding = girara_setting_get(zathura->ui.session, "page-padding");
|
||||
zathura->global.page_padding = (page_padding) ? *page_padding : 1;
|
||||
g_free(page_padding);
|
||||
zathura->global.page_padding = 1;
|
||||
girara_setting_get(zathura->ui.session, "page-padding", &zathura->global.page_padding);
|
||||
|
||||
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_view), zathura->global.page_padding);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_view), zathura->global.page_padding);
|
||||
|
||||
/* parse colors */
|
||||
char* string_value = girara_setting_get(zathura->ui.session, "recolor-darkcolor");
|
||||
char* string_value = NULL;
|
||||
girara_setting_get(zathura->ui.session, "recolor-darkcolor", &string_value);
|
||||
if (string_value != NULL) {
|
||||
gdk_color_parse(string_value, &(zathura->ui.colors.recolor_dark_color));
|
||||
g_free(string_value);
|
||||
}
|
||||
|
||||
string_value = girara_setting_get(zathura->ui.session, "recolor-lightcolor");
|
||||
string_value = NULL;
|
||||
girara_setting_get(zathura->ui.session, "recolor-lightcolor", &string_value);
|
||||
if (string_value != NULL) {
|
||||
gdk_color_parse(string_value, &(zathura->ui.colors.recolor_light_color));
|
||||
g_free(string_value);
|
||||
}
|
||||
|
||||
string_value = girara_setting_get(zathura->ui.session, "highlight-color");
|
||||
string_value = NULL;
|
||||
girara_setting_get(zathura->ui.session, "highlight-color", &string_value);
|
||||
if (string_value != NULL) {
|
||||
gdk_color_parse(string_value, &(zathura->ui.colors.highlight_color));
|
||||
g_free(string_value);
|
||||
|
@ -420,9 +422,8 @@ document_open(zathura_t* zathura, const char* path, const char* password)
|
|||
zathura->document = document;
|
||||
|
||||
/* view mode */
|
||||
int* value = girara_setting_get(zathura->ui.session, "pages-per-row");
|
||||
int pages_per_row = (value) ? *value : 1;
|
||||
g_free(value);
|
||||
int pages_per_row = 1;
|
||||
girara_setting_get(zathura->ui.session, "pages-per-row", &pages_per_row);
|
||||
page_view_set_mode(zathura, pages_per_row);
|
||||
|
||||
girara_set_view(zathura->ui.session, zathura->ui.page_view_alignment);
|
||||
|
|
Loading…
Reference in a new issue