After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 158405 - Margins set to 0
Margins set to 0
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Printing
1.3.x
Other Linux
: Low minor
: ---
Assigned To: Jody Goldberg
Jody Goldberg
: 318311 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-11-15 23:05 UTC by Andreas J. Guelzow
Modified: 2007-04-10 06:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to initialize the print info when needed (6.63 KB, patch)
2005-07-11 17:46 UTC, Jon Kåre Hellan
none Details | Review

Description Andreas J. Guelzow 2004-11-15 23:05:04 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.
Comment 1 Emmanuel Pacaud 2005-01-16 22:58:14 UTC
Same here.
Comment 2 Jon Kåre Hellan 2005-07-10 18:01:20 UTC
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.
  
Comment 3 Jon Kåre Hellan 2005-07-10 18:17:09 UTC
We used to do 1. Jody changed it for 1.3.92 because of the delays caused by CUPS.
Comment 4 Andreas J. Guelzow 2005-07-10 20:18:21 UTC
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.
Comment 5 Jon Kåre Hellan 2005-07-10 20:30:27 UTC
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.
Comment 6 Andreas J. Guelzow 2005-07-10 21:20:39 UTC
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.
Comment 7 Jon Kåre Hellan 2005-07-11 17:46:29 UTC
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.
Comment 8 Andreas J. Guelzow 2005-07-11 18:21:32 UTC
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.
Comment 9 Jon Kåre Hellan 2005-07-11 20:03:43 UTC
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.
Comment 10 Andreas J. Guelzow 2007-03-19 09:25:39 UTC
*** Bug 318311 has been marked as a duplicate of this bug. ***
Comment 11 Andreas J. Guelzow 2007-04-10 06:31:59 UTC
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.