GNOME Bugzilla – Bug 546083
Saving a custom paper size to a key file does not work
Last modified: 2018-02-10 03:41:44 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.
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.
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.
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.