Re: [Vala] Checking for methods

On Fri, 2008-10-31 at 20:35 +0100, Federico Pelloni wrote:
In my app I'm using some new features from Gtk 2.14, but I don't want
to depend on such a recent release just for a couple of minor things,
so I'd like to use them only if available.
I'm wondering if there's a way to check if a class/namespace has a
method (e.g. I should check for Gtk namespace to contain "show_uri"
function), something similar to python "hasattr()".
Otherwise how could I do this check?
Could be useful considering that I'm using Waf to
configure/make/install my project.

You can also check the number of Gtk at runtime.

Not sure if vala has it in the bindings:

#include <gtk/gtk.h>

extern              const guint gtk_major_version;
extern              const guint gtk_minor_version;
extern              const guint gtk_micro_version;
extern              const guint gtk_binary_age;
extern              const guint gtk_interface_age;
const gchar*        gtk_check_version                   (guint required_major,
                                                         guint required_minor,
                                                         guint required_micro);

#define             GTK_MAJOR_VERSION
#define             GTK_MINOR_VERSION
#define             GTK_MICRO_VERSION
#define             GTK_BINARY_AGE
#define             GTK_INTERFACE_AGE
#define             GTK_CHECK_VERSION                   (major,minor,micro)


Thank you

Vala-list mailing list
Vala-list gnome org

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