From e743bfba0fb233cd08e1099d6cfa9b7533462bd0 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 19 Jun 2024 15:15:53 +0200 Subject: src/: Skip start_notification_daemon() and start_real_wm() if in test-mode. --- src/arctica-greeter.vala | 126 +++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 60 deletions(-) diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index a30a8e3..e90bcb0 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -1065,28 +1065,31 @@ public class ArcticaGreeter : Object public void start_notification_daemon () { - try + if (!test_mode) { - string[] argv = null; + try + { + string[] argv = null; - if (FileUtils.test ("/usr/lib/mate-notification-daemon/mate-notification-daemon", FileTest.EXISTS)) { - Shell.parse_argv ("/usr/lib/mate-notification-daemon/mate-notification-daemon --replace", out argv); + if (FileUtils.test ("/usr/lib/mate-notification-daemon/mate-notification-daemon", FileTest.EXISTS)) { + Shell.parse_argv ("/usr/lib/mate-notification-daemon/mate-notification-daemon --replace", out argv); + } + else if (FileUtils.test ("/usr/libexec/mate-notification-daemon/mate-notification-daemon", FileTest.EXISTS)) { + Shell.parse_argv ("/usr/libexec/mate-notification-daemon/mate-notification-daemon --replace", out argv); + } + if (argv != null) + Process.spawn_async (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + out notificationdaemon_pid); + debug ("Launched mate-notification-daemon. PID: %d", notificationdaemon_pid); } - else if (FileUtils.test ("/usr/libexec/mate-notification-daemon/mate-notification-daemon", FileTest.EXISTS)) { - Shell.parse_argv ("/usr/libexec/mate-notification-daemon/mate-notification-daemon --replace", out argv); + catch (Error e) + { + warning ("Error starting the mate-notification-daemon registry: %s", e.message); } - if (argv != null) - Process.spawn_async (null, - argv, - null, - SpawnFlags.SEARCH_PATH, - null, - out notificationdaemon_pid); - debug ("Launched mate-notification-daemon. PID: %d", notificationdaemon_pid); - } - catch (Error e) - { - warning ("Error starting the mate-notification-daemon registry: %s", e.message); } } @@ -1111,53 +1114,56 @@ public class ArcticaGreeter : Object public void start_real_wm () { - string wm = AGSettings.get_string (AGSettings.KEY_WINDOW_MANAGER); - if ((wm == "metacity") || (wm == "marco")) + if (!test_mode) { - try - { - string[] argv; - - Shell.parse_argv (wm, out argv); - Process.spawn_async (null, - argv, - null, - SpawnFlags.SEARCH_PATH, - null, - out windowmanager_pid); - debug ("Launched '%s' WM. PID: %d", wm, windowmanager_pid); - } - catch (Error e) + string wm = AGSettings.get_string (AGSettings.KEY_WINDOW_MANAGER); + if ((wm == "metacity") || (wm == "marco")) { - warning ("Error starting the '%s' Window Manager: %s", wm, e.message); - } + try + { + string[] argv; - Timeout.add (50, () => + Shell.parse_argv (wm, out argv); + Process.spawn_async (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + out windowmanager_pid); + debug ("Launched '%s' WM. PID: %d", wm, windowmanager_pid); + } + catch (Error e) { - try - { - string[] argv; - Pid wm_message_pid = 0; - - Shell.parse_argv ("%s-message disable-keybindings".printf(wm), out argv); - - Process.spawn_sync (null, - argv, - null, - SpawnFlags.SEARCH_PATH, - null, - null, - null, - null); - debug ("Launched '%s-message disable-keybindings' command", wm); - return false; - } - catch (Error e) + warning ("Error starting the '%s' Window Manager: %s", wm, e.message); + } + + Timeout.add (50, () => { - warning ("Error during '%s-message disable-keybindings' command call: %s", wm, e.message); - return true; - } - }); + try + { + string[] argv; + Pid wm_message_pid = 0; + + Shell.parse_argv ("%s-message disable-keybindings".printf(wm), out argv); + + Process.spawn_sync (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + null, + null, + null); + debug ("Launched '%s-message disable-keybindings' command", wm); + return false; + } + catch (Error e) + { + warning ("Error during '%s-message disable-keybindings' command call: %s", wm, e.message); + return true; + } + }); + } } } -- cgit v1.2.3