[PATCH] Inconsistent read/write of a GtkPaperSize to GKeyFile



Hi,

I've been chasing a bug in GIMP for a few days
http://bugzilla.gnome.org/show_bug.cgi?id=567806

and I have finally found what the problem is.

Basically when I write and read a GtkPaperSize to a GKeyFile

gtk_paper_size_to_key_file
gtk_paper_size_new_from_key_file

I get different sizes.

This happens only for some paper sizes (the non standard I guess) e.g. the photo paper.

The problem is that

the sizes are written in unit = GTK_UNIT_MM (in gtkpapersize.c:916)
and read as GTK_UNIT_POINTS (in gtk_paper_size_new_from_ppd() in gtkpapersize.c:311)

This does not happens always, because if the ppd name is recognized as a standard value (in
gtk_paper_size_new_from_ppd()), the code follows a different path.

I attach a patch to fix the way values as read (MM rather than POINTS).
I have not tested it yet (I need to recompile GTK's rpm source), but I am pretty confident.

I am using gtk 2.12.12 on a Fedora 9.
The same happens on Fedora 10 gtk 2.14.5.
I could not test the latest svn, but just reading the code in trunk I've observed the same.

The line numbers are for trunk.

Hope I have not misunderstood everything.

Andrea
--- gtkpapersize.c.old	2009-01-21 20:50:06.000000000 +0000
+++ gtkpapersize.c	2009-01-21 20:50:44.000000000 +0000
@@ -308,7 +308,7 @@
     }
 
   name = g_strconcat ("ppd_", ppd_name, NULL);
-  size = gtk_paper_size_new_custom (name, ppd_display_name, width, height, GTK_UNIT_POINTS);
+  size = gtk_paper_size_new_custom (name, ppd_display_name, width, height, GTK_UNIT_MM);
   g_free (name);
 
  out:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]