[Glade-users] practical question: apps locating glade file
Ivan Wong
email@ivanwong.info
Sat, 11 Dec 2004 01:51:41 +0800
> Sort of OK, but it seems this method needs a recompile in order
> to do a make install. On the other hand I can't think of a better
> solution, and it seems to me that having glade_xml_new itself
> do the directory searching for the given file inappropriate.
um... how about this (a `make check` should work in both $srcdir and
$srcdir/src):
/* main.c */
gchar *gladedir = GLADEDIR;
#ifdef HAVE_LIBPOPT
static struct poptOption options[] = {
......
......
{ "gladedir", '\0', POPT_ARG_STRING, &gladedir, 0,
N_("the directory where glade xml files are placed."), NULL },
......
......
}
int main (int argc, char *argv[])
{
gchar *filename;
filename = g_build_filename (gladedir, "galeon.glade", NULL);
gladexml = glade_xml_new (filename, ...);
g_free (filename);
if (!gladexml)
gladexml = glade_xml_new (GLADEDIR "/galeon.glade", ...);
}
/* src/Makefile.am */
TESTS = test-galeon
/* src/test-galeon */
#!/bin/sh
test --gladedir="$srcdir/../ui"
Rgrds,
Ivan.