[Glade-devel] Improving anjuta templates to make use of composite widgets

Tristan Van Berkom tristan.van.berkom at gmail.com
Fri Jun 21 20:26:07 UTC 2013


On Sat, Jun 22, 2013 at 5:05 AM, Marco Diego Aurélio Mesquita
<marcodiegomesquita at gmail.com> wrote:
> Hi devs!
>
> I've been trying to improve anjuta C application project template to
> make use of template widgets. The task is not as easy as I thought.
>
> GtkApplication is not a GtkWidget, because of this, it is not possible
> to set a template for it. An option would be to instantiate a
> GtkApplication and a GtkApplicationWindow and add the
> GtkApplicationWindow to the GtkApplication. Also I don't know if it is
> really worth to use inheritance for such a simple template (or, at
> least in theory, it should be simple).

Because you are using the word 'template' in two different contexts
here... the phrase:
   "I don't know if it is really worth to use inheritance for such a
simple template"

... is a bit ambiguous.

FWIW, I think that GtkApplicationWindow is a great candidate to use
templates, as in composite widget templates provided by the new
GtkWidget feature.

Actually, it's a great idea to use template widgets in many, many
contexts, as it promotes better modularity and code structure
to use composite objects in contrast to an approach which is
sadly more traditional in GNOME.

I.e. a traditional approach is sadly:

  o Use one mega Glade file with all the widgetry of the application
  o Connect callbacks and pass a lot of shared data through the user data

GtkApplicationWindow derivatives will probably have a beefy UI definition,
in contrast with composite widgets similar to, say, GtkFontButton
or GtkVolumeButton, typically dialogs will also have beefy/large
template .ui files compared with more special case custom widgets.

As we discussed on IRC, it's just not possible to use templates for
GtkApplication, since GtkApplication is not a GtkWidget (so for now,
templates can really only be used to define composite widgets,
not composite objects).

Cheers,
    -Tristan

>
> What are your opinions?
> _______________________________________________
> Glade-devel maillist  -  Glade-devel at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-devel


More information about the Glade-devel mailing list