6

I have to develop a native application on Linux for a school project. I chose to work with GTK and I started to read the official guide.

The GTK API itself is pretty easy to understand but I'm facing problems with GObject and GLib, they are hard to learn and I don't know why they are used to. Should I learn GObject and GLib to work with GTK?

The GObject official documentation is incredibly huge https://developer.gnome.org/gobject/stable/ and I will need few weeks to just learn GObject to finally learn GTK.

Mathieu
  • 311
  • 2
  • 12

1 Answers1

6

GTK+ is based on GLib and uses its main loop for event handling and memory management. If you code in C you have to understand how GLib works (otherwise you will have memory leaks). Lower level details of object system (GObject) are only interesting if you create custom widgets.

However, if your project's requirements allow Python or JavaScript then Glib/GObject are next to useless on their own and you can dive into GTK+ directly.

Source: authored apps using PyGObject, gtkmm and raw GTK+ in C.

  • Note that you do not have to learn _absolutely everything_ either. You only need the basics and knowledge of how to use GTK+ securely. This is a very very good answer from a fairly new user. Thanks Artem. – oldtechaa Oct 12 '16 at 14:31
  • 1
    Understanding the basics of GObject will be necessary to understand how some of the more complex widgets, most notably GtkTreeView, work. You still don't need to know enough to make your own object, but you do need to understand what properties, signals, and GValues are, at the least. – andlabs Oct 12 '16 at 14:37
  • @andlabs, yes, although I should hope anyone knows the basics of properties and signals. Since I've only done GTK+ programming in Perl, I haven't really had to use GObject directly. – oldtechaa Oct 12 '16 at 14:43