[Glade-users] Help to port sound-juicer to GtkBuilder

2010/1/20 Tadej Borov?ak <tadeboro at gmail.com>:

I looked at the code and noticed that there is no such things as
GMAudioProfileChoose widget defined in gnome-media package. It's
simply a combo box with some predefined things.

<widget class="Custom" id="audio_profile">
?<property name="visible">True</property>
?<property name="can_focus">True</property>
?<property name="creation_function">gm_audio_profile_choose_new</property>
?<signal name="changed" handler="prefs_profile_changed"/>

<object class="GMAudioProfileEdit" id="audio_profile">
?<property name="visible">True</property>
?<property name="can_focus">True</property>
?<signal name="changed" handler="prefs_profile_changed"/>

Those two snippets are not equal. First snippet creates combo box
while second snippet creates dialog.

I'm not sure how to fix this mess. One way would be to define
GMAudioProfileChoose custom widget inside gnome-media package, add it
to Glade catalog file and then use it as any custom widget.

If this cannot be done, one can still manually insert combo box into
the horizontal box. This is ugly, but it may be reasonable to do if
the urge to remove libglade is strong enough.

Ah, sorry because of the approach he was using I assumed it was
an actual widget.

There could be a couple approaches, if there is alot of business
logic around the dialog that was being set up in the create_custom()
function then it's probably best to create a type for it IMO.

If its just a question of creating a widget hierarchy with a similar
look'n'feel to be used in several places in the UI, you could use
a separate GtkBuilder file for it and include it at several places
in the UI (by building/parenting that builder file at multiple places).

Some might prefer just using an extra glade file if for instance
they are writing C code and dislike copy/pasting all the required
boiler-plate code to create a type.

Ofcourse you can also combine the above two, leaving you
with a GType of a class that creates its hierarchy using GtkBuilder
internally at _init() time, which is also a widget type and as such
can be placed multiple times anywhere in the project.


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