[gnome-session] Add an IsSessionRunning method



commit b59d358796343f81b31d4a398998faedd20b8f4b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 27 00:39:12 2011 -0400

    Add an IsSessionRunning method
    
    This gives clients who missed the SessionRunning signal a chance
    to find out if the session has entered the running phase, and
    lets us avoid race conditions.
    
    Patch by Dan Williams,
    https://bugzilla.gnome.org/show_bug.cgi?id=636229

 gnome-session/gsm-manager.c                |   12 ++++++++++++
 gnome-session/gsm-manager.h                |    3 +++
 gnome-session/org.gnome.SessionManager.xml |   15 +++++++++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 7cba07d..12699a9 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -3979,3 +3979,15 @@ gsm_manager_add_autostart_apps_from_dir (GsmManager *manager,
 
         return TRUE;
 }
+
+gboolean
+gsm_manager_is_session_running (GsmManager *manager,
+                                gboolean   *running,
+                                GError    **error)
+{
+        g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
+
+        *running = (manager->priv->phase == GSM_MANAGER_PHASE_RUNNING);
+        return TRUE;
+}
+
diff --git a/gnome-session/gsm-manager.h b/gnome-session/gsm-manager.h
index 342a76d..0cd2ef7 100644
--- a/gnome-session/gsm-manager.h
+++ b/gnome-session/gsm-manager.h
@@ -192,6 +192,9 @@ gboolean            gsm_manager_is_autostart_condition_handled (GsmManager     *
                                                                 GError        **error);
 gboolean            gsm_manager_set_phase                      (GsmManager     *manager,
                                                                 GsmManagerPhase phase);
+gboolean            gsm_manager_is_session_running             (GsmManager     *manager,
+                                                                gboolean       *running,
+                                                                GError        **error);
 
 G_END_DECLS
 
diff --git a/gnome-session/org.gnome.SessionManager.xml b/gnome-session/org.gnome.SessionManager.xml
index b8bec4e..eaf1ef5 100644
--- a/gnome-session/org.gnome.SessionManager.xml
+++ b/gnome-session/org.gnome.SessionManager.xml
@@ -301,6 +301,21 @@
       </doc:doc>
     </method>
 
+    <method name="IsSessionRunning">
+      <arg name="running" direction="out" type="b">
+        <doc:doc>
+          <doc:summary>True if the session has entered the Running phase, false otherwise</doc:summary>
+        </doc:doc>
+      </arg>
+      <doc:doc>
+        <doc:description>
+          <doc:para>Allows the caller to determine whether the session manager
+          has entered the Running phase, in case the client missed the
+          SessionRunning signal.</doc:para>
+        </doc:description>
+      </doc:doc>
+    </method>
+
     <!-- Signals -->
 
     <signal name="ClientAdded">



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