mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 11:36:01 +01:00
Merge branch 'develop' of pwmt.org:zathura into develop
This commit is contained in:
commit
51d927c6da
2 changed files with 30 additions and 18 deletions
37
callbacks.c
37
callbacks.c
|
@ -32,8 +32,7 @@ cb_buffer_changed(girara_session_t* session)
|
||||||
zathura_t* zathura = session->global.data;
|
zathura_t* zathura = session->global.data;
|
||||||
|
|
||||||
char* buffer = girara_buffer_get(session);
|
char* buffer = girara_buffer_get(session);
|
||||||
|
if (buffer != NULL) {
|
||||||
if (buffer) {
|
|
||||||
girara_statusbar_item_set_text(session, zathura->ui.statusbar.buffer, buffer);
|
girara_statusbar_item_set_text(session, zathura->ui.statusbar.buffer, buffer);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,7 +44,8 @@ void
|
||||||
cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpointer data)
|
cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpointer data)
|
||||||
{
|
{
|
||||||
zathura_t* zathura = data;
|
zathura_t* zathura = data;
|
||||||
if (!zathura || !zathura->document || !zathura->document->pages || !zathura->ui.page_widget) {
|
if (zathura == NULL || zathura->document == NULL || zathura->document->pages == NULL
|
||||||
|
|| zathura->ui.page_widget == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +54,10 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
|
||||||
|
|
||||||
GdkRectangle view_rect;
|
GdkRectangle view_rect;
|
||||||
/* get current adjustment values */
|
/* get current adjustment values */
|
||||||
view_rect.y = gtk_adjustment_get_value(view_vadjustment);
|
view_rect.y = gtk_adjustment_get_value(view_vadjustment);
|
||||||
view_rect.height = gtk_adjustment_get_page_size(view_vadjustment);
|
view_rect.height = gtk_adjustment_get_page_size(view_vadjustment);
|
||||||
view_rect.x = gtk_adjustment_get_value(view_hadjustment);
|
view_rect.x = gtk_adjustment_get_value(view_hadjustment);
|
||||||
view_rect.width = gtk_adjustment_get_page_size(view_hadjustment);
|
view_rect.width = gtk_adjustment_get_page_size(view_hadjustment);
|
||||||
|
|
||||||
int page_padding = 1;
|
int page_padding = 1;
|
||||||
girara_setting_get(zathura->ui.session, "page-padding", &page_padding);
|
girara_setting_get(zathura->ui.session, "page-padding", &page_padding);
|
||||||
|
@ -65,12 +65,11 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
|
||||||
GdkRectangle center;
|
GdkRectangle center;
|
||||||
center.x = view_rect.x + (view_rect.width + 1) / 2;
|
center.x = view_rect.x + (view_rect.width + 1) / 2;
|
||||||
center.y = view_rect.y + (view_rect.height + 1) / 2;
|
center.y = view_rect.y + (view_rect.height + 1) / 2;
|
||||||
center.height = center.width = 2*page_padding + 1;
|
center.height = center.width = (2 * page_padding) + 1;
|
||||||
|
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
/* find page that fits */
|
/* find page that fits */
|
||||||
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; page_id++)
|
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; page_id++) {
|
||||||
{
|
|
||||||
zathura_page_t* page = zathura->document->pages[page_id];
|
zathura_page_t* page = zathura->document->pages[page_id];
|
||||||
|
|
||||||
page_offset_t offset;
|
page_offset_t offset;
|
||||||
|
@ -79,7 +78,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
|
||||||
GdkRectangle page_rect;
|
GdkRectangle page_rect;
|
||||||
page_rect.x = offset.x;
|
page_rect.x = offset.x;
|
||||||
page_rect.y = offset.y;
|
page_rect.y = offset.y;
|
||||||
page_rect.width = page->width * zathura->document->scale;
|
page_rect.width = page->width * zathura->document->scale;
|
||||||
page_rect.height = page->height * zathura->document->scale;
|
page_rect.height = page->height * zathura->document->scale;
|
||||||
|
|
||||||
if (gdk_rectangle_intersect(&view_rect, &page_rect, NULL) == TRUE) {
|
if (gdk_rectangle_intersect(&view_rect, &page_rect, NULL) == TRUE) {
|
||||||
|
@ -133,8 +132,7 @@ cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
|
||||||
|
|
||||||
g_object_get(tree_view, "model", &model, NULL);
|
g_object_get(tree_view, "model", &model, NULL);
|
||||||
|
|
||||||
if(gtk_tree_model_get_iter(model, &iter, path))
|
if(gtk_tree_model_get_iter(model, &iter, path)) {
|
||||||
{
|
|
||||||
zathura_index_element_t* index_element;
|
zathura_index_element_t* index_element;
|
||||||
gtk_tree_model_get(model, &iter, 2, &index_element, -1);
|
gtk_tree_model_get(model, &iter, 2, &index_element, -1);
|
||||||
|
|
||||||
|
@ -238,10 +236,18 @@ static gboolean
|
||||||
password_dialog(gpointer data)
|
password_dialog(gpointer data)
|
||||||
{
|
{
|
||||||
zathura_password_dialog_info_t* dialog = data;
|
zathura_password_dialog_info_t* dialog = data;
|
||||||
|
|
||||||
if (dialog != NULL) {
|
if (dialog != NULL) {
|
||||||
girara_dialog(dialog->zathura->ui.session, "Incorrect password. Enter password:", true, NULL,
|
girara_dialog(
|
||||||
(girara_callback_inputbar_activate_t) cb_password_dialog, dialog);
|
dialog->zathura->ui.session,
|
||||||
|
"Incorrect password. Enter password:",
|
||||||
|
true,
|
||||||
|
NULL,
|
||||||
|
(girara_callback_inputbar_activate_t) cb_password_dialog,
|
||||||
|
dialog
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +315,8 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t*
|
||||||
if (width != allocation->width || height != allocation->height) {
|
if (width != allocation->width || height != allocation->height) {
|
||||||
girara_argument_t argument = { zathura->document->adjust_mode, NULL };
|
girara_argument_t argument = { zathura->document->adjust_mode, NULL };
|
||||||
sc_adjust_window(zathura->ui.session, &argument, NULL, 0);
|
sc_adjust_window(zathura->ui.session, &argument, NULL, 0);
|
||||||
width = allocation->width;
|
|
||||||
|
width = allocation->width;
|
||||||
height = allocation->height;
|
height = allocation->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,8 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file)
|
||||||
girara_list_append(result, bookmark);
|
girara_list_append(result, bookmark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_strfreev(keys);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,11 +262,14 @@ zathura_db_get_fileinfo(zathura_database_t* db, const char* file, unsigned int*
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*page = g_key_file_get_integer(db->history, file, KEY_PAGE, NULL);
|
*page = g_key_file_get_integer(db->history, file, KEY_PAGE, NULL);
|
||||||
*offset = g_key_file_get_integer(db->history, file, KEY_OFFSET, NULL);
|
*offset = g_key_file_get_integer(db->history, file, KEY_OFFSET, NULL);
|
||||||
*scale = strtod(g_key_file_get_string(db->history, file, KEY_SCALE, NULL), NULL);
|
|
||||||
*rotation = g_key_file_get_integer(db->history, file, KEY_ROTATE, NULL);
|
*rotation = g_key_file_get_integer(db->history, file, KEY_ROTATE, NULL);
|
||||||
|
|
||||||
|
char* scale_string = g_key_file_get_string(db->history, file, KEY_SCALE, NULL);
|
||||||
|
*scale = strtod(scale_string, NULL);
|
||||||
|
g_free(scale_string);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue