summaryrefslogtreecommitdiff
path: root/src/eom-print.c
diff options
context:
space:
mode:
authorJavier Sánchez <[email protected]>2017-04-22 14:17:56 +0200
committerraveit65 <[email protected]>2017-04-23 12:15:53 +0200
commit6e3f0ced7bf2f5d100b22cc628ec2a6c6b796a1c (patch)
tree5bdc1404391fb99f7ee85016d9ef7be38a39bf2c /src/eom-print.c
parent57c530e27bb13687d674fb7abba03d414ab814fb (diff)
downloadeom-6e3f0ced7bf2f5d100b22cc628ec2a6c6b796a1c.tar.bz2
eom-6e3f0ced7bf2f5d100b22cc628ec2a6c6b796a1c.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
Diffstat (limited to 'src/eom-print.c')
-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);