Federico Pelloni wrote:
In my project I need to load some custom pixmaps that will be
installed into $prefix/share/projectname/pixmaps, with $prefix being
set at configure time. Classical situation for many applications. How
can I make my program find that files?
I'm using Waf to configure/build/install my application, and I can
have created a config.h file with those paths defined, but I don't
know how to access them within my .vala files.
I saw some projects (Valaide for example) using a "Config" namespace
or class, but I could not understand how it works.
I'd be glad if someone could explain me which direction I've to go to
solve this problem.
Thank you.
You have to create a 'config.vapi' file as a bridge between Vala and
your 'config.h', which declares the constants you want to access in a
namespace. For example:
-----
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename =
"config.h")]
namespace Config {
public const string GETTEXT_PACKAGE;
public const string PACKAGE_DATADIR;
public const string LOCALE_DIR;
public const string THEME_DIR;
public const string PACKAGE_NAME;
public const string PACKAGE_VERSION;
public const string PACKAGE;
public const string VERSION;
}
-----
Then you can use this vapi file by passing '--pkg config' to valac.
Don't forget to tell valac via '--vapidir' where to search for this
file.
Regards,
Frederik
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list