GNOME Bugzilla – Bug 115658
gnome_print_config_from_string does not work properly
Last modified: 2007-11-08 23:15:46 UTC
gnome_print_config_from_string has some serious `issues' suppose we created a string using gnome_print_config_to_string, when we create a new print_config (A) from this string then several things are happening: the created print_config (A) does not allow changes to the orientation (portrait vs landscape) via the gnomeprintui. (Changing it in the interface does not `stick') if we create a string from print_config (A) and use it to create print_config (B) then these 2 are joined at the hip: changing the papersize in either (using the gnome_printui interface) changes it in both. This effect can be seen when compiling gnumeric from cvs with the gnome-config related code in print_info_new uncommented creating a workbook and setting the print setup. The restarting gnumeric and creating 2 workbooks and opeining the pagesetup dialogs for both.
I am also wondering whether the created string in fact makes sense since it seems to duplicate a portion once indicating Portrait and once Landscape orientation. <?xml version="1.0"?> <GnomePrintConfig Version="2.1" LibgnomeprintVersion="2.2.1.2" SelectedSettings="SettIdFromCups"> <Settings Id="SettIdFromCups" Model="Cups-EPSON-EPSON Stylus Color 440, CUPS+Gimp-Print v4.2.5" Printer="lp"> <Name>Default</Name> <Key Id="Transport"> <Key Id="Backend" Value="CUPS"> <Key Id="Module" Value="libgnomeprintcups.so"/> </Key> </Key> <Key Id="Output"> <Key Id="Media"> <Key Id="PhysicalSize" Value="Letter"> <Key Id="Height" Value="792Pt"/> <Key Id="Width" Value="612Pt"/> </Key> <Key Id="PhysicalOrientation" Value="R0"> <Key Id="Paper2PrinterTransform" Value="matrix(1 0 0 1 0 0)"/> </Key> <Key Id="Margins"> <Key Id="Left" Value="0"/> <Key Id="Right" Value="0"/> <Key Id="Top" Value="0"/> <Key Id="Bottom" Value="0"/> </Key> </Key> <Key Id="Job"> <Key Id="NumCopies" Value="1"/> <Key Id="Collate" Value="false"/> </Key> </Key> <Key Id="Document"> <Key Id="Page"> <Key Id="Layout" Value="Plain"> <Key Id="ValidPhysicalSizes" Value="All"/> <Key Id="LogicalPages" Value="1"/> <Key Id="PhysicalPages" Value="1"/> <Key Id="Width" Value="1"/> <Key Id="Height" Value="1"/> <Key Id="Pages" Value="LP0"> <Key Id="LP0" Value="transform(1 0 0 1 0 0)"/> </Key> </Key> <Key Id="LogicalOrientation" Value="R90"> <Key Id="Page2LayoutTransform" Value="matrix(0 1 -1 0 0 1)"/> </Key> <Key Id="Margins"> <Key Id="Left" Value="56.6929Pt"/> <Key Id="Right" Value="56.6929Pt"/> <Key Id="Top" Value="85.0394Pt"/> <Key Id="Bottom" Value="85.0394Pt"/> </Key> </Key> <Key Id="PreferedUnit" Value="cm"/> <Key Id="Name" Value=""/> </Key> <Key Id="Document"> <Key Id="Name" Value=""/> <Key Id="PreferedUnit" Value="cm"/> <Key Id="Page"> <Key Id="LogicalOrientation" Value="R0"> <Key Id="Page2LayoutTransform" Value="matrix(1 0 0 1 0 0)"/> </Key> <Key Id="Margins"> <Key Id="Bottom" Value="3 cm"/> <Key Id="Top" Value="3 cm"/> <Key Id="Right" Value="2 cm"/> <Key Id="Left" Value="2 cm"/> </Key> <Key Id="Layout" Value="Plain"> <Key Id="ValidPhysicalSizes" Value="All"/> <Key Id="LogicalPages" Value="1"/> <Key Id="PhysicalPages" Value="1"/> <Key Id="Width" Value="1"/> <Key Id="Height" Value="1"/> <Key Id="Pages" Value="LP0"> <Key Id="LP0" Value="transform(1 0 0 1 0 0)"/> </Key> </Key> </Key> </Key> </Settings> </GnomePrintConfig>
*** Bug 125988 has been marked as a duplicate of this bug. ***
This appears to have been fixed in cvs HEAD at least. I'll test gnome-2-4 tomorrow.
in gnome 2-4 the problem appear to remain. Or does this problem come from some gtk difference?
I move this to critical since an important feature is disabled in gnumeric 1.2.x because of this.
gnome_print_config_from_string isn't doing what I would expect it to do. Rather than retrieving and using all information included in the string it de-facto only uses the printer and the settings-id ignoring all the remaining information. The `linked-at-the-hip' effect comes from the design of libgnomeprint in that the setting in the gnome-config is a reference to a setting in the printer, so configs using the same printer will use the same setting. Changing it via one config changes it also in the other. I don't think that that is the desirable design.
> gnome_print_config_from_string isn't doing what I would expect it to do. Rather > than retrieving and using all information included in the string it de-facto > only uses the printer and the settings-id ignoring all the remaining > information. I tested if this is true, and it isn't. I placed a call to gpa_config_to_string at the end of _from_string, and wrote the both string corresponding to the returned config and the string passed in to file. Both files are equal. I also tested what happens if I change Output/Media/Margins/Left & Right of the print config to e.g. 2cm - in gconf. In page setup in gnumeric, there are margin hairlines in the page preview. These weren't there when the margins were 0. But The margin spinboxes all stay at 0, and gnumeric uses 0. Actually, there are margins both in Output/Media and in Document/Page. I suspect there is confusion among these - in gnumeric and/or in gnome-print. Is it documented what each of these is for? Finally, Output/Media has PhysicalOrientation. Document/Page has LogicalOrientation.
Output/Media gives the margins used for the real printed sheet of paper and teh orientation of that page. Document/Page refers to the "logical page". THis makes more sense when you think of a "two-up" printing layout where the maedia (sheet of pape) contains 2 logical pages. Also you wrote: I tested if this is true, and it isn't. I placed a call to gpa_config_to_string at the end of _from_string, and wrote the both string corresponding to the returned config and the string passed in to file. Both files are equal. Unless you made sure that the saved string in fact does not match the default setting of that printer, this may not be a valid test: of course the files will be the same.
> Unless you made sure that the saved string in fact does not match the default > setting of that printer, this may not be a valid test: of course the files will > be the same. I have set margins to 8 cm and watched them end up correct in %gconf.xml. This was from gnumeric's page setup. As to why the page setup dialog still shows all margins as 0 next time you start gnumeric, see bug 158405. It's a bug in gnumeric, not gnome-print.
I believe that this could now be tagged a duplicate of bug 147716 - Changing printers ignores setting. If you aren't yet convinced that changes do "stick", you can try building gnumeric HEAD with my proposed patch to 158405.
I have update my tree from cvs and applied your patch. THe "joint at the hip" problem (described in the fourth paragraph of the original description) remains: new gnumeric pagesetup select B5 format Apply to all sheets save as default ok quit gnumeric discarding changes new gnumeric new (second workbook) open page setup for both workbooks Paper size is B5 (that is nice) in both workbooks now change papersize to B4 in one of the workbooks note that it also changes in the other. (bad bad bad!!!) So all your workbooks better have the same paper size since the configs created by gnome_print_config_from_string are in fact joined at the hip.
Cannot reproduce this here. Does it still happen for you?
I am not in the position to check this anymore.