shell: Add call to check the existence of a systemd unit

These checks will be handy while handling ibus-daemon startup, since
this is going to move to a systemd service soon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2171>
This commit is contained in:
Carlos Garnacho 2022-02-10 14:06:30 +01:00 committed by Marge Bot
parent adc58ea743
commit 352c9695f3
2 changed files with 26 additions and 0 deletions

View File

@ -787,6 +787,25 @@ shell_util_stop_systemd_unit_finish (GAsyncResult *res,
return g_task_propagate_boolean (G_TASK (res), error);
}
void
shell_util_systemd_unit_exists (const gchar *unit,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
shell_util_systemd_call ("GetUnit",
g_variant_new ("(s)", unit),
SYSTEMD_CALL_FLAGS_NONE,
cancellable, callback, user_data);
}
gboolean
shell_util_systemd_unit_exists_finish (GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
void
shell_util_sd_notify (void)
{

View File

@ -72,6 +72,13 @@ void shell_util_stop_systemd_unit (const char *unit,
gboolean shell_util_stop_systemd_unit_finish (GAsyncResult *res,
GError **error);
void shell_util_systemd_unit_exists (const gchar *unit,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean shell_util_systemd_unit_exists_finish (GAsyncResult *res,
GError **error);
void shell_util_sd_notify (void);
gboolean shell_util_has_x11_display_extension (MetaDisplay *display,