main: Notify about shutdown before tearing down

This will allow the shell to tear things down more gracefully.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
This commit is contained in:
Jonas Ådahl 2022-08-17 16:27:09 +02:00
parent 009da0df64
commit f6a5093c09
3 changed files with 19 additions and 0 deletions

View File

@ -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 ();

View File

@ -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__ */

View File

@ -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);
}