From f6a5093c092b1e527fd9d46238215dc4ff7dbffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 17 Aug 2022 16:27:09 +0200 Subject: [PATCH] main: Notify about shutdown before tearing down This will allow the shell to tear things down more gracefully. Part-of: --- src/main.c | 3 +++ src/shell-global-private.h | 2 ++ src/shell-global.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/src/main.c b/src/main.c index 29275cda0..468e58849 100644 --- a/src/main.c +++ b/src/main.c @@ -585,6 +585,9 @@ main (int argc, char **argv) ecode = EXIT_FAILURE; } + g_message ("Shutting down GNOME Shell"); + _shell_global_notify_shutdown (shell_global_get ()); + meta_context_destroy (g_steal_pointer (&context)); shell_profiler_shutdown (); diff --git a/src/shell-global-private.h b/src/shell-global-private.h index 9969691cb..a0834af8e 100644 --- a/src/shell-global-private.h +++ b/src/shell-global-private.h @@ -20,4 +20,6 @@ gboolean _shell_global_check_xdnd_event (ShellGlobal *global, void _shell_global_locate_pointer (ShellGlobal *global); +void _shell_global_notify_shutdown (ShellGlobal *global); + #endif /* __SHELL_GLOBAL_PRIVATE_H__ */ diff --git a/src/shell-global.c b/src/shell-global.c index ab8000e23..365e387f0 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -120,6 +120,7 @@ enum { NOTIFY_ERROR, LOCATE_POINTER, + SHUTDOWN, LAST_SIGNAL }; @@ -507,6 +508,13 @@ shell_global_class_init (ShellGlobalClass *klass) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); + shell_global_signals[SHUTDOWN] = + g_signal_new ("shutdown", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); props[PROP_SESSION_MODE] = g_param_spec_string ("session-mode", @@ -1872,3 +1880,9 @@ _shell_global_locate_pointer (ShellGlobal *global) { g_signal_emit (global, shell_global_signals[LOCATE_POINTER], 0); } + +void +_shell_global_notify_shutdown (ShellGlobal *global) +{ + g_signal_emit (global, shell_global_signals[SHUTDOWN], 0); +}