Re: GTK+ brochure for FOSDEM

On Fri, 23 Jan 2015 21:06:05 +0100
Sébastien Wilmet <swilmet gnome org> wrote:
Uh, it's quite the contrary IMHO. If a developer chooses the C
language and wants to write a GTK+ application, it's advised to write
GObject classes to have a good code architecture. Look at gedit for
instance, it's full of GObject classes. You create a subclass of
GtkApplication, a subclass of GtkWindow for your main window,
subclasses of GtkGrid or GtkBox for some other components that you
have in your application, etc. Without GObject, you can write
structs, allocate them and pass a pointer as the self argument, but
GObject is much more powerful. It's interesting to create signals for

You are looking at it from the perspective of a GTK+ developer and not
an application developer.

Application developers not providing applications specifically for
the gnome stack almost never need to sub-class the library-provided GTK+
widgets.  For example, contrary to what you think, they do not sub-class
GtkWindow for their main window.  Instead they use the (generally)
perfectly adequate GTK+ container system to put things in GtkWindow
objects, or in library-provided sub-classes of GtkWindow.  If they want
to be particularly rigorous, they may provide a convenience factory
function for the purpose.  If that doesn't work they probably use
another toolkit, because OO with GObject is a pain for the application
developer writing in C (and as I say, normally completely unnecessary).
Nor for that matter would they normally sub-class GtkApplication: they
just connect to GApplication signals to customize behaviour.

Only in very specialized circumstances is derivation necessary in the
average application.


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