GNOME Bugzilla – Bug 158405
Margins set to 0
Last modified: 2007-04-10 06:31:59 UTC
Whenever I open gnumeric with a new file, the print margins are set to 0. I can change them and then they stick for that file.
Same here.
Here's what happens: Default margins and much more are stored in the gconf variable /apps/gnumeric/printsetup/printer-config, which is a GnomePrintConfig. But for new workbooks, these values never find their way into the sheets' print_info. Possible solutions: 1. This one is straightforward, and works. In print_info_new, instantiate a GnomePrintConfig from the printer-config, and serialize it to print_info->gp_config_str. The problem with this is that we talk to cups when creating a sheet, and if cups is slow or doesn't respond, we get a delay. 2. Create sheet->print_info on demand - when somebody needs to write to it or read from it. 3. Store margins, page orientation etc. as separate gconf variables outside GnomePrintConfig. 4. Add an is_initialized flag to print_info.
We used to do 1. Jody changed it for 1.3.92 because of the delays caused by CUPS.
I do not think the change in 1.3.92 to talk with cups asynchronously was the correct solution to the cups delays. We never experienced any delays because we run a local cups daemon (server) on every single machine. So gnumeric would get immediate feedback from the local server, and said server could then talk with the remote servers. Gnumeric is now essentially incorporating that local server in gnumeric and the problem is that there is an initial delay.
Does gnome-print really have to talk to cups to get the default printer config? That config doesn't mention any particular printer, so I am surprised that it has to. Anyway, if we add an is_initialized flag, we have to make the cups call when saving to Excel or Gnumeric XML. Our xml schema says that print info is always included, and I wouldn't dare export Excel without it.
Personally I don't think we should need to talk to cups, but in the current design of libgnomeprint one needs such things as available paper sizes, default paper size etc. for the current printer (which hopefully is the printer the user wants to use.) You may notice that if you change printers later, virtually all settings disappear and the default settings of the new printer are used.
Created attachment 48968 [details] [review] Patch to initialize the print info when needed The patch introduces the flag print_info->valid to tell if print_info holds valid data. The flag is set to valid when we read a file with print info (i.e. Excel or gnumeric file, or initialize from gnome-print config string. We initialize from config string in the following cases 1) when !print_info->valid and we bring up the print or page setup dialog. 2) when !print_info->valid and writing to gnumeric or excel format. The purpose of 2) is to save the default margins, orientation etc. with the file. Print info is mandatory in the gnumeric .xsd schema (probably a bug, but it's published). I don't think it's a good idea to try to write Excel files with out print info.
A while ago I had considered adding such a flag and decided against it for the following reason: It is part of the todo list to indicate the page ranges on the sheet (as it is done in Excel). If we do that we need the print_info immediately when opening a file.
I agree that either we revert to the behavior in 1.3.91 of initializing print config at startup, or we add a flag like this one. Jody's call.
*** Bug 318311 has been marked as a duplicate of this bug. ***
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.