From 7be8f795608de55536b6a3c1463e9a5033cf0b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 6 Jun 2024 15:31:34 +0200 Subject: [PATCH] shell/app: Remove some dead code `g_desktop_app_info_launch_uris_as_manager_with_fds()` was added in GIO 2.57.2. We now depend on at least 2.79.2, so we no longer need a fallback path for the case the function isn't available. Part-of: (cherry picked from commit 55027bb084a0ee2cee639a8cc29e4df0cd000ccd) --- config.h.meson | 3 --- meson.build | 5 ----- src/shell-app.c | 40 ---------------------------------------- 3 files changed, 48 deletions(-) diff --git a/config.h.meson b/config.h.meson index 5ad68d839..914fc2ebd 100644 --- a/config.h.meson +++ b/config.h.meson @@ -31,9 +31,6 @@ /* Define if _NL_TIME_FIRST_WEEKDATE is available */ #mesondefine HAVE__NL_TIME_FIRST_WEEKDAY -/* Define if you have the `g_desktop_app_info_launch_uris_as_manager_with_fds` function */ -#mesondefine HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS - /* Define if fdwalk is available in libc */ #mesondefine HAVE_FDWALK diff --git a/meson.build b/meson.build index 857c0b93c..5a329a72e 100644 --- a/meson.build +++ b/meson.build @@ -146,11 +146,6 @@ cdata.set('HAVE_NETWORKMANAGER', have_networkmanager) cdata.set('HAVE_PIPEWIRE', have_pipewire) cdata.set('HAVE_SYSTEMD', have_systemd) -# New API added in glib-2.57.2 -cdata.set('HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS', - cc.has_function('g_desktop_app_info_launch_uris_as_manager_with_fds', - dependencies : gio_dep) -) cdata.set('HAVE_FDWALK', cc.has_function('fdwalk')) cdata.set('HAVE_MALLINFO', cc.has_function('mallinfo')) cdata.set('HAVE_MALLINFO2', cc.has_function('mallinfo2')) diff --git a/src/shell-app.c b/src/shell-app.c index dcebc97da..9bea3e347 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -1241,33 +1241,6 @@ child_context_setup (gpointer user_data) meta_context_restore_rlimit_nofile (meta_context, NULL); } -#if !defined(HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS) && defined(HAVE_SYSTEMD) -/* This sets up the launched application to log to the journal - * using its own identifier, instead of just "gnome-session". - */ -static void -app_child_setup (gpointer user_data) -{ - const char *appid = user_data; - int res; - int journalfd = sd_journal_stream_fd (appid, LOG_INFO, FALSE); - ShellGlobal *shell_global = shell_global_get (); - - if (journalfd >= 0) - { - do - res = dup2 (journalfd, 1); - while (G_UNLIKELY (res == -1 && errno == EINTR)); - do - res = dup2 (journalfd, 2); - while (G_UNLIKELY (res == -1 && errno == EINTR)); - (void) close (journalfd); - } - - child_context_setup (shell_global); -} -#endif - static void wait_pid (GDesktopAppInfo *appinfo, GPid pid, @@ -1381,7 +1354,6 @@ shell_app_launch (ShellApp *app, flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN; -#ifdef HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS /* Optimized spawn path, avoiding a child_setup function */ { int journalfd = -1; @@ -1403,18 +1375,6 @@ shell_app_launch (ShellApp *app, if (journalfd >= 0) (void) close (journalfd); } -#else /* !HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS */ - ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL, - context, - flags, -#ifdef HAVE_SYSTEMD - app_child_setup, (gpointer)shell_app_get_id (app), -#else - child_context_setup, shell_global, -#endif - wait_pid, NULL, - error); -#endif /* HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS */ g_object_unref (context); return ret;