[eog] Printing paper orientation should default based on image dimensions



commit 5aebb88a206f1d6dfab87fbe9a63c6cc54bf37e9
Author: Javier SÃnchez <jsanchez deskblue com>
Date:   Sun Apr 29 11:41:06 2012 +0200

    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

 src/eog-print.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/eog-print.c b/src/eog-print.c
index f84808a..6a68c5b 100644
--- a/src/eog-print.c
+++ b/src/eog-print.c
@@ -317,6 +317,7 @@ eog_print_operation_new (EogImage *image,
 {
 	GtkPrintOperation *print;
 	EogPrintData *data;
+	gint width, height;
 
 	eog_debug (DEBUG_PRINTING);
 
@@ -330,6 +331,19 @@ eog_print_operation_new (EogImage *image,
 	data->image = g_object_ref (image);
 	data->unit = GTK_UNIT_INCH;
 
+	eog_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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]