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 546083 - Saving a custom paper size to a key file does not work
Saving a custom paper size to a key file does not work
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Printing
2.12.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-08-03 10:47 UTC by Maurice van der Pot
Modified: 2018-02-10 03:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maurice van der Pot 2008-08-03 10:47:04 UTC
Depending on whether a predefined paper size is selected when gtk_paper_size_to_key_file is called, it stores either a "PPDName" or a "Name" entry. However, it does not remove the other entry that is not applicable.

Since PPDName takes precedence in gtk_paper_size_new_from_key_file, switching from a predefined paper size to a custom paper size only works for as long as the paper size is not saved and reloaded. On the next load it will use the predefined paper size again.

I checked the source code in SVN HEAD and it looks like it's still an issue.
Comment 1 Matthias Clasen 2008-08-05 00:54:23 UTC
Not sure what you mean here. Do you have a small example ?
Where would the 'other entry' come from ? Surely, you are expected to pass
an empty keyfile to that function, or at least one where the group_name is 
not populated yet.
Comment 2 Maurice van der Pot 2008-08-05 17:01:09 UTC
I was not aware of such a requirement. I did not find that in the documentation.

Here's what I had in mind to save the page setup to an existing key file and leave other sections in that file intact:

  key_file = g_key_file_new ();
  g_key_file_load_from_file (key_file, 
                             filename,
                             G_KEY_FILE_KEEP_COMMENTS|
                               G_KEY_FILE_KEEP_TRANSLATIONS,
                             NULL);
  gtk_page_setup_to_key_file (page_setup, key_file, NULL);
  str = g_key_file_to_data (key_file, NULL, NULL);
  g_key_file_free (key_file);

  // save str back to the same file

I would expect gtk_paper_size_to_key_file(), which is called from gtk_page_setup_to_key_file(), to set or remove all of the keys that may influence reading of the paper size from file later.
Comment 3 Matthias Clasen 2018-02-10 03:41:44 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.