[goffice] Fixed plugins load from a Mac OSX bundle. [#661264] (Gerald Niel)



commit efff93c03ede8a365aec174b97bcb5ed5ac2b4ea
Author: Jean Brefort <jean vaio brefort fr>
Date:   Sun Oct 9 09:24:52 2011 +0200

    Fixed plugins load from a Mac OSX bundle. [#661264] (Gerald Niel)

 ChangeLog           |    7 +++++++
 NEWS                |    3 +++
 configure.in        |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 goffice.mk          |    1 +
 goffice/Makefile.am |    3 ++-
 goffice/goffice.c   |   22 ++++++++++++++++++++++
 6 files changed, 81 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c438fa1..7b3ddea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-09  Gerald Niel
+
+	* configure.in: fixed plugins load from a Mac OSX bundle. [#661264]
+	* goffice.mk: ditto.
+	* goffice/Makefile.am: ditto.
+	* goffice/goffice.c (libgoffice_init): ditto.
+
 2011-10-05  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/gtk8go-image-sel.c: make the dialog work again. [#660917]
diff --git a/NEWS b/NEWS
index 120241c..3f099a8 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,9 @@ Morten:
 	* Fix problem with sticky format colouring.
 	* Improve certain range functions in corner cases.  [#660564]
 
+Gerald Niel:
+	* Plugins not found when using in bundle for Mac OSX. [#661264]
+
 --------------------------------------------------------------------------
 goffice 0.8.17:
 
diff --git a/configure.in b/configure.in
index b9b9fac..3bde2d5 100644
--- a/configure.in
+++ b/configure.in
@@ -177,6 +177,51 @@ AC_MSG_RESULT($with_native_win32)
 AM_CONDITIONAL(WITH_NATIVE_WIN32, test $with_native_win32 = yes)
 AM_CONDITIONAL(HAVE_LIBEXE, test x$LIBEXE = xyes)
 
+dnl ================================================================
+dnl check for osx platform
+dnl ================================================================
+os_osx=no
+AC_MSG_CHECKING([for Mac OS X platform])
+case "$host" in
+  rhapsody* | darwin[1567].*)
+    AC_MSG_RESULT([darwin, but too old])
+    AC_MSG_ERROR([This platform is not supported, please update to latest  darwin])
+    ;;
+  *-*-darwin*)
+    platform_osx=yes
+    ;;
+  *)
+    platform_osx=no
+    ;;
+esac
+AC_MSG_RESULT([$platform_osx])
+AM_CONDITIONAL(PLATFORM_OSX, test "$platform_osx" = "yes")
+if test "x$platform_osx" = xyes; then
+  AC_DEFINE([OS_OSX],[1],[Defined if system is Mac OS X])
+  dnl check for native osx
+  gdk_windowing=`$PKG_CONFIG --variable=target gdk-2.0`
+  AC_MSG_CHECKING([for GDK-Quartz])
+
+  if test "x$gdk_windowing" = xquartz; then
+        platform=darwin/quartz
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(GDK_QUARTZ,[1],[Using GDK Quartz (not X11)])
+        PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration, [os_osx=yes], [os_osx=no])
+        dnl AC_MSG_RESULT(${os_osx})
+        if test "x$os_osx" = xyes; then
+	      AC_DEFINE([GTKOSXAPPLICATION],[1],[Defined if app is GtkOSXApplication])
+	      AC_SUBST(GTK_MAC_LIBS)
+	      AC_SUBST(GTK_MAC_CFLAGS)
+        fi
+  else
+	AC_MSG_RESULT(no)
+    os_osx=no
+  fi
+else
+    os_osx=no
+fi
+
+
 dnl ***********************************
 dnl Which conf backend should be used?
 dnl ***********************************
@@ -233,7 +278,6 @@ dnl					])
 		;;
 esac
 
-
 dnl *******************
 dnl Should we use gtk ?
 dnl *******************
@@ -652,4 +696,5 @@ Configuration:
 
 	UI:			${ui_msg}
 	Configuration backend:	${conf_msg}
+    Build gtk_mac_integration:	${os_osx}
 "
diff --git a/goffice.mk b/goffice.mk
index 538c248..6b8b0a7 100644
--- a/goffice.mk
+++ b/goffice.mk
@@ -2,6 +2,7 @@ AM_CPPFLAGS = \
 	-I$(top_builddir)		\
 	-I$(top_srcdir)			\
 	$(GOFFICE_CFLAGS)		\
+	$(GTK_MAC_CFLAGS)		\
 	-DGOFFICE_COMPILATION
 
 GOFFICE_PLUGIN_FLAGS = $(GOFFICE_PLUGIN_LDFLAGS)
diff --git a/goffice/Makefile.am b/goffice/Makefile.am
index ab340d3..bfc576c 100644
--- a/goffice/Makefile.am
+++ b/goffice/Makefile.am
@@ -8,7 +8,8 @@ libgoffice_ GOFFICE_API_VER@_la_LIBADD = 			\
 	data/libgoffice-data.la			\
 	graph/libgoffice-graph.la		\
 	math/libgoffice-math.la		\
-	$(GOFFICE_LIBS)
+	$(GOFFICE_LIBS)	\
+	$(GTK_MAC_LIBS)
 
 if WITH_GTK
 SUBDIRS += gtk component canvas
diff --git a/goffice/goffice.c b/goffice/goffice.c
index 9163cd1..3de9bf6 100644
--- a/goffice/goffice.c
+++ b/goffice/goffice.c
@@ -57,6 +57,10 @@
 #undef STRICT
 #endif
 
+#ifdef GTKOSXAPPLICATION
+#include <gtkosxapplication.h>
+#endif
+
 #ifdef GOFFICE_WITH_LASEM
 #include <goffice/graph/gog-equation.h>
 #endif
@@ -172,6 +176,24 @@ libgoffice_init (void)
 		"lib", "goffice", GOFFICE_VERSION, NULL);
 	g_free (dir);
 	}
+#else
+#ifdef GTKOSXAPPLICATION
+    if (quartz_application_get_bundle_id ())
+    {
+        gchar *dir;
+
+        dir = quartz_application_get_resource_path ();
+	libgoffice_data_dir = g_build_filename (dir,
+		"share", "goffice", GOFFICE_VERSION, NULL);
+	libgoffice_icon_dir = g_build_filename (dir,
+		"share", "pixmaps", "goffice", GOFFICE_VERSION, NULL);
+	libgoffice_locale_dir = g_build_filename (dir,
+		"share", "locale", NULL);
+	libgoffice_lib_dir = g_build_filename (dir,
+		"lib", "goffice", GOFFICE_VERSION, NULL);
+	g_free (dir);       
+    }
+#endif /* GTKOSXAPPLICATION */
 #endif
 
 	bindtextdomain (GETTEXT_PACKAGE, libgoffice_locale_dir);



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