[glib] gio: Build the portal code only on *NIX



commit b5258d9d76e267f0e36743084396820c0d994a6f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jul 11 21:51:37 2016 +0800

    gio: Build the portal code only on *NIX
    
    xdg-desktop-portal support is only usable on *NIX platforms, so don't build
    them on non-*NIX platforms.  Also clean up gio/Makefile.am a bit to split out
    the listings for the platform-specific sources from the platform-neutral
    sources, and assemble them for the final list of sources required for libgio.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768498

 gio/Makefile.am |   53 ++++++++++++++++++++++++++++++++++++-----------------
 gio/gappinfo.c  |   12 ++++++++++--
 gio/giomodule.c |    8 ++++----
 3 files changed, 50 insertions(+), 23 deletions(-)
---
diff --git a/gio/Makefile.am b/gio/Makefile.am
index a638646..9829e73 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -105,7 +105,7 @@ settings_headers = \
        gsettingsschema.h               \
        gsettings.h
 
-settings_sources = \
+settings_base_sources = \
        gvdb/gvdb-format.h              \
        gvdb/gvdb-reader.h              \
        gvdb/gvdb-reader.c              \
@@ -123,15 +123,21 @@ settings_sources = \
        gsettings-mapping.c             \
        gsettings.c
 
+settings_sources = $(settings_base_sources)
+
 if OS_WIN32
-settings_sources += \
+win32_settings_sources = \
        gregistrysettingsbackend.h      \
        gregistrysettingsbackend.c
+
+settings_sources += $(win32_settings_sources)
 endif
 
 if OS_COCOA
-settings_sources += \
+cocoa_settings_sources = \
        gnextstepsettingsbackend.c
+
+settings_sources += $(cocoa_settings_sources)
 endif
 
 application_headers = \
@@ -240,7 +246,7 @@ SUBDIRS += fam
 endif
 
 if OS_UNIX
-appinfo_sources += gdesktopappinfo.c
+unix_appinfo_sources = gdesktopappinfo.c
 platform_libadd += xdgmime/libxdgmime.la
 platform_deps += xdgmime/libxdgmime.la
 unix_sources = \
@@ -264,8 +270,15 @@ unix_sources = \
        gfdonotificationbackend.c \
        ggtknotificationbackend.c \
        gportalnotificationbackend.c \
+       gdocumentportal.c       \
+       gdocumentportal.h       \
+       gportalsupport.c        \
+       gportalsupport.h        \
+       $(portal_sources)       \
        $(NULL)
 
+appinfo_sources += $(unix_appinfo_sources)
+
 if OS_COCOA
 unix_sources += gcocoanotificationbackend.c
 endif
@@ -327,9 +340,10 @@ win32_more_sources_for_vcproj = \
        win32/gwin32filemonitor.c
 
 if OS_WIN32
-appinfo_sources += gwin32appinfo.c gwin32appinfo.h
+win32_appinfo_sources = gwin32appinfo.c gwin32appinfo.h
 platform_libadd += -lshlwapi -lws2_32 -ldnsapi -liphlpapi
 win32_sources = $(win32_actual_sources)
+appinfo_sources += $(win32_appinfo_sources)
 
 giowin32includedir=$(includedir)/gio-win32-2.0/gio
 giowin32include_HEADERS = \
@@ -370,7 +384,7 @@ portal_sources = \
        $(xdp_dbus_built_sources)       \
        $(NULL)
 
-libgio_2_0_la_SOURCES =                \
+gio_base_sources =             \
        gappinfo.c              \
        gappinfoprivate.h       \
        gasynchelper.c          \
@@ -392,8 +406,6 @@ libgio_2_0_la_SOURCES =             \
        gdatagrambased.c        \
        gdatainputstream.c      \
        gdataoutputstream.c     \
-       gdocumentportal.c       \
-       gdocumentportal.h       \
        gdrive.c                \
        gdummyfile.h            \
        gdummyfile.c            \
@@ -458,8 +470,6 @@ libgio_2_0_la_SOURCES =             \
        gpollableutils.c        \
        gpollfilemonitor.c      \
        gpollfilemonitor.h      \
-       gportalsupport.c        \
-       gportalsupport.h        \
        gproxy.c                \
        gproxyaddress.c         \
        gproxyaddressenumerator.c \
@@ -520,15 +530,18 @@ libgio_2_0_la_SOURCES =           \
        gioenumtypes.h          \
        gioenumtypes.c          \
        glistmodel.c            \
-       gliststore.c            \
+       gliststore.c            \
+       $(application_sources)  \
+       $(gdbus_sources)        \
+       $(local_sources)        \
+       $(NULL)
+
+libgio_2_0_la_SOURCES =                \
+       $(gio_base_sources)     \
        $(appinfo_sources)      \
        $(unix_sources)         \
        $(win32_sources)        \
-       $(application_sources)  \
        $(settings_sources)     \
-       $(gdbus_sources)        \
-       $(local_sources)        \
-       $(portal_sources)       \
        $(NULL)
 
 EXTRA_DIST += strinfo.c
@@ -903,8 +916,14 @@ gio_LDADD = libgio-2.0.la                          \
 #
 MSVCPROJS = gio glib-compile-resources glib-compile-schemas
 
-gio_FILES = $(libgio_2_0_la_SOURCES) $(win32_actual_sources) $(win32_more_sources_for_vcproj)
-gio_EXCLUDES = gunix*.c|gdesktopappinfo.c|gnetworkmonitornetlink.c|gcontenttype.c|gnetworkmonitornm.c
+gio_FILES =    \
+       $(gio_base_sources)                     \
+       $(win32_actual_sources)                 \
+       $(win32_more_sources_for_vcproj)        \
+       $(settings_base_sources)                \
+       $(win32_settings_sources)
+
+gio_EXCLUDES = dummy
 
 gio_HEADERS_DIR = $(includedir)/glib-2.0/gio
 gio_HEADERS_INST = $(gioinclude_HEADERS) $(nodist_gioinclude_HEADERS)
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index 78ecab6..d9ae46e 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -23,14 +23,18 @@
 #include "gappinfo.h"
 #include "gappinfoprivate.h"
 #include "gcontextspecificgroup.h"
-#include "gdbusconnection.h"
-#include "gdbusmessage.h"
 
 #include "glibintl.h"
 #include <gioerror.h>
 #include <gfile.h>
+
+#ifdef G_OS_UNIX
+#include "gdbusconnection.h"
+#include "gdbusmessage.h"
 #include "gdocumentportal.h"
 #include "gportalsupport.h"
+#endif
+
 
 
 /**
@@ -673,6 +677,7 @@ g_app_info_should_show (GAppInfo *appinfo)
   return (* iface->should_show) (appinfo);
 }
 
+#ifdef G_OS_UNIX
 static gboolean
 launch_default_with_portal (const char         *uri,
                             GAppLaunchContext  *context,
@@ -737,6 +742,7 @@ launch_default_with_portal (const char         *uri,
 
   return TRUE;
 }
+#endif
 
 /**
  * g_app_info_launch_default_for_uri:
@@ -761,8 +767,10 @@ g_app_info_launch_default_for_uri (const char         *uri,
   GList l;
   gboolean res;
 
+#ifdef G_OS_UNIX
   if (glib_should_use_portal ())
     return launch_default_with_portal (uri, launch_context, error);
+#endif
 
   /* g_file_query_default_handler() calls
    * g_app_info_get_default_for_uri_scheme() too, but we have to do it
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 0c32af4..dcd523b 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -903,10 +903,8 @@ extern GType _g_win32_volume_monitor_get_type (void);
 extern GType _g_winhttp_vfs_get_type (void);
 
 extern GType _g_dummy_proxy_resolver_get_type (void);
-extern GType g_proxy_resolver_portal_get_type (void);
 extern GType _g_dummy_tls_backend_get_type (void);
 extern GType g_network_monitor_base_get_type (void);
-extern GType g_network_monitor_portal_get_type (void);
 #ifdef HAVE_NETLINK
 extern GType _g_network_monitor_netlink_get_type (void);
 extern GType _g_network_monitor_nm_get_type (void);
@@ -916,6 +914,8 @@ extern GType _g_network_monitor_nm_get_type (void);
 extern GType g_fdo_notification_backend_get_type (void);
 extern GType g_gtk_notification_backend_get_type (void);
 extern GType g_portal_notification_backend_get_type (void);
+extern GType g_proxy_resolver_portal_get_type (void);
+extern GType g_network_monitor_portal_get_type (void);
 #endif
 
 #ifdef HAVE_COCOA
@@ -1118,6 +1118,8 @@ _g_io_modules_ensure_loaded (void)
       g_type_ensure (g_fdo_notification_backend_get_type ());
       g_type_ensure (g_gtk_notification_backend_get_type ());
       g_type_ensure (g_portal_notification_backend_get_type ());
+      g_type_ensure (g_network_monitor_portal_get_type ());
+      g_type_ensure (g_proxy_resolver_portal_get_type ());
 #endif
 #ifdef HAVE_COCOA
       g_type_ensure (g_cocoa_notification_backend_get_type ());
@@ -1127,7 +1129,6 @@ _g_io_modules_ensure_loaded (void)
 #endif
       g_type_ensure (_g_local_vfs_get_type ());
       g_type_ensure (_g_dummy_proxy_resolver_get_type ());
-      g_type_ensure (g_proxy_resolver_portal_get_type ());
       g_type_ensure (_g_http_proxy_get_type ());
       g_type_ensure (_g_https_proxy_get_type ());
       g_type_ensure (_g_socks4a_proxy_get_type ());
@@ -1135,7 +1136,6 @@ _g_io_modules_ensure_loaded (void)
       g_type_ensure (_g_socks5_proxy_get_type ());
       g_type_ensure (_g_dummy_tls_backend_get_type ());
       g_type_ensure (g_network_monitor_base_get_type ());
-      g_type_ensure (g_network_monitor_portal_get_type ());
 #ifdef HAVE_NETLINK
       g_type_ensure (_g_network_monitor_netlink_get_type ());
       g_type_ensure (_g_network_monitor_nm_get_type ());


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