[Glade-users] practical question: apps locating glade file



On Thu, 2004-12-02 at 00:31 -0700, Neil Zanella wrote:
Hello,

I have a very practical concern I would like to address:

I am building an application which uses glade. This means, when the application
runs, it should load the glade file. Well, I want users to be able to
run the application
before doing a "make install" to test it. So, when I do make install,
the binary will
go under /usr/local/bin and the glade file under
/usr/local/share/fooapp or similar.

Right now I hardcode the location of the glade file in a veriable.
This could be a
relative path, so I could have ../share/fooapp/foo.glade as the relative path?
That way I can keep a similar directory structure in my tarball and test before
install in this way? How do most people do it?

Most people use an Autotools based build system.  The C source code uses
something like:

GladeXML *xml;
xml = glade_xml_new(GLADEDIR "/application.glade", NULL, NULL);

In the Makefile.am in your source directory your have:

INCLUDES = -DGLADEDIR=\"$(datadir)/myappname\"

And then at the top level you have another directory called, for
example, ui.  In this directory you have your glade file and a
Makefile.am.  In this Makefile.am you would have:

gladedir = $(datadir)/myappname

glade_DATA = application.glade

EXTRA_DIST = $(glade_DATA)

This means that the directory from which you load your glade file is
defined at build and install time.

Keith.





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