Classes for fundamental types, renaming GtkArg



Hi,

look at this snippet from gtktypeutils.c

    static inline GtkType
    gtk_type_register_intern (gchar	       *name,
			      GtkType	parent,
			      GtkEnumValue *values)
    {
      GtkType type_id;
      GtkTypeInfo info;

      info.type_name = name;
      info.object_size = 0;
      info.class_size = 0;
      info.class_init_func = NULL;
      info.object_init_func = NULL;
      info.reserved_1 = values;
      ^^^^^^^^^^^^^^^^^^^^^^^^

What about using the `klass' field of the GtkTypeNode for this?  Feels
cleaner.

I think we can give individual and arbitrary definitions to the
`klass' for every fundamental type.  For GTK_TYPE_OBJECT its something
derived from GtkObjectClass, for enums and flags its a pointer to all
literals, for boxed types it can be a pointer to a struct with the
copy/destroy functions and the size, etc.  These conventions could
even be exported to the user.

Waddaya think?

Plus, is anyone else worried about the heavy stuff that Gtk does at
type initialization time?  I think at least touching all enum literals
can be avoided and the long list of GTK_TYPE_* variables can probably
be reduced to a single one.

And I more and more dislike the name GtkArg.  I would like to rename
it to GtkValue.  What is now called `object args' should be called
`object attributes'.  While I'm all for source compatability, I think
that Gtk is still too young to develop anachronitis.



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