[gnome-initial-setup] Add mechanism for autostarting gnome-initial-setup for first time login



commit ee4223ea5dd79c03da5ff4651c85e64ced0a3f90
Author: Michael Wood <michael g wood intel com>
Date:   Fri Mar 22 18:37:11 2013 +0000

    Add mechanism for autostarting gnome-initial-setup for first time login
    
    On login gnome-session will look for ~/.config/gnome-initial-setup-done
    if it exists g-i-s will not launch. At the end of a g-i-s this file is
    created either by the copy-worker (first boot) or by g-i-s it's self if
    in user mode.

 data/Makefile.am                                   |    3 +++
 data/gnome-initial-setup-first-login.desktop.in.in |   15 +++++++++++++++
 .../gnome-initial-setup-copy-worker.c              |    9 +++++++++
 .../pages/summary/gis-summary-page.c               |   19 +++++++++++++++++++
 4 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 2c724fc..313e799 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -35,6 +35,7 @@ EXTRA_DIST =                                          \
        gnome-welcome-tour                              \
        setup-shell.desktop                             \
        gnome-welcome-tour.desktop.in.in                \
+       gnome-initial-setup-first-login.desktop.in.in   \
        gnome-initial-setup.desktop.in.in               \
        gnome-initial-setup-copy-worker.desktop.in.in   \
        gnome-initial-setup.session                     \
@@ -46,6 +47,7 @@ CLEANFILES =                                          \
        gnome-initial-setup.desktop                     \
        gnome-initial-setup-copy-worker.desktop.in      \
        gnome-initial-setup-copy-worker.desktop         \
+       gnome-initial-setup-first-login.desktop         \
        gnome-welcome-tour.desktop.in                   \
        gnome-welcome-tour.desktop                      \
        $(NULL)
@@ -54,6 +56,7 @@ autostartdir = $(sysconfdir)/xdg/autostart
 autostart_DATA =                                       \
        gnome-welcome-tour.desktop                      \
        gnome-initial-setup-copy-worker.desktop         \
+       gnome-initial-setup-first-login.desktop         \
        $(NULL)
 
 libexec_SCRIPTS =                                              \
diff --git a/data/gnome-initial-setup-first-login.desktop.in.in 
b/data/gnome-initial-setup-first-login.desktop.in.in
new file mode 100644
index 0000000..0c0d55d
--- /dev/null
+++ b/data/gnome-initial-setup-first-login.desktop.in.in
@@ -0,0 +1,15 @@
+[Desktop Entry]
+_Name=Initial Setup
+Icon=preferences-system
+Exec= LIBEXECDIR@/gnome-initial-setup
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=GNOME;GTK;System;
+OnlyShowIn=GNOME;
+NoDisplay=true
+AutostartCondition=unless-exists gnome-initial-setup-done
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-initial-setup
+X-GNOME-Bugzilla-Component=general
+X-GNOME-Bugzilla-Version=unknown
diff --git a/gnome-initial-setup/gnome-initial-setup-copy-worker.c 
b/gnome-initial-setup/gnome-initial-setup-copy-worker.c
index 1863695..cb732d4 100644
--- a/gnome-initial-setup/gnome-initial-setup-copy-worker.c
+++ b/gnome-initial-setup/gnome-initial-setup-copy-worker.c
@@ -53,6 +53,7 @@ main (int    argc,
   GFile *dest;
   GError *error = NULL;
   char *initial_setup_homedir;
+  gchar *gis_done_file_path;
 
   g_type_init ();
 
@@ -75,6 +76,14 @@ main (int    argc,
   FILE (".config/goa-1.0/accounts.conf");
   FILE (".local/share/keyrings/login.keyring");
 
+  gis_done_file_path = g_build_filename (g_get_user_config_dir (),
+                                         "gnome-initial-setup-done",
+                                         NULL);
+
+  if (!g_file_set_contents (gis_done_file_path, "yes", -1, &error))
+    g_warning ("Unable to create %s", gis_done_file_path, error->message);
+
+
   if (!g_file_delete (src, NULL, &error))
     {
       g_warning ("Unable to delete skeleton dir: %s", error->message);
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c 
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 3ef3184..b3c1ee1 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -208,6 +208,24 @@ remove_trigger_file (GisSummaryPage *page)
 }
 
 static void
+add_setup_done_file (void)
+{
+  gchar *gis_done_path;
+  GError *error = NULL;
+
+  gis_done_path = g_build_filename (g_get_user_config_dir (),
+                                    "gnome-initial-setup-done",
+                                    NULL);
+
+  if (!g_file_set_contents (gis_done_path, "yes", -1, &error)) {
+      g_warning ("Unable to create %s", gis_done_path, error->message);
+      g_clear_error (&error);
+  }
+
+  g_free (gis_done_path);
+}
+
+static void
 done_cb (GtkButton *button, GisSummaryPage *page)
 {
   gchar *file;
@@ -224,6 +242,7 @@ done_cb (GtkButton *button, GisSummaryPage *page)
       remove_trigger_file (page);
       break;
     case GIS_DRIVER_MODE_EXISTING_USER:
+      add_setup_done_file ();
       g_application_quit (G_APPLICATION (GIS_PAGE (page)->driver));
     default:
       break;


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