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




commit 7af54c3c61883c9c1d1594746b29c1e544ac6d70
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.

 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 57acbf9441..75bac77b02 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),
+                           SHELL_UTIL_SYSTEMD_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]