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 401123 - Alternate method of storing print settings
Alternate method of storing print settings
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Shell
2.10.x (obsolete)
Other Linux
: Urgent critical
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2007-01-26 20:31 UTC by Matthew Barnes
Modified: 2013-09-13 00:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot showing error dialog (169.56 KB, image/png)
2007-01-26 20:32 UTC, Matthew Barnes
  Details
Proposed patch (22.56 KB, patch)
2007-01-26 20:33 UTC, Matthew Barnes
committed Details | Review

Description Matthew Barnes 2007-01-26 20:31:06 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.
Comment 1 Matthew Barnes 2007-01-26 20:32:31 UTC
Created attachment 81288 [details]
Screenshot showing error dialog
Comment 2 Matthew Barnes 2007-01-26 20:33:24 UTC
Created attachment 81290 [details] [review]
Proposed patch
Comment 3 André Klapper 2007-01-27 10:54:20 UTC
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.
Comment 4 Matthew Barnes 2007-01-27 14:03:56 UTC
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.
Comment 5 Matthew Barnes 2007-01-27 14:20:05 UTC
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.
Comment 6 ebbywiselyn 2007-01-29 08:00:50 UTC
Thanks for the patch, i have tested it, it works . 
Comment 7 Sebastien Bacher 2007-01-31 15:04:29 UTC
Ubuntu bug about that: https://launchpad.net/evolution/+bug/82473
Comment 8 Srinivasa Ragavan 2007-02-07 06:51:44 UTC
I will commit this patch with some other fixes. 
Comment 9 Srinivasa Ragavan 2007-02-12 06:52:51 UTC
Committed to HEAD.