[gtk: 1/4] Conditional check for gdesktopappinfo header




commit 13b94dab10e46a2689a193555918bb41b218e4bc
Author: Dan Cîrnaț <dan alt md>
Date:   Tue May 4 13:49:45 2021 +0200

    Conditional check for gdesktopappinfo header
    
    GDesktopAppInfo is not available on macOS and needs to be disabled

 config.h.meson                    | 3 +++
 gdk/x11/gdkapplaunchcontext-x11.c | 5 ++++-
 meson.build                       | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/config.h.meson b/config.h.meson
index bc1d778f2c..56b215b012 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -284,3 +284,6 @@
 #mesondefine HAVE_TRACKER3
 
 #mesondefine HAVE_F16C
+
+/* Does the OS support GDesktopAppInfo? */
+#mesondefine HAVE_DESKTOPAPPINFO
diff --git a/gdk/x11/gdkapplaunchcontext-x11.c b/gdk/x11/gdkapplaunchcontext-x11.c
index 43c190e5e6..b2cd99019b 100644
--- a/gdk/x11/gdkapplaunchcontext-x11.c
+++ b/gdk/x11/gdkapplaunchcontext-x11.c
@@ -27,7 +27,9 @@
 #include "gdkdisplay-x11.h"
 
 #include <glib.h>
+#ifdef HAVE_DESKTOPAPPINFO
 #include <gio/gdesktopappinfo.h>
+#endif
 
 #include <string.h>
 #include <unistd.h>
@@ -349,10 +351,11 @@ gdk_x11_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
     workspace_str = g_strdup_printf ("%d", ctx->workspace);
   else
     workspace_str = NULL;
-
+#ifdef HAVE_DESKTOPAPPINFO
   if (G_IS_DESKTOP_APP_INFO (info))
     application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info));
   else
+#endif
     application_id = NULL;
 
   startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
diff --git a/meson.build b/meson.build
index b0314179a8..7534e7f8d9 100644
--- a/meson.build
+++ b/meson.build
@@ -177,6 +177,7 @@ check_headers = [
   'sys/time.h',
   'sys/types.h',
   'unistd.h',
+  'gio/gdesktopappinfo.h'
 ]
 
 foreach h : check_headers


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