Re: GtkBuilder Public API - Last call



Havoc Pennington wrote:
> Hi,
> 
> Johan Dahlin wrote:
>> Havoc Pennington wrote:
>>> Is the Hello, World simplest use case as short and simple as it possibly
>>> could be? That's always a handy final litmus test for an API.
>>
>> How do you do an hello world in a ui toolkit?
>> Should it include signals? How many widgets?
>>
> 
> For this purpose I think the idea is to emulate how a simple/typical app
> with no special needs would use the API.

> For the other stuff:
>  - set_translation_domain - is for libraries mostly right?
>    (if it's for apps it seems a gtk-wide or glib-wide way to
>     do this could make sense, vs. gtkbuilder-specific)

Right, it defaults to gettext() which will probably be sufficient for
most users.

>  - get_object - getting multiple objects seems like the normal case,
>    so piling one object name it into the convenience function seems
>    wrong
> A possible convenience API could be to have a global singleton builder
> or a hash of per-file builders and then something like:
> 
>  GtkWindow *window;
>  GtkWindow *other_window;
> 
>  if (!gtk_builder_load_objects (DATADIR "/filename.glade",
>                                 GTK_BUILDER_FLAGS_CONNECT_SIGNALS,
>                                 "main-window", &window,
>                                 "other-window", &other_window,
>                                 NULL))
>     g_error("My files are missing!");
> 
> That could be pretty nice perhaps.

That's not so bad, I like that kind of API.

What's missing in this API is a way to telling the builder where to load
files (not part of the current API, but planned for 2.12), but that could be
solved by making the pixbuf (or other resources) path global to all
builders, which is probably what we want anyway.

-- 
Johan Dahlin <jdahlin async com br>
Async Open Source



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