[gnome-shell/wip/carlosg/ibus-startup: 15/16] shell: Add call to check the existence of a systemd unit




commit 352c9695f3def99571fed7f188e1546fcfae2784
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Feb 10 14:06:30 2022 +0100

    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>

 src/shell-util.c | 19 +++++++++++++++++++
 src/shell-util.h |  7 +++++++
 2 files changed, 26 insertions(+)
---
diff --git a/src/shell-util.c b/src/shell-util.c
index 4a53a7c99e..a336868130 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -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)
 {
diff --git a/src/shell-util.h b/src/shell-util.h
index 04485b99c1..7e1f7d88c1 100644
--- a/src/shell-util.h
+++ b/src/shell-util.h
@@ -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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]