Re: print settings (balsa 2.0.12/Gnome2)




On 2003.07.08 02:41, Russell L. Harris wrote:
> With balsa 2.0.1, Gnome2 desktop, Debian 3.0 ('Sarge', testing):
> 
> The printer settings for units (centimeters, inches, etc.) and 
> margins revert to the defaults each time the PRINT button is 
> pressed.  Is there no way to save the settings?  RLH

Does the attached patch solve your problems?

Pawel
Index: src/balsa-app.h
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-app.h,v
retrieving revision 1.189
diff -u -r1.189 balsa-app.h
--- src/balsa-app.h	27 May 2003 13:06:50 -0000	1.189
+++ src/balsa-app.h	8 Jul 2003 09:26:09 -0000
@@ -327,6 +327,14 @@
 
     /* printing */
     gchar* paper_size; /* A4 or Letter */
+    gchar* margin_left;
+    gchar* margin_top;
+    gchar* margin_right;
+    gchar* margin_bottom;
+    gchar* print_unit;
+    gchar* print_layout;
+    gchar* paper_orientation;
+    gchar* page_orientation;
     gchar* print_header_font;  /* font for printing headers */
     gchar* print_body_font;    /* font for printing text parts */
     gchar* print_footer_font;  /* font for printing footers */
Index: src/print.c
===================================================================
RCS file: /cvs/gnome/balsa/src/print.c,v
retrieving revision 1.60
diff -u -r1.60 print.c
--- src/print.c	3 Jul 2003 21:34:30 -0000	1.60
+++ src/print.c	8 Jul 2003 09:26:09 -0000
@@ -246,11 +246,11 @@
     if (balsa_app.debug)
 	g_print("Processing page %s\n", buf);
 
+    gnome_print_beginpage(pi->pc, buf);
     /* print the page number */
     if (balsa_app.print_highlight_cited)
 	gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
     page_no = g_strdup_printf(_("Page: %i/%i"), pi->current_page, pi->pages);
-    gnome_print_beginpage(pi->pc, buf);
     ypos = pi->page_height - pi->pgnum_from_top;
     gnome_print_setfont(pi->pc, pi->header_font);
     width = gnome_font_get_width_utf8(pi->header_font, page_no);
@@ -1528,6 +1528,23 @@
     g_free(balsa_app.paper_size);
     balsa_app.paper_size =
         gnome_print_config_get(config, GNOME_PRINT_KEY_PAPER_SIZE); 
+    balsa_app.print_unit =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PREFERED_UNIT); 
+    balsa_app.margin_left =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT); 
+    balsa_app.margin_top =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP); 
+    balsa_app.margin_right =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT);
+    balsa_app.margin_bottom =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM); 
+    balsa_app.print_layout =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_LAYOUT); 
+    balsa_app.paper_orientation =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PAPER_ORIENTATION); 
+    balsa_app.page_orientation =
+        gnome_print_config_get(config, GNOME_PRINT_KEY_PAGE_ORIENTATION); 
+
     gnome_print_config_unref(config);
 
     pi = print_info_new(ci);
@@ -1606,6 +1623,30 @@
     config = BALSA_GNOME_PRINT_UI_GET_CONFIG(ci->master);
     gnome_print_config_set(config, GNOME_PRINT_KEY_PAPER_SIZE, 
                            balsa_app.paper_size);
+    if(balsa_app.print_unit)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PREFERED_UNIT,
+			       balsa_app.print_unit); 
+    if(balsa_app.margin_left)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT,
+			       balsa_app.margin_left); 
+    if(balsa_app.margin_top)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP,
+			       balsa_app.margin_top); 
+    if(balsa_app.margin_right)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT,
+			       balsa_app.margin_right);
+    if(balsa_app.margin_bottom)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM,
+			       balsa_app.margin_bottom); 
+    if(balsa_app.print_layout)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_LAYOUT,
+			       balsa_app.print_layout); 
+    if(balsa_app.paper_orientation)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PAPER_ORIENTATION,
+			       balsa_app.paper_orientation); 
+    if(balsa_app.page_orientation)
+	gnome_print_config_set(config, GNOME_PRINT_KEY_PAPER_ORIENTATION,
+			       balsa_app.page_orientation); 
     gnome_print_config_unref(config);
     
     ci->dialog = print_dialog(ci);
Index: src/save-restore.c
===================================================================
RCS file: /cvs/gnome/balsa/src/save-restore.c,v
retrieving revision 1.255
diff -u -r1.255 save-restore.c
--- src/save-restore.c	27 May 2003 13:14:45 -0000	1.255
+++ src/save-restore.c	8 Jul 2003 09:26:09 -0000
@@ -758,6 +758,22 @@
     g_free(balsa_app.paper_size);
     balsa_app.paper_size =
 	gnome_config_get_string("PaperSize=" DEFAULT_PAPER_SIZE);
+    g_free(balsa_app.margin_left);
+    balsa_app.margin_left   = gnome_config_get_string("LeftMargin");
+    g_free(balsa_app.margin_top);
+    balsa_app.margin_top    = gnome_config_get_string("TopMargin");
+    g_free(balsa_app.margin_right);
+    balsa_app.margin_right  = gnome_config_get_string("RightMargin");
+    g_free(balsa_app.margin_bottom);
+    balsa_app.margin_bottom = gnome_config_get_string("BottomMargin");
+    g_free(balsa_app.print_unit);
+    balsa_app.print_unit    = gnome_config_get_string("PrintUnit");
+    g_free(balsa_app.print_layout);
+    balsa_app.print_layout  = gnome_config_get_string("PrintLayout");
+    g_free(balsa_app.paper_orientation);
+    balsa_app.paper_orientation  = gnome_config_get_string("PaperOrientation");
+    g_free(balsa_app.page_orientation);
+    balsa_app.page_orientation   = gnome_config_get_string("PageOrientation");
 
     g_free(balsa_app.print_header_font);
     balsa_app.print_header_font =
@@ -1107,6 +1123,24 @@
     /* Printing options ... */
     gnome_config_push_prefix(BALSA_CONFIG_PREFIX "Printing/");
     gnome_config_set_string("PaperSize",balsa_app.paper_size);
+    if(balsa_app.margin_left)
+	gnome_config_set_string("LeftMargin",   balsa_app.margin_left);
+    if(balsa_app.margin_top)
+	gnome_config_set_string("TopMargin",    balsa_app.margin_top);
+    if(balsa_app.margin_bottom)
+	gnome_config_set_string("RightMargin",  balsa_app.margin_right);
+    if(balsa_app.margin_bottom)
+	gnome_config_set_string("BottomMargin", balsa_app.margin_bottom);
+    if(balsa_app.print_unit)
+	gnome_config_set_string("PrintUnit",    balsa_app.print_unit);
+    if(balsa_app.print_layout)
+	gnome_config_set_string("PrintLayout", balsa_app.print_layout);
+    if(balsa_app.margin_bottom)
+	gnome_config_set_string("PaperOrientation", 
+				balsa_app.paper_orientation);
+    if(balsa_app.margin_bottom)
+	gnome_config_set_string("PageOrientation", balsa_app.page_orientation);
+
     gnome_config_set_string("PrintHeaderFont",
                             balsa_app.print_header_font);
     gnome_config_set_string("PrintBodyFont", balsa_app.print_body_font);


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