Re: GtkBuilder types (Re: GtkBuilder Public API - Last call)



Tim Janik wrote:
On Tue, 12 Jun 2007, Johan Dahlin wrote:

Hi,

During the Gtk+ developer meeting today it was decided that there will be a
final GtkBuilder discussion before it gets committed to trunk.
The current plan is that there will be a new developer release in the end of the week, most likely on friday and that GtkBuilder is going to be included
in that release.

I'd like this discussion to be focus on the Public API. I've included the
two new public headers (gtkbuilder.h and gtkbuildable.h) with the API
documentation embedded.
Suggestions and questions about the documentation are also welcome, but
remember that the documentation is still very much open for changes during
the next couple of weeks, before the final release of 2.12.

I've also attached a .glade file which demonstrates some of the new
capabilities.

gtkbuilder.h
============

GtkBuilder is a replacement for the GladeXML found in the libglade library. It is responsible for parsing a GtkBuilder UI definition and constructing
the object tree from that definition, usually a user interface.

This is the API which applications are going to use.

typedef enum
{
 GTK_BUILDER_ERROR_INVALID_TYPE_FUNCTION,
 GTK_BUILDER_ERROR_UNHANDLED_TAG,
 GTK_BUILDER_ERROR_MISSING_ATTRIUTE,
 GTK_BUILDER_ERROR_INVALID_ATTRIBUTE,
 GTK_BUILDER_ERROR_INVALID_TAG
} GtkBuilderError;

struct _GtkBuilder
{
 GObject parent;

"parent" is a bad name for a nested instance structure, GtkWidget->parent is the best example for this. better use something like parent_instance here, people are never supposed to access this member directly anyway (we have our
casting macros for getting at the parent types).


 GtkBuilderPrivate *priv;
};


/**
* gtk_builder_get_type_from_name:
* @builder: a #GtkBuilder
* @typename: Type name to lookup.
*
* This method is used to lookup a type. It can be implemented in a subclass to
* override the #GType of an object created by the builder.
*
* Since 2.12
*/
GType        gtk_builder_get_type_from_name      (GtkBuilder   *builder,
const char *typename);

how is this different from g_type_from_name() ?
It is overridable by a GtkBuilder class, it's needed by the c++ bindings which has
another GType for the wrappers.
Also, the default implementation tries to guess the name of the _get_type() function for a type name if the type isn't registered yet, but that's an implementation detail.

Johan



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