I had already posted a *very* quick start guide on how to start working on existing GNOME projects. Today I will focus on how to start your own GNOME/GTK+ project.
What programming language do I use?
The mother of all questions. While you may know that you want to do GNOME/GTK+ development the choice of languages with excellent bindings is sheer overwhelming. Unfortunately it seems that picking a language and sticking with it always involves a trade off. Anyway here are a few thoughts about picking the right language just in case you can’t make the choice on your own.
C is the language most of GNOME is written in. If you want to later contribute to core GNOME projects, C is worth learning and there is no better way than writing your own little project. The drawback is the amount of boilerplate code, the need for memory management and if you come from another language the need not only to familiarize yourself with GTK+, but also with a new programming language.
Python, C#, Java, Perl, C++ all of these languages have official GNOME bindings making all of these languages a good choice. If you come from one of these languages you will probably be up and running quite quickly. Python and pygtk are widely used in GTK+ development. C# runtime is developed in the mono project and is used in several more recent GNOME projects. Java has the benefit of running on top of the very fast Java Virtual Machine (JVM). The documentation of the Java GNOME bindings are not up to par with the other languages, but that is supposed to change in the near term and might be something you can help with? The Perl GTK+ project is gtk2-perl and C++’s project is gtkmm.
Other languages. Check the official GNOME bindings for any of the other languages. You will probably do just fine using any of these if you already know the language.
Then there isĀ Vala. Vala is a new high level language that compiles into native C code and thus will be as fast or at least almost as fast as apps written in C. Vala can therefore be used to write core GNOME libraries and apps because it does not depend on a runtime like Java, C# and Python for example do. The irc channel is always crowded so there seems to be quite some interesst in this language. Is it the future of GNOME development? I don’t know, but you should keep an eye on the project.
Summing up I would suggest to be very pragmatic with your choice. Stick to what you know and you will find success a lot quicker. After all the many GTK+ bindings have the intention of letting programmers program with whatever language they like most. If you learned the basics of GTK+ and have written your first little apps take a look at other languages. Each language has its own strengths and merits and soon you might choose a different language depending on the type of GTK+ project you are writing.
If you are new to programming and do not yet have a preferred programming language I would suggest getting started with either Python, Java or C# (I might give a slight edge to python).
Use Glade for GUI development?
So you have chosen a programming language. Now do I hand code my GUIs or do I use Glade as a graphical user interface builder? My advice would be to get started by hand coding a few of the basic widgets. Seeing the code and seeing how it works gives you a much better understanding of the GTK+ widgets and programming principles. Once you have a basic understanding of events, signals, arranging widgets etc. go ahead and start learning to use glade. For most straightforward GUIs this tool can save you a tremendous amount of time. The place to start learning to use glade is here.
I heard something about GtkBuilder instead of libglade?
Everything you need to know about this can be read Micah Carrick’s blog.
What tutorials are worth following?
- The best tutorial I have found to get you started quickly is Micah Carrick’s tutorial.
- Then there is the book Foundations of GTK+ development. So far I think it is a good resource and I will post a detailed review sometime in the near future. The only apparent problem is that the book focuses only on the C programming language and that will not be of great use if you do not plan to write your code in C.
- The official GTK+ tutorial is lengthy but a good starting point. Programming language is once again C.
- For python there is the pygtk tutorial.
- For Java there is this tutorial which gives you a quick overview of how to develop with javagnome bindings including using glade.
- For Vala there is the Vala tutorial.
- For C# and GTK# there are a whole bunch of articles and tutorials.