Re: [gtk-list] Re: Interpreter requests
- From: Tim Janik <timj gtk org>
- To: Marius Vollmer <mvo zagadka ping de>
- cc: Gtk+ MList <gtk-list redhat com>, Kenneth Albanowski <kjahds kjahds com>
- Subject: Re: [gtk-list] Re: Interpreter requests
- Date: Tue, 9 Jun 1998 23:03:46 +0200 (CEST)
On 9 Jun 1998, Marius Vollmer wrote:
> Tim Janik <timj@gtk.org> writes:
>
> > GtkType
> > foo_enum_get_type (void)
> > {
> [...]
> > }
>
> Wouldn't it be better to just add gtk_type_register_enum /
> gtk_type_register_flags / etc functions to Gtk, so that
> foo_enum_get_type could just look like:
>
> GtkType
> foo_enum_get_type (void)
> {
> static GtkType type = GTK_TYPE_INVALID;
> if (type == GTK_TYPE_INVALID)
> type = gtk_type_register_enum ("FooEnum", foo_enum_values);
> return type;
> }
sure, that is probably a good idea!
> gtk_type_register_enum would be
>
> GtkType
> gtk_type_register_enum (char *name, GtkEnumValues *vals)
> {
> GtkTypeInfo enum_info =
> {
> name,
> 0,
> 0,
> (GtkClassInitFunc) NULL,
> (GtkObjectInitFunc) NULL,
> (GtkArgSetFunc) NULL,
> (GtkArgGetFunc) NULL,
> };
>
> GtkType type = gtk_type_unique_no_hook (GTK_TYPE_ENUM_TYPE, &enum_info);
> gtk_type_enum_set_values (type, vals);
> gtk_type_run_creation_hooks (type);
>
> return type;
> }
>
> gtk_type_enum_set_values could then be removed from the exported
> functions.
>
> Other useful registration functions (and associated getters) would
> certainly be
>
> GtkType gtk_type_register_boxed (char *name, copy, free);
> GtkType gtk_type_register_foreign (char *name, copy, free, ...);
> GtkType gtk_type_register_object (...);
>
> Ask me if you want to know more about what I have in mind here.
yes, please extend on this subject.
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]