Pluggable widgets II



hey All.

here's a refined proposal for pluggable widgets, incorporating the recent
comments from Damon Chaplin and Paul Pogonyshev. the motivation for
pluggable widgets is supplied in the original proposal:
  http://mail.gnome.org/archives/gtk-devel-list/2006-November/msg00125.html
and the corresponding bug report:
  http://bugzilla.gnome.org/show_bug.cgi?id=356864


unless any serious objections come up, the new plan is to introduce
this new libgobject API:

  gpointer g_factory_create         (GType        type,
                                     const gchar *first_property_name,
                                     ...);
  GType    g_factory_get_appointed  (GType        basic_type);
  void     g_factory_appoint        (GType        basic_type,
                                     GType        appointed_type);

some notes about the API:
- g_factory_get_appointed() queries appointed types previously set
  via g_factory_appoint() and allowes to check whether implementation
  types were appointed for interface types
- g_factory_create(type) is essentially a wrapper around g_object_new()
  but will create an instance of type g_factory_get_appointed (type)
- g_factory_appoint() appoints a specific implementation type for
  a given (maybe interface) type. it ensures a number of things:
    G_TYPE_IS_INSTANTIATABLE (basic_type) || G_TYPE_IS_INTERFACE (basic_type)
    g_type_is_a (appointed_type, basic_type)
    G_TYPE_IS_INSTANTIATABLE (appointed_type)
  and since this factory is planned for GObjects only:
    G_TYPE_IS_OBJECT (appointed_type)
- g_object_factory_ was suggested as namespace for this factory. that'd be
  technically correct because the API is supposed to only create GObject
  derived types, however g_object_factory_ is significantly longer and i
  think we can be pretty certain to not need other fundamental object types
  in libgobject any time soon, so picking g_factory_ isn't too risky.
- g_factory_new (type, ...) was suggested to create objects instead of
  g_factory_create (type, ...). i think that naming is too similar to
  naming a factory constructor and suggested that a factory   is created.
  to avoid that impression, i personally prefer g_factory_create().


also according to the new plan, Gtk+ will be changed so that:
- all gtk_widget_new() calls (11) will use g_factory_create() instead
- all g_object_new() calls (246) will use g_factory_create() instead

---
ciaoTJ



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