[glibmm/glibmm-2-52] Gio: Exclude DesktopAppInfo from wrap_init.cc on MacOS



commit 6ef89b62e563065b7bc720f15e70ae7cd8ae6929
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Aug 15 18:51:19 2017 +0200

    Gio: Exclude DesktopAppInfo from wrap_init.cc on MacOS
    
    Modify the conditional inclusion of desktopappinfo.h in giomm.h and
    wrap_init.cc. It shall not be included when running under MacOS. This should
    have been fixed by commit fe99895f8d3b61409c416f1244a29f2aa3478f96.
    Bug 781947

 configure.ac              |   18 +++++++++++++-----
 gio/giomm.h               |    2 +-
 gio/src/desktopappinfo.hg |    4 +++-
 glib/glibmmconfig.h.in    |    3 +++
 4 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7006b82..d54668c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,17 +55,25 @@ AS_CASE([$host_os], [mingw*], [glibmm_host_windows=yes], [glibmm_host_windows=no
 AC_MSG_RESULT([$glibmm_host_windows])
 AM_CONDITIONAL([HOST_WINDOWS_NATIVE], [test "x$glibmm_host_windows" = xyes])
 
-glib_have_cocoa=no
+# This test for Mac OS is copied from glib. If the result of glib's test
+# is ever made available outside glib, use glib's result instead of this test.
+# glib: https://bugzilla.gnome.org/show_bug.cgi?id=780309
+# glibmm: https://bugzilla.gnome.org/show_bug.cgi?id=781947
+glibmm_have_cocoa=no
 AC_MSG_CHECKING([for Mac OS X Cocoa support])
-AC_TRY_CPP([
+AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
 #include <Cocoa/Cocoa.h>
 #ifdef GNUSTEP_BASE_VERSION
 #error "Detected GNUstep, not Cocoa"
 #endif
-], glib_have_cocoa=yes)
+]])],[glibmm_have_cocoa=yes],[])
 
-AC_MSG_RESULT([$glib_have_cocoa])
-AM_CONDITIONAL(OS_COCOA, [test "$glib_have_cocoa" = "yes"])
+AC_MSG_RESULT([$glibmm_have_cocoa])
+AM_CONDITIONAL(OS_COCOA, [test "$glibmm_have_cocoa" = "yes"])
+AS_IF([test "$glibmm_have_cocoa" = "yes"],
+[
+  AC_DEFINE([GLIBMM_OS_COCOA], [1], [Define only on Mac OS, COCOA])
+])
 
 # TODO: This makes no sense. --danielk
 AS_IF([test "x$enable_static" = xyes],
diff --git a/gio/giomm.h b/gio/giomm.h
index a7c0a91..e21c99b 100644
--- a/gio/giomm.h
+++ b/gio/giomm.h
@@ -61,7 +61,7 @@
 #include <giomm/dbussubtreevtable.h>
 #include <giomm/dbusutils.h>
 #include <giomm/dbuswatchname.h>
-#ifndef G_OS_WIN32
+#if !defined(G_OS_WIN32) && !defined(GLIBMM_OS_COCOA)
 #include <giomm/desktopappinfo.h>
 #endif
 #include <giomm/drive.h>
diff --git a/gio/src/desktopappinfo.hg b/gio/src/desktopappinfo.hg
index 9c08401..cc33b61 100644
--- a/gio/src/desktopappinfo.hg
+++ b/gio/src/desktopappinfo.hg
@@ -23,6 +23,9 @@ _CONFIGINCLUDE(giommconfig.h)
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
 
+// This file is not used on Windows and Mac OS Cocoa
+_GMMPROC_WRAP_CONDITIONALLY(if !defined(G_OS_WIN32) && !defined(GLIBMM_OS_COCOA))
+
 namespace Glib
 {
 
@@ -44,7 +47,6 @@ class DesktopAppInfo
 {
   _CLASS_GOBJECT(DesktopAppInfo, GDesktopAppInfo, G_DESKTOP_APP_INFO, Glib::Object, GObject)
   _IMPLEMENTS_INTERFACE(AppInfo)
-  _GTKMMPROC_WIN32_NO_WRAP
 
 public:
   // TODO: should use _WRAP_CREATE(), but these functions do more than just call
diff --git a/glib/glibmmconfig.h.in b/glib/glibmmconfig.h.in
index a36c293..e5639cb 100644
--- a/glib/glibmmconfig.h.in
+++ b/glib/glibmmconfig.h.in
@@ -22,6 +22,9 @@
 
 #ifdef GLIBMM_CONFIGURE
 
+/* Define only on Mac OS, COCOA */
+#undef GLIBMM_OS_COCOA
+
 /* Define if extern "C" and extern "C++" function pointers are compatible. */
 #undef GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS
 


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