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 578484 - Wrong order of parameters makes default value useless
Wrong order of parameters makes default value useless
Status: RESOLVED FIXED
Product: glade
Classification: Applications
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
: 585662 587762 594372 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-04-09 13:49 UTC by Pietro Battiston
Modified: 2010-03-20 18:29 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26



Description Pietro Battiston 2009-04-09 13:49:18 UTC
Please describe the problem:
When a gtkAdjustment appears in an xml interface definition, with respect to (at least) SpinButtons, gtkBuilder does apply its maximum, minimum, page etc... parameters to it, but not the default value.

Steps to reproduce:
1. with glade, create a window, a spinbutton in it, give a gtkadjustment to the spinbutton and set the "value" to 3. Save as "prova.glade"
2. save the following as "builder.c":

#include <gtk/gtk.h>

int main( int   argc, char *argv[] )
{
    GtkWidget *built;
    GtkBuilder *builder;
    
    gtk_init (&argc, &argv);
    builder = gtk_builder_new();    
    gtk_builder_add_from_file(builder, "prova.glade", NULL);
    built = gtk_builder_get_object(builder, "win1");    
    gtk_widget_show_all(built);
    
    gtk_main ();    
    return 0;
}

3. compile and run:

gcc -g builder.c -o builder `pkg-config --cflags --libs gtk+-2.0`
./builder

Actual results:
I see a window with a spinbutton inside with value 0

Expected results:
To see a window with a spinbutton inside with value 3

Does this happen every time?
yes

Other information:
Other parameters are respected, but for instance if minimum value is 3 the spinbutton still opens at 0; then, once you go over 3, you can't go back under.
Comment 1 Matthias Clasen 2009-04-10 04:39:42 UTC
this is an ordering dependency in the adjustment properties. the value gets clamped to the current min/max, and min/max start out as 0/0. To make this work, you need to edit the builder file, and move the setting of the value property
after the min/max properties. Glade should do that, too.
Comment 2 Matthias Clasen 2009-04-10 04:40:20 UTC
Moving this to glade
Comment 3 Tristan Van Berkom 2009-07-04 19:38:52 UTC
*** Bug 587762 has been marked as a duplicate of this bug. ***
Comment 4 Pietro Battiston 2009-07-21 11:50:55 UTC
*** Bug 585662 has been marked as a duplicate of this bug. ***
Comment 5 André Klapper 2009-07-21 12:13:22 UTC
Version 3.0.x? Shouldn't this be 3.6.x?
Comment 6 Pietro Battiston 2009-07-21 12:27:48 UTC
Even more...
Comment 7 Pietro Battiston 2009-11-08 00:11:38 UTC
I thought I had read somewhere (and verified) that if one opens the file in a text editor and puts the parameters in the right order, then Glade would respect the order when saving again. I may have dreamt. In any case, this is false in glade 3.6.3 and master git.

Since this was driving me crazy, I wrote a very simple python script that takes an xml ui description and reorders fields: I'm linking it here in case it is useful to someone else:
http://bazaar.launchpad.net/~toobaz/gvb/trunk/revision/50#reparse.py

just run it as "python reparse.py the_interface.xml" after each time you use glade on "the_interface.xml"
Comment 8 Tristan Van Berkom 2009-11-09 15:27:14 UTC
(In reply to comment #7)
> I thought I had read somewhere (and verified) that if one opens the file in a
> text editor and puts the parameters in the right order, then Glade would
> respect the order when saving again. I may have dreamt. In any case, this is
> false in glade 3.6.3 and master git.
> 

No this was never the case.

We did finally, due to popular demand, end up serializing Glade files
in a consistent order every time you save, mostly because people dont
like to see diffs to their files from the VCS when nothing has changed.

> Since this was driving me crazy, I wrote a very simple python script that takes
> an xml ui description and reorders fields: I'm linking it here in case it is
> useful to someone else:
> http://bazaar.launchpad.net/~toobaz/gvb/trunk/revision/50#reparse.py
> 
> just run it as "python reparse.py the_interface.xml" after each time you use
> glade on "the_interface.xml"


Fixed in master, order dependant adjustment properties always come
out: "lower", "upper" and finally "value".
Comment 9 Tristan Van Berkom 2010-03-20 18:29:53 UTC
*** Bug 594372 has been marked as a duplicate of this bug. ***