GNOME Bugzilla – Bug 593722
Glade adds a new page to each GtkAssistant after each save/open
Last modified: 2013-05-20 12:33:51 UTC
If a GtkAssistant widget is added to a new file, and the file is saved, the next time it is opened the GtkAssistant widget will have one more page added at the beginning than it had before. A page is only added at the first save. The file has to be closed and reopened to make the bug happened again. Steps to recreate this bug: 1) Open Glade 3.6.7. 2) Use the default options (GtkBuilder, object names unique within the project, image resources loaded from the project directory, toolkit version 2.16 required). Click close. 3) Click the assistant button (the last button under "Toplevels"). 4) Note that the assistant has "Number of Pages" set to 3, and that the assistant does actually have 3 pages: Introduction, Content, Confirmation. 5) Go to File>Save. Type "assistant" as the name and press Save. 6) Click File>Close. 7) Click File>Open. Select assistant.glade. 8) Note that the assistant now has a blank page at the beginning, in addition to the pages it had before, and that "Number of Pages" has increased by 1. 9) Click File>Save. Repeat steps 6-8. The GtkAssistant continues to grow in size. Since GtkAssistant pages also cannot be deleted (see Bug 500463), this makes it pretty much impossible to use the GtkAssistant widget in Glade.
This is being caused by GtkAssistant requiring >0 pages (see n-pages setting in plugins/gtk+/gtk+.xml.in) - A placeholder page is being created when the GtkAssistant is loaded and then the pages in the .glade are appended.
Seems bug 594678 describes a change in GTK+ which introduced this.
*** Bug 594678 has been marked as a duplicate of this bug. ***
After some time reading glade code, I guess the problem is a bit different. It is because glade_gtk_assistant_set_property() is called before glade_gtk_assistant_parse_finished(). When _set_property() is called, the number of pages is always zero, so it gets incremented to 1. I don't know glade source code in depth enough to write a descent patch but I'll attach an ugly piece of code that corrects this problem.
Created attachment 161823 [details] [review] Fix an unnecessary call of glade_gtk_assistant_set_property
Any progress on it? I cannot test the patch now but it looks good.
This is not only a problem on Windows. I experience this on Fedora (14) as well. By the way, to my inexperienced eyes, this patch looks ok as well.
This has been fixed a while ago, Juan Pablo improved GtkAssistant support a bit.