From 5ce404bc01421fcc9ecf73f31a3a3746cff872d7 Mon Sep 17 00:00:00 2001 From: evilynux Date: Sun, 4 Feb 2007 23:45:13 +0000 Subject: [PATCH] - Fixed installation of gtk-glade interface. => desmume-glade finds its glade interfaces now. --- desmume/configure.ac | 4 ++++ desmume/src/gtk-glade/Makefile.am | 9 +++++++-- desmume/src/gtk-glade/main.c | 24 ++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/desmume/configure.ac b/desmume/configure.ac index ec12d89e3..65a8b6361 100644 --- a/desmume/configure.ac +++ b/desmume/configure.ac @@ -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 diff --git a/desmume/src/gtk-glade/Makefile.am b/desmume/src/gtk-glade/Makefile.am index d70ae33fd..a4ee7ce2a 100644 --- a/desmume/src/gtk-glade/Makefile.am +++ b/desmume/src/gtk-glade/Makefile.am @@ -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) diff --git a/desmume/src/gtk-glade/main.c b/desmume/src/gtk-glade/main.c index 35747eeba..0c89ad6ae 100755 --- a/desmume/src/gtk-glade/main.c +++ b/desmume/src/gtk-glade/main.c @@ -58,6 +58,26 @@ void notify_Tools() { g_list_foreach(tools_to_update, ¬ify_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");