Re: GTK adjustement changes create incompatible behaviour between versions?



On Mon, 2008-09-22 at 10:23 +0100, Ghee Teo wrote:
> Davyd Madeley wrote:
> > I think GTK+ is now doing the right thing.
> >   
> > >From my understanding, this only affects UIs created with Glade (which
> > has been setting a page_size of 10 -- and it seems still isn't fixed).
> >
> > Matt here developed a workaround for this in libglade. That sets the
> > page_size to 0 and reports a warning that your app is broken.
> >   
>   This is GREAT! Does this imply the bug is in libglade since it does 
> not conform
> to the GTK+ spec? Should the fix be made in libglade also so that new 
> glade file
> will conform to the GTK+ glade.

This is a complicated question.

There are 3 ways I can think of to create a GtkSpinButton:
 - using GTK+;
 - using GtkBuilder; and
 - using libglade

If you've called the function in GTK+ directly, you never specify a
page_size (it doesn't make sense). If you've set a non-zero page_size,
it's really your own fault.

But if you've used Glade, you've got the problem that it was always
setting the default page_size to 10. Since this never worked AFAIK, it
seems unlikely that anyone was intentionally setting this to a value.
You could probably safely add a workaround in libglade. I assume
libglade will go away with GTK+ 3.0.

But GtkBuilder doesn't go away for GTK+ 3.0. So by adding a workaround
for GtkBuilder, we've made it so that you can never set a page_size,
even if you wanted to.

Off the top of my head, one option would be to make GtkBuilder 2.x fudge
page_size to 0 and give a g_warning saying your app is broken with a
#define GTK_BUILDER_ENFORCE_PAGE_SIZE to enforce the correct behaviour
(which would be the only behaviour in 3.0).

On the question of "why is Glade wrong". I notice (in older manuals at
least) that while the docs tell you to set a page_size of 0. The
examples don't actually follow this advice, and set page_size ==
page_increment .I've not checked the new manual to see if someone has
corrected the examples.

"""
    spinner_adj = (GtkAdjustment *) gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.1);
    spinner = gtk_spin_button_new (spinner_adj, 0.001, 3);
"""

> > FWIW, I have mentioned this change in the developer section of the 2.24
> > release notes.
> >   
>   Have you a pointer to the latest 2.24 release note?

http://svn.gnome.org/viewvc/release-notes/branches/gnome-2-24/

--davyd

-- 
Davyd Madeley,        Software Engineer
Fugro Seismic Imaging, Perth, Australia

http://www.fugro-fsi.com/



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