Commit bbb08b17 authored by Sebastian Ramacher's avatar Sebastian Ramacher

g_object_ref the print settings (as seen in the GTK+ documentation)

parent 0848c39c
......@@ -270,3 +270,4 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list)
return true;
}
......@@ -232,3 +232,4 @@ zathura_db_get_fileinfo(zathura_database_t* db, const char* file, unsigned int*
sqlite3_finalize(stmt);
return true;
}
......@@ -34,9 +34,16 @@ print(zathura_t* zathura)
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL);
if (result == GTK_PRINT_OPERATION_RESULT_APPLY) {
if (zathura->print.settings != NULL) {
g_object_unref(zathura->print.settings);
}
if (zathura->print.page_setup != NULL) {
g_object_unref(zathura->print.page_setup);
}
/* save previous settings */
zathura->print.settings = gtk_print_operation_get_print_settings(print_operation);
zathura->print.page_setup = gtk_print_operation_get_default_page_setup(print_operation);
zathura->print.settings = g_object_ref(gtk_print_operation_get_print_settings(print_operation));
zathura->print.page_setup = g_object_ref(gtk_print_operation_get_default_page_setup(print_operation));
} else if (result == GTK_PRINT_OPERATION_RESULT_ERROR) {
girara_error("Error occured while printing progress");
}
......@@ -75,14 +82,14 @@ cb_print_draw_page(GtkPrintOperation* UNUSED(print_operation), GtkPrintContext*
/* render page */
cairo_t* cairo = gtk_print_context_get_cairo_context(context);
zathura_page_t* page = zathura->document->pages[page_number];
double requested_with = gtk_print_context_get_width(context);
double tmp_scale = zathura->document->scale;
zathura->document->scale = requested_with / page->width;
if (cairo == NULL || page == NULL) {
return;
}
double requested_with = gtk_print_context_get_width(context);
double tmp_scale = zathura->document->scale;
zathura->document->scale = requested_with / page->width;
zathura_page_render(page, cairo);
zathura->document->scale = tmp_scale;
......
......@@ -542,3 +542,4 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, unsigned int
return false;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment