summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S├ínchez <[email protected]>2017-04-22 14:17:56 +0200
committerraveit65 <[email protected]>2017-04-28 08:23:00 +0200
commit8ed7ac8b746dbc27671adc991ec000a767482277 (patch)
treec726a74c62daf3ec9c6a872477387a65f10eab25
parent47fe5f2bb57680dfcbb4063ddd7fa9c808562b8c (diff)
downloadeom-8ed7ac8b746dbc27671adc991ec000a767482277.tar.bz2
eom-8ed7ac8b746dbc27671adc991ec000a767482277.tar.xz
Printing paper orientation should default based on image dimensions
Now, the default paper orientation in print settings is based on image dimensions. https://bugzilla.gnome.org/show_bug.cgi?id=531898 taken from: https://git.gnome.org/browse/eog/commit/?id=5aebb88
-rw-r--r--src/eom-print.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eom-print.c b/src/eom-print.c
index 54db68e..4d20a29 100644
--- a/src/eom-print.c
+++ b/src/eom-print.c
@@ -317,6 +317,7 @@ eom_print_operation_new (EomImage *image,
{
GtkPrintOperation *print;
EomPrintData *data;
+ gint width, height;
eom_debug (DEBUG_PRINTING);
@@ -330,6 +331,19 @@ eom_print_operation_new (EomImage *image,
data->image = g_object_ref (image);
data->unit = GTK_UNIT_INCH;
+ eom_image_get_size (image, &width, &height);
+
+ if (page_setup == NULL)
+ page_setup = gtk_page_setup_new ();
+
+ if (height >= width) {
+ gtk_page_setup_set_orientation (page_setup,
+ GTK_PAGE_ORIENTATION_PORTRAIT);
+ } else {
+ gtk_page_setup_set_orientation (page_setup,
+ GTK_PAGE_ORIENTATION_LANDSCAPE);
+ }
+
gtk_print_operation_set_print_settings (print, print_settings);
gtk_print_operation_set_default_page_setup (print,
page_setup);