GNOME Bugzilla – Bug 401123
Alternate method of storing print settings
Last modified: 2013-09-13 00:49:56 UTC
Storing print settings in GConf is completely broken in Evolution 2.9.6. After packaging Evolution 2.9.6 for Fedora Core, RPM revealed these schema errors during installation: $ sudo rpm -ivh evolution-2.9.6-1.fc7.i386.rpm ... WARNING: Failed to parse default value `GTK_PAPER_NAME_A3' for schema (/schemas/apps/evolution/shell/paper_size) WARNING: failed to parse type name `double' WARNING: invalid or missing type for schema (/schemas/apps/evolution/shell/paper_width) WARNING: failed to parse type name `double' WARNING: invalid or missing type for schema (/schemas/apps/evolution/shell/paper_height) WARNING: failed to parse type name `double' WARNING: invalid or missing type for schema (/schemas/apps/evolution/shell/scale) These warnings are coming from apps_evolution_shell.schemas, which has numerous problems. For starters: - Preprocessor symbols are not allowed in schema files. GTK_PAPER_NAME_A3 should be "iso_a3". - The floating point type is named "float", not "double". These errors cause the user to see an error dialog when attempting to print (see the screenshot in comment #1). The Details button on the dialog reveals even more problems: File: shell/apps_evolution_shell.schemas.in.in Type mismatch: Expected `string' got `int' for key /apps/evolution/shell/n_copies Type mismatch: Expected `string' got `bool' for key /apps/evolution/shell/collate Type mismatch: Expected `string' got `int' for key /apps/evolution/shell/print_pages Type mismatch: Expected `string' got `int' for key /apps/evolution/shell/page_set Type mismatch: Expected `string' got `bool' for key /apps/evolution/shell/reverse Type mismatch: Expected `string' got `float' for key /apps/evolution/shell/scale Type mismatch: Expected `string' got `int' for key /apps/evolution/shell/page_ranges The code that manipulates these keys (e-util/e-print.c) treats all of these keys as strings, whereas the .schemas file defines them as a variety of types. Furthermore, many of the default values that appear in the schema file are questionable (e.g. default_source defaults to "/home/ebby/Desktop/"), and they don't respect locale (e.g. the default paper size in the United States should be "na_letter", not "iso_a3"). Rather than trying to clean up this mess, let me propose an alternate method that is simpler and more robust than what was released in 2.9.6. A GtkPrintSettings object represents the delta between user-selected, site-specific print settings versus the standard default print settings built into the GTK+ print system. Only the delta needs to be stored in GConf, not every conceivable print setting as its own individual key. I propose setting up a single GConf key as a list of "key=value" strings. (I picked /apps/evolution/shell/printing.) gtk_print_settings_foreach() makes it very simple to build such a list and write it to GConf. To load the settings, just read the GConf key into a GSList and use gtk_print_settings_set() to set each "key=value" item. There's still time to get this right before 2.10 ships.
Created attachment 81288 [details] Screenshot showing error dialog
Created attachment 81290 [details] [review] Proposed patch
and i really wonder about the commandline spew here: ** (evolution-2.10:17690): WARNING **: Error getting printer list: successful-ok ** (evolution-2.10:17690): WARNING **: Error result: successful-ok can we reduce this to the minimum (=nothing)? "error: successful" is confusing, as if you would *expect* to fail.
Believe it or not, I think that's a GTK+ bug. Those warnings are coming from gtkprintbackendcups.c. It looks like GtkCupsResult::is_error is getting improperly set when there is no error. I'll file a separate bug report about it.
Actually, digging into it further, I now believe it to be a CUPS bug. ippReadIO() seems to sometimes return IPP_ERROR when there is no error. In any case, not Evolution's fault for once.
Thanks for the patch, i have tested it, it works .
Ubuntu bug about that: https://launchpad.net/evolution/+bug/82473
I will commit this patch with some other fixes.
Committed to HEAD.