Re: misc. properties



On 10 Oct 2001, Owen Taylor wrote:

> (I actually have some doubts whether a "text" property for GtkEntry
> makes a lot of sense ... but since this is the fourth or fifth
> time this has come up, probably just best to add it to squash
> the issue.)

heck, i've been _missing_ that big time GLE as well ;)

> > should g_param_spec_pool_lookup be traversing up the interface
> > hierarchy for registered interfaces - it doesn't seem to do that
> > currently, but perhaps I'm missing something.
> 
> Properties on interfaces are not a GLib-2.0 feature. I forget
> the details but when it was discussed earlier there were some
> issues that made it not just quick addition.

actually, i (we) don't have a whole lot of an idea how to do those
currently ;)

> > +
> > +  g_object_class_install_property (gobject_class,
> > +                                   PROP_ENABLE_EMPTY,
> > +                                   g_param_spec_boolean ("enable_empty",
> > +                                                         _("Allow empty field"),
> > +                                                         _("Whether the entry may be empty"),
> > +                                                         TRUE,
> > +                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
> 
> In almost all cases, the "nick" for properties in GTK+ are the same as
> the "name" but with case and spaces. If nothing else, this will help
> people who are both using a GUI builder and also accessing properties
> programmatically.

right, but:

>  allow_empty
>  Allow Empty
>  Whether an empty value may be entered in this field

the latter two are being internationalized, which kinda defeats
the prop_name->"Prop Name" rule ;(

> > @@ -1032,6 +1052,14 @@
> >        /* This call does the notification */
> >        gtk_combo_set_case_sensitive (combo, g_value_get_boolean (value));
> >        break;
> > +    case PROP_ENABLE_EMPTY:
> > +      combo->ok_if_empty = g_value_get_boolean (value);
> > +      g_object_notify (G_OBJECT (combo), "enable_empty");
> > +      break;
> > +    case PROP_VALUE_IN_LIST:
> > +      combo->value_in_list = g_value_get_boolean (value);
> > +      g_object_notify (G_OBJECT (combo), "value_in_list");
> > +      break;
> 
> You don't need these g_object_notify() calls here ... 
> the '/* This call does the notification */' comments for the
> other properties here are confusing and should be removed.

right, the propert setting code in gobject notifies properties
being set through object_set_proeprty automatically (even if
they didn't change actuall value).
it also wraps the method obejct_set_property into freeze/thaw
notify.

> 
> Regards,
>                                         Owen
> 

---
ciaoTJ





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