[Geany-devel] encoding combo boxes bug

Nick Treleaven nick.treleaven at xxxxx
Sun Jan 22 12:59:06 UTC 2012


On 20/01/2012 21:29, Matthew Brush wrote:
>> @All: I added ui_builder_get_object() to be able to fetch a non-widget
>> (list store here) from prefs.c, but I'm not completely sure it's the
>> prefect fix. If you have any idea on how to improve this, spread them! :)
>>
>
> IMO, it'd be better to just move the builder object to the header file
> (maybe in a suitable struct), so that all files can access it. Then
> there's no need to add 1 line wrapper functions for every function we
> use from GtkBuilder's API. This isn't unprecedented, I think there's at
> least a handful of globals like this in Geany already (even in
> ui_utils.h). Alternatively, we could add a function called
> `ui_get_builder()` to get access to the builder to use with GtkBuilder API.
>
> Otherwise, it's not too big of a deal, maybe we don't need much more
> from the GtkBuilder API.

I think Colomban's function is fine. I don't understand avoiding adding 
functions that are obviously useful and cleaner:

obj = ui_builder_get_object("name");

vs.

obj = gtk_builder_get_object(ui_get_builder(), "name");

The former is easier to read and it's obvious what it does.



More information about the Devel mailing list