2007-11-20 [colin] 3.1.0cvs12
authorColin Leroy <colin@colino.net>
Tue, 20 Nov 2007 20:19:29 +0000 (20:19 +0000)
committerColin Leroy <colin@colino.net>
Tue, 20 Nov 2007 20:19:29 +0000 (20:19 +0000)
* src/printing.c
* src/printing.h
Add getter/setter for settings, and getter
for page setup

ChangeLog
PATCHSETS
configure.ac
src/printing.c
src/printing.h

index 0163689155d861afde0d787e03ce4f87a1294547..75a3af068f2fe648cfbc8c06e23d1efdd9c5ab4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-20 [colin]     3.1.0cvs12
+
+       * src/printing.c
+       * src/printing.h
+               Add getter/setter for settings, and getter
+               for page setup
+
 2007-11-20 [colin]     3.1.0cvs11
 
        * src/folderview.c
index 66b667151e4cee8bf03c9337bafcc95f76dbb13e..b5d90fc3405c905fb2b56ca47841ac7a2a2d2063 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.424 -r 1.382.2.425 src/compose.c;  ) > 3.1.0cvs9.patchset
 ( cvs diff -u -r 1.213.2.166 -r 1.213.2.167 src/folder.c;  ) > 3.1.0cvs10.patchset
 ( cvs diff -u -r 1.207.2.187 -r 1.207.2.188 src/folderview.c;  cvs diff -u -r 1.115.2.176 -r 1.115.2.177 src/main.c;  cvs diff -u -r 1.274.2.220 -r 1.274.2.221 src/mainwindow.c;  ) > 3.1.0cvs11.patchset
+( cvs diff -u -r 1.1.2.10 -r 1.1.2.11 src/printing.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/printing.h;  ) > 3.1.0cvs12.patchset
index cbe6ffe0350f6d34ae4beabb671ff5b0821e593a..1c2ad9a1eed7591242ce3f072ca17be0d442a41e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=1
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=11
+EXTRA_VERSION=12
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index cb980d781529f775cfb51f7bba2f483c4a4098e2..08a6db9daa34cee499b598cd4b40317eecf496c5 100644 (file)
@@ -148,6 +148,43 @@ void printing_set_n_pages(PrintData *print_data, gint n_pages)
        print_data->npages = n_pages;
 }
 
+GtkPrintSettings *printing_get_settings(void)
+{
+  if (settings == NULL) {
+    settings = gtk_print_settings_new();
+    gtk_print_settings_set_use_color(settings, prefs_common.print_use_color);
+    gtk_print_settings_set_collate(settings, prefs_common.print_use_collate);
+    gtk_print_settings_set_reverse(settings, prefs_common.print_use_reverse);
+    gtk_print_settings_set_duplex(settings, prefs_common.print_use_duplex);
+  }
+  return settings;
+}
+
+void printing_store_settings(GtkPrintSettings *new_settings)
+{
+    if(settings != NULL)
+      g_object_unref(settings);
+    settings = g_object_ref(new_settings);
+    prefs_common.print_use_color = gtk_print_settings_get_use_color(settings);
+    prefs_common.print_use_collate = gtk_print_settings_get_collate(settings);
+    prefs_common.print_use_reverse = gtk_print_settings_get_reverse(settings);
+    prefs_common.print_use_duplex = gtk_print_settings_get_duplex(settings);
+
+}
+GtkPageSetup *printing_get_page_setup(void)
+{
+  if (page_setup == NULL) {
+    page_setup = gtk_page_setup_new();
+    if (prefs_common.print_paper_type && *prefs_common.print_paper_type) {
+      GtkPaperSize *paper = gtk_paper_size_new(prefs_common.print_paper_type);
+      gtk_page_setup_set_paper_size(page_setup, paper);
+      gtk_paper_size_free(paper);
+    }
+    gtk_page_setup_set_orientation(page_setup, prefs_common.print_paper_orientation);
+  }
+  return page_setup;
+}
+
 void printing_print_full(GtkWindow *parent, PrintRenderer *renderer, gpointer renderer_data, 
                         gint sel_start, gint sel_end)
 {                       
@@ -172,22 +209,8 @@ void printing_print_full(GtkWindow *parent, PrintRenderer *renderer, gpointer re
 
   print_data->to_print = renderer->get_data_to_print(renderer_data, sel_start, sel_end);
 
-  if (settings == NULL) {
-    settings = gtk_print_settings_new();
-    gtk_print_settings_set_use_color(settings, prefs_common.print_use_color);
-    gtk_print_settings_set_collate(settings, prefs_common.print_use_collate);
-    gtk_print_settings_set_reverse(settings, prefs_common.print_use_reverse);
-    gtk_print_settings_set_duplex(settings, prefs_common.print_use_duplex);
-  }
-  if (page_setup == NULL) {
-    page_setup = gtk_page_setup_new();
-    if (prefs_common.print_paper_type && *prefs_common.print_paper_type) {
-      GtkPaperSize *paper = gtk_paper_size_new(prefs_common.print_paper_type);
-      gtk_page_setup_set_paper_size(page_setup, paper);
-      gtk_paper_size_free(paper);
-    }
-    gtk_page_setup_set_orientation(page_setup, prefs_common.print_paper_orientation);
-  }
+  printing_get_settings();
+  printing_get_page_setup();
   
   /* Config for printing */
   gtk_print_operation_set_print_settings(op, settings);
@@ -210,13 +233,7 @@ void printing_print_full(GtkWindow *parent, PrintRenderer *renderer, gpointer re
   }
   else if(res == GTK_PRINT_OPERATION_RESULT_APPLY) {
     /* store settings for next printing session */
-    if(settings != NULL)
-      g_object_unref(settings);
-    settings = g_object_ref(gtk_print_operation_get_print_settings(op));
-    prefs_common.print_use_color = gtk_print_settings_get_use_color(settings);
-    prefs_common.print_use_collate = gtk_print_settings_get_collate(settings);
-    prefs_common.print_use_reverse = gtk_print_settings_get_reverse(settings);
-    prefs_common.print_use_duplex = gtk_print_settings_get_duplex(settings);
+    printing_store_settings(gtk_print_operation_get_print_settings(op));
   }
 
   g_hash_table_foreach(print_data->images, free_pixbuf, NULL);
@@ -273,22 +290,8 @@ void printing_page_setup(GtkWindow *parent)
 {
   GtkPageSetup *new_page_setup;
 
-  if(settings == NULL) {
-    settings = gtk_print_settings_new();
-    gtk_print_settings_set_use_color(settings, prefs_common.print_use_color);
-    gtk_print_settings_set_collate(settings, prefs_common.print_use_collate);
-    gtk_print_settings_set_reverse(settings, prefs_common.print_use_reverse);
-    gtk_print_settings_set_duplex(settings, prefs_common.print_use_duplex);
-  }
-  if (page_setup == NULL) {
-    page_setup = gtk_page_setup_new();
-    if (prefs_common.print_paper_type && *prefs_common.print_paper_type) {
-      GtkPaperSize *paper = gtk_paper_size_new(prefs_common.print_paper_type);
-      gtk_page_setup_set_paper_size(page_setup, paper);
-      gtk_paper_size_free(paper);
-    }
-    gtk_page_setup_set_orientation(page_setup, prefs_common.print_paper_orientation);
-  }
+  printing_get_settings();
+  printing_get_page_setup();
 
   new_page_setup = gtk_print_run_page_setup_dialog(parent,page_setup,settings);
 
index ce48f9cd3de5c5fbe1679dd82e6211e651cd6f98..da4e6b3b9bfd59e599a3f0df8d21f819c06676e1 100644 (file)
@@ -46,6 +46,9 @@ void printing_page_setup(GtkWindow*);
 gpointer printing_get_renderer_data(PrintData *print_data);
 gdouble  printing_get_zoom(PrintData *print_data);
 void     printing_set_n_pages(PrintData *print_data, gint n_pages);
+GtkPrintSettings *printing_get_settings(void);
+GtkPageSetup *printing_get_page_setup(void);
+void printing_store_settings(GtkPrintSettings *new_settings);
 
 #endif /* GTK+ >= 2.10.0 */