Adjust NSM Consumer D-Bus interface to match the real NSM
[profile/ivi/node-startup-controller.git] / node-startup-controller / job-manager.c
index a3f7318..85d4a0c 100644 (file)
 
 
 
+/**
+ * SECTION: job-manager 
+ * @title: JobManager
+ * @short_description: Manages systemd jobs.
+ * @stability: Internal
+ * 
+ * The #JobManager simplifies starting and stopping systemd units by handling all the
+ * D-Bus communication with the systemd manager internally. Units can be started and
+ * stopped using job_manager_start() and job_manager_stop() and will call the @callback
+ * passed to the function when the unit is started or stopped.
+ * 
+ * The #JobManager contains an internal table which associates systemd job names with the
+ * necessary information about that job, e.g. the unit name.
+ * 
+ * When the #JobManager is told to start or stop a unit, it creates a job in systemd to
+ * start or stop that unit, stores the name of that job and waits until that job has
+ * finished before calling the @callback.
+ * 
+ * The #JobManager finds out that a job has finished by listening to "JobRemoved" signals
+ * from systemd and looking for that job by its job name.
+ */
+
+
+
 typedef struct _JobManagerJob JobManagerJob;
 
 
@@ -408,7 +432,16 @@ job_manager_forget_job (JobManager  *manager,
 }
 
 
-
+/**
+ * job_manager_new:
+ * @connection: A connection to the system bus. 
+ * @systemd_manager: An interface to the systemd manager created with 
+ * systemd_manager_proxy_new_for_bus_sync()
+ * 
+ * Creates a new JobManager object.
+ * 
+ * Returns: A new instance of the #JobManager.
+ */
 JobManager *
 job_manager_new (GDBusConnection *connection,
                  SystemdManager  *systemd_manager)
@@ -424,6 +457,14 @@ job_manager_new (GDBusConnection *connection,
 
 
 
+/**
+ * job_manager_start:
+ * @unit: The name of the systemd unit to start.
+ * @callback: a #JobManagerCallback that is called after the job is started.
+ * @user_data: userdata that is available in the #JobManagerCallback.
+ * 
+ * Asynchronously starts @unit, and calls @callback with @user_data when it is finished.
+ */
 void
 job_manager_start (JobManager        *manager,
                    const gchar       *unit,
@@ -448,6 +489,14 @@ job_manager_start (JobManager        *manager,
 
 
 
+/**
+ * job_manager_stop:
+ * @unit: The name of the systemd unit to stop.
+ * @callback: a #JobManagerCallback that is called after the job is stopped.
+ * @user_data: userdata that is available in the #JobManagerCallback.
+ * 
+ * Asynchronously stops @unit, and calls @callback with @user_data when it is finished.
+ */
 void
 job_manager_stop (JobManager        *manager,
                   const gchar       *unit,