On Sat, Apr 23, 2011 at 4:19 PM, Ardhan Madras <aj...@knac.com> wrote: > Hi All, > > I want to port my application to GTK+ 3, but I don't want to broke > with GTK+ 2 API and ABI, what is the best way to determine GTK+ 3 version in > compile time? > > Does > > #if GTK_MAJOR_VERSION == 3 > > enough for it?
I like to use the GTK_CHECK_VERSION (maj, min, micro) macro for that kind of check. Depending on your project, you might not want to maintain the identical source tree to compile for GTK+2 and GTK+3... the techniques you will end up using for GTK+3 might be different from the techniques you used with GTK+2, in which case it's not a matter of calling one function from GTK+2 or another for GTK+3 (for instance, if your custom widget implements ->size_request() for GTK+2, it needs to implement a set of different functions for GTK+3)... so you might easily end up with a big mess of #ifdef hell. On the other hand if your application consists of a simple dialog with a couple buttons, it might make sense to use #if statements at pre-processing time. Anyway, with a good VCS you should be able to easily maintain an old GTK+2 branch of your project and easily backport the fixes which apply from your new GTK+3 branch back into the old source base (and avoid the whole #ifdef mess easily enough). Cheers, -Tristan _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list