9 ms·
This is pretty awesome. GNOME itself is all written in pure C using glib, which also contains GObject, a beautiful OOP approach for the C programming language.
by gfalcao 13y ago
This is pretty awesome.
GNOME itself is all written in pure C using glib, which also contains GObject, a beautiful OOP approach for the C programming language. It has a dynamic type system, supports meta programming...
Very few people know it, but GNOME's GTK interface is fully object oriented, and BTW when you click a GTK button you are clicking on an instance of the class GtkButton that inherits from GtkBin which inherits from GtkWidget. it's a beautiful thing!
Also because GObject is based on a lot of conventions it makes really easy to generate bindings to other programming languages automatically, so basically you can write you library in C with OOP approach using GObject, and for free you get your library easily bound to python, ruby, js or any other language.
https://developer.gnome.org/gobject/stable/ https://developer.gnome.org/gobject/stable/
- aninteger 13y agoGTK is often used as the example of what not to do when designing interfaces. A better pure C example would be Wine's implementation of the Win32 API (specifically take a look at user32.dll). Or the Tk toolkit.
- gfalcao 13y agoI disagree that GTK is an example of what NOT to do when designing interfaces. But anyways I just mentioned GTK as an example of GObject usage, which was my original point. GObject is independent of GTK. Also here is the link for the introspection tool that generates bindings to other languages: https://wiki.gnome.org/action/show/Projects/GObjectIntrospection?action=show&redirect=GObjectIntrospection https://wiki.gnome.org/action/show/Projects/GObjectIntrospec...