- Fixed installation of gtk-glade interface.

=> desmume-glade finds its glade interfaces now.
This commit is contained in:
evilynux 2007-02-04 23:45:13 +00:00
parent da53c04ecb
commit 5ce404bc01
3 changed files with 33 additions and 4 deletions

View File

@ -69,6 +69,10 @@ if test ! "x$HAVE_PKG" = "x" ; then
HAVE_LIBGLADE=no)
AC_SUBST(LIBGLADE_CFLAGS)
AC_SUBST(LIBGLADE_LIBS)
dnl uninstalled glade ui dir
AC_DEFINE_UNQUOTED(GLADEUI_UNINSTALLED_DIR,"`pwd`/src",[path to glade ui dir])
AC_SUBST(GLADEUI_UNINSTALLED_DIR)
fi

View File

@ -1,4 +1,3 @@
EXTRA_DIST = DeSmuME.dev glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm
bin_PROGRAMS = desmume-glade
desmume_glade_SOURCES = \
callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h desmume.c desmume.h \
@ -7,6 +6,12 @@ desmume_glade_SOURCES = \
dTools/callbacks_3_palview.c dTools/callbacks_dtools.h \
dTools/dTools_display.h \
../sndsdl.h ../sndsdl.c ../ctrlssdl.h ../ctrlssdl.c
gladedir = $(datadir)/desmume/glade
glade_DATA = glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm
desmume_glade_LDADD = ../libdesmume.a $(SDL_LIBS) $(GDKGLEXT_LIBS) $(LIBGLADE_LIBS)
desmume_glade_CFLAGS = $(SDL_CFLAGS) $(GDKGLEXT_CFLAGS) $(LIBGLADE_CFLAGS)
desmume_glade_CFLAGS = $(SDL_CFLAGS) $(GDKGLEXT_CFLAGS) $(LIBGLADE_CFLAGS) -DDATADIR=\"$(gladedir)/\"
desmume_glade_LDFLAGS = -rdynamic
EXTRA_DIST = DeSmuME.dev $(glade_DATA)

View File

@ -58,6 +58,26 @@ void notify_Tools() {
g_list_foreach(tools_to_update, &notify_Tool, NULL);
}
/* Return the glade directory. */
gchar * get_ui_file (const char *filename)
{
char *path;
/* looking in uninstalled dir first */
path = g_build_filename (GLADEUI_UNINSTALLED_DIR, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
return path;
g_free (path);
/* looking in installed dir */
path = g_build_filename (DATADIR, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
return path;
g_free (path);
/* not found */
return NULL;
}
/* ***** ***** CONFIG FILE ***** ***** */
@ -226,8 +246,8 @@ int main(int argc, char *argv[]) {
Read_ConfigFile();
/* load the interface */
xml = glade_xml_new("glade/DeSmuMe.glade", NULL, NULL);
xml_tools = glade_xml_new("glade/DeSmuMe_Dtools.glade", NULL, NULL);
xml = glade_xml_new(get_ui_file("DeSmuMe.glade"), NULL, NULL);
xml_tools = glade_xml_new(get_ui_file("DeSmuMe_Dtools.glade"), NULL, NULL);
pWindow = glade_xml_get_widget(xml, "wMainW");
pDrawingArea = glade_xml_get_widget(xml, "wDraw_Main");
pDrawingArea2 = glade_xml_get_widget(xml, "wDraw_Sub");