Re: Adjustment problem



Oh god do I feel like a moron....

Yeah, I was completely not understanding how the property system worked.

Which means that my patch submitted earlier is truly a hack.

I don't have time to investigate, but someone might want to check
whether the value parameter is being set first.  In which case I see
it being rather feasible that its being CLAMP'ed to zero becuase upper
and lower are being initialized to 0.0.

A quick test would be to rearange the order of parameters in the
adjustment constructor and put value last in the list.

Anyway, I'll check later if no one else can. Sorry for being
incompetent and wasting everyone's time.

Paul

On 11/1/06, Murray Cumming <murrayc murrayc com> wrote:
On Wed, 2006-11-01 at 11:09 -0600, Paul Davis wrote:
>
> At what point in the call to gtk_adjustment_new() does
> adjustment->value get set?

During g_object_new(), because a value has been specified for the
"value" property:

GtkObject*
gtk_adjustment_new (gdouble value,
                    gdouble lower,
                    gdouble upper,
                    gdouble step_increment,
                    gdouble page_increment,
                    gdouble page_size)
{
  return g_object_new (GTK_TYPE_ADJUSTMENT,
                       "lower", lower,
                       "upper", upper,
                       "step-increment", step_increment,
                       "page-increment", page_increment,
                       "page-size", page_size,
                       "value", value,
                       NULL);
}

>   The point of contention is not that it
> works after instantiation, but that instantiation is incorrectly using
> the gobject api to store values when instead, they should just be
> placed in the structure.

Why do you believe that it should access the struct directly instead of
doing it via the property API? The end result should be the same, though
the set_property() vfunc implementation may decide to
a) validate property values somehow.
b) otherwise respond to the change, for instance by updating the UI.


--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com





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