[gdm/wip/initial-setup] Improve the request-initial-setup code



commit b3e4730198a093af341883d0bce1e51cbbc5d3c8
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 19 09:37:44 2011 -0400

    Improve the request-initial-setup code
    
    Move this out into separate functions, and also remove
    /etc/gdm/run-initial-setup after it has been ackknowledged.

 daemon/gdm-simple-slave.c |   38 ++++++++++++++++++++++++++++++++------
 1 files changed, 32 insertions(+), 6 deletions(-)
---
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index d54e7ef..e5fd8bd 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -104,11 +104,14 @@ static void     gdm_simple_slave_finalize       (GObject             *object);
 
 G_DEFINE_TYPE (GdmSimpleSlave, gdm_simple_slave, GDM_TYPE_SLAVE)
 
-static void create_new_session (GdmSimpleSlave *slave);
-static void destroy_session    (GdmSimpleSlave *slave);
-static void start_greeter      (GdmSimpleSlave *slave);
+static void create_new_session  (GdmSimpleSlave *slave);
+static void destroy_session     (GdmSimpleSlave *slave);
+static void start_greeter       (GdmSimpleSlave *slave);
 static void start_initial_setup (GdmSimpleSlave *slave);
 
+static gboolean check_initial_setup_request (GdmSimpleSlave *slave);
+static void     clear_initial_setup_request (GdmSimpleSlave *slave);
+
 static void
 on_session_started (GdmSession       *session,
                     int               pid,
@@ -1399,6 +1402,30 @@ start_initial_setup (GdmSimpleSlave *slave)
 }
 
 static gboolean
+check_initial_setup_request (GdmSimpleSlave *slave)
+{
+        const gchar *filename;
+
+        filename = GDMCONFDIR "/run-initial-setup";
+        if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+                return TRUE;
+        }
+
+        return FALSE;
+}
+
+static void
+clear_initial_setup_request (GdmSimpleSlave *slave)
+{
+        const gchar *filename;
+
+        filename = GDMCONFDIR "/run-initial-setup";
+        if (g_remove (filename) < 0) {
+                g_warning ("Failed to remove %s", filename);
+        }
+}
+
+static gboolean
 idle_connect_to_display (GdmSimpleSlave *slave)
 {
         gboolean res;
@@ -1420,14 +1447,13 @@ idle_connect_to_display (GdmSimpleSlave *slave)
                 initial_setup_enabled = FALSE;
                 initial_setup_requested = FALSE;
                 gdm_slave_get_initial_setup_details (GDM_SLAVE (slave), &initial_setup_enabled);
-                filename = GDMCONFDIR "/run-initial-setup";
-                if (g_file_test (filename, G_FILE_TEST_EXISTS))
-                        initial_setup_requested = TRUE;
+                initial_setup_requested = check_initial_setup_request (slave);
 
                 timed_login_delay = 0;
                 timed_login_enabled = FALSE;
                 gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &timed_login_enabled, NULL, &timed_login_delay);
                 if (initial_setup_enabled && initial_setup_requested) {
+                        clear_initial_setup_request (slave);
                         start_initial_setup (slave);
                         create_new_session (slave);
                 } else if (! timed_login_enabled || timed_login_delay > 0) {



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