Re: Private types inside GTK+



On Thu, Sep 9, 2010 at 12:42 PM, Tristan Van Berkom
<tristanvb openismus com> wrote:


>
> Well, are we comfortable writing code in this way and telling
> people that if it's not in the headers and not in the docs,
> it's not a backwards/forwards compatible type and people are
> simply not supposed to use it ?
>
> Or... is it worth the effort of writing an api for
> gobject along the lines of:
>
> GObject *g_private_object_new (GType type, gulong key, ...);
>
> The type itself could be declared with a "private" flag
> and a private object would not be instantiatable with g_object_new(),
> g_object_private_new() would error out when fed an invalid key..
> and the key could be generated at build time to ensure that
> any offending client libraries/applications break any time they
> update to a new GTK+ build... kindof intense I guess but would
> pretty effectively disable any unauthorized use of private types.
>
>
> At this point I'm not entirely sure that writing such a patch
> for gobject will be worth the effort simply for the sake of
> refactoring GtkComboBox... maybe it's worth it and maybe not.

I don't think it is worth it. We already have some de-facto private
types along the lines outlined above: GtkFileSystem, GtkFolder,
GtkFileSystemModel, GtkPrintBackend...

I think it is generally ok to do this as long as the private types
don't leak out as parents of public types.


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