[glom] Fall back to the uninstalled .glade file to fix make distcheck.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Fall back to the uninstalled .glade file to fix make distcheck.
- Date: Wed, 14 Apr 2010 10:17:51 +0000 (UTC)
commit 8a6761c6de37b500c7d47c1ac831ccff102c6ba4
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Apr 14 11:24:26 2010 +0200
Fall back to the uninstalled .glade file to fix make distcheck.
* Makefile.am: Define GLOM_PKGDATADIR_NOTINSTALLED as well as the existing
GLOM_PKGDATADIR.
* glom/glade_utils.h: get_glade_file_path(): Fall back to the uninstalled
glade file if the installed one can't be found. This fixes make distcheck.
ChangeLog | 9 +++++++++
Makefile.am | 4 +++-
glom/glade_utils.h | 18 ++++++++++++++++--
3 files changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5cb0d3d..60f05f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2010-04-14 Murray Cumming <murrayc murrayc com>
+ Fall back to the uninstalled .glade file to fix make distcheck.
+
+ * Makefile.am: Define GLOM_PKGDATADIR_NOTINSTALLED as well as the existing
+ GLOM_PKGDATADIR.
+ * glom/glade_utils.h: get_glade_file_path(): Fall back to the uninstalled
+ glade file if the installed one can't be found. This fixes make distcheck.
+
+2010-04-14 Murray Cumming <murrayc murrayc com>
+
Glade utils: More error-checking.
* glom/glade_utils.h: helper_get_glade_widget_derived_with_warning():
diff --git a/Makefile.am b/Makefile.am
index a97b64d..77b00e0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -178,7 +178,9 @@ glom_defines = \
-DGLOM_DATADIR=\""$(datadir)"\" \
-DGLOM_DOCDIR=\""$(docdir)"\" \
-DGLOM_LOCALEDIR=\""$(glom_localedir)"\" \
--DGLOM_PKGDATADIR=\""$(pkgdatadir)"\"
+-DGLOM_PKGDATADIR=\""$(pkgdatadir)"\" \
+-DGLOM_PKGDATADIR_NOTINSTALLED=\""$(top_srcdir)/glom"\"
+
AM_CPPFLAGS = $(glom_includes) $(GLOM_CFLAGS) $(PYTHON_CPPFLAGS) $(BOOST_PYTHON_CFLAGS) $(glom_defines)
AM_CFLAGS = $(GLOM_WFLAGS)
diff --git a/glom/glade_utils.h b/glom/glade_utils.h
index cf0742d..ebf6f62 100644
--- a/glom/glade_utils.h
+++ b/glom/glade_utils.h
@@ -24,6 +24,7 @@
#include <iostream> // For std::cerr
#include <gtkmm/builder.h>
#include <glom/dialog_progress_creating.h>
+#include <giomm/file.h>
namespace Glom
{
@@ -33,14 +34,27 @@ namespace Utils
inline std::string get_glade_file_path(const std::string& filename)
{
+ // Check the path to the installed .glade file:
#ifdef G_OS_WIN32
gchar* directory = g_win32_get_package_installation_directory_of_module(0);
const std::string result = Glib::build_filename(directory, Glib::build_filename("share/glom/glade", filename));
g_free(directory);
- return result;
+ directory = 0;
#else
- return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "glade", filename);
+ const std::string result = Glib::build_filename(GLOM_PKGDATADIR, Glib::build_filename("glade", filename));
#endif
+
+ // Check that it exists:
+ const Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(result);
+ if(file && file->query_exists())
+ return result;
+
+ // Try to fall back to the uninstalled file in the source tree,
+ // for instance when running "make distcheck", which doesn't install to _inst/
+ // before running check.
+ std::cout << "Glade file not found: " << result << std::endl;
+ std::cout << "Falling back to the local file." << std::endl;
+ return Glib::build_filename(GLOM_PKGDATADIR_NOTINSTALLED, filename);
}
template<class T_Widget>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]