mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 09:26:00 +01:00
parent
10b5006828
commit
c75eaf4c43
4 changed files with 14 additions and 4 deletions
|
@ -262,8 +262,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
zathura_db_get_fileinfo(zathura->database, document->file_path,
|
zathura_db_get_fileinfo(zathura->database, document->file_path,
|
||||||
&document->current_page_number, &offset, &document->scale);
|
&document->current_page_number, &offset, &document->scale);
|
||||||
if (document->scale <= 0)
|
if (document->scale <= FLT_EPSILON) {
|
||||||
{
|
|
||||||
girara_warning("document info: '%s' has non positive scale", document->file_path);
|
girara_warning("document info: '%s' has non positive scale", document->file_path);
|
||||||
document->scale = 1;
|
document->scale = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,7 +455,7 @@ sc_toggle_index(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_widget_get_visible(GTK_WIDGET(zathura->ui.index))) {
|
if (gtk_widget_get_visible(GTK_WIDGET(zathura->ui.index))) {
|
||||||
girara_set_view(session, zathura->ui.page_view);
|
girara_set_view(session, zathura->ui.page_view_alignment);
|
||||||
gtk_widget_hide(GTK_WIDGET(zathura->ui.index));
|
gtk_widget_hide(GTK_WIDGET(zathura->ui.index));
|
||||||
girara_mode_set(zathura->ui.session, zathura->modes.normal);
|
girara_mode_set(zathura->ui.session, zathura->modes.normal);
|
||||||
} else {
|
} else {
|
||||||
|
|
12
zathura.c
12
zathura.c
|
@ -166,6 +166,13 @@ zathura_init(int argc, char* argv[])
|
||||||
GtkAdjustment* view_hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
|
GtkAdjustment* view_hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
|
||||||
g_signal_connect(G_OBJECT(view_hadjustment), "value-changed", G_CALLBACK(cb_view_vadjustment_value_changed), zathura);
|
g_signal_connect(G_OBJECT(view_hadjustment), "value-changed", G_CALLBACK(cb_view_vadjustment_value_changed), zathura);
|
||||||
|
|
||||||
|
/* page view alignment */
|
||||||
|
zathura->ui.page_view_alignment = gtk_alignment_new(0.5, 0.5, 0, 0);
|
||||||
|
if (!zathura->ui.page_view_alignment) {
|
||||||
|
goto error_free;
|
||||||
|
}
|
||||||
|
gtk_container_add(GTK_CONTAINER(zathura->ui.page_view_alignment), zathura->ui.page_view);
|
||||||
|
|
||||||
gtk_widget_show(zathura->ui.page_view);
|
gtk_widget_show(zathura->ui.page_view);
|
||||||
|
|
||||||
/* statusbar */
|
/* statusbar */
|
||||||
|
@ -238,6 +245,9 @@ error_free:
|
||||||
g_object_unref(zathura->ui.page_view);
|
g_object_unref(zathura->ui.page_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zathura->ui.page_view_alignment) {
|
||||||
|
g_object_unref(zathura->ui.page_view_alignment);
|
||||||
|
}
|
||||||
|
|
||||||
error_out:
|
error_out:
|
||||||
|
|
||||||
|
@ -394,7 +404,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
|
||||||
g_free(value);
|
g_free(value);
|
||||||
page_view_set_mode(zathura, pages_per_row);
|
page_view_set_mode(zathura, pages_per_row);
|
||||||
|
|
||||||
girara_set_view(zathura->ui.session, zathura->ui.page_view);
|
girara_set_view(zathura->ui.session, zathura->ui.page_view_alignment);
|
||||||
|
|
||||||
/* threads */
|
/* threads */
|
||||||
zathura->sync.render_thread = render_init(zathura);
|
zathura->sync.render_thread = render_init(zathura);
|
||||||
|
|
|
@ -51,6 +51,7 @@ typedef struct zathura_s
|
||||||
GdkColor recolor_light_color; /**> Light color for recoloring */
|
GdkColor recolor_light_color; /**> Light color for recoloring */
|
||||||
} colors;
|
} colors;
|
||||||
|
|
||||||
|
GtkWidget *page_view_alignment;
|
||||||
GtkWidget *page_view; /**> Widget that contains all rendered pages */
|
GtkWidget *page_view; /**> Widget that contains all rendered pages */
|
||||||
GtkWidget *index; /**> Widget to show the index of the document */
|
GtkWidget *index; /**> Widget to show the index of the document */
|
||||||
} ui;
|
} ui;
|
||||||
|
|
Loading…
Reference in a new issue