[gnome-initial-setup/shell/4765: 20/362] main: skip initial setup entirely for shared account
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 20/362] main: skip initial setup entirely for shared account
- Date: Thu, 19 Mar 2015 01:22:44 +0000 (UTC)
commit 3af84460cdf61670e5291cc4a50e003743647ae7
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Fri Apr 18 14:21:43 2014 -0700
main: skip initial setup entirely for shared account
gnome-initial-setup/gnome-initial-setup.c | 31 ++++++++++++++++++--
gnome-initial-setup/gnome-initial-setup.h | 2 +
.../pages/summary/gis-summary-page.c | 20 +------------
3 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 0cb370a..db143c1 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -185,24 +185,42 @@ rebuild_pages_cb (GisDriver *driver)
}
static gboolean
-is_running_as_gnome_initial_setup_user (void)
+is_running_as_user (const gchar *username)
{
struct passwd pw, *pwp;
char buf[4096];
- getpwnam_r ("gnome-initial-setup", &pw, buf, sizeof (buf), &pwp);
+ getpwnam_r (username, &pw, buf, sizeof (buf), &pwp);
if (pwp == NULL)
return FALSE;
return pw.pw_uid == getuid ();
}
+void
+gis_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: %s", gis_done_path, error->message);
+ g_clear_error (&error);
+ }
+
+ g_free (gis_done_path);
+}
+
static GisDriverMode
get_mode (void)
{
if (force_new_user_mode)
return GIS_DRIVER_MODE_NEW_USER;
- else if (is_running_as_gnome_initial_setup_user ())
+ else if (is_running_as_user ("gnome-initial-setup"))
return GIS_DRIVER_MODE_NEW_USER;
else
return GIS_DRIVER_MODE_EXISTING_USER;
@@ -230,6 +248,13 @@ main (int argc, char *argv[])
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+ /* If initial-setup has been automatically launched and this is the Shared
+ Account user, just quit quietly */
+ if (is_running_as_user ("shared")) {
+ gis_add_setup_done_file ();
+ return EXIT_SUCCESS;
+ }
+
#ifdef HAVE_CHEESE
cheese_gtk_init (NULL, NULL);
#endif
diff --git a/gnome-initial-setup/gnome-initial-setup.h b/gnome-initial-setup/gnome-initial-setup.h
index a153b0d..c41a4a1 100644
--- a/gnome-initial-setup/gnome-initial-setup.h
+++ b/gnome-initial-setup/gnome-initial-setup.h
@@ -36,5 +36,7 @@ typedef struct _GisPage GisPage;
#include "gis-assistant.h"
#include "gis-page.h"
+void gis_add_setup_done_file (void);
+
#endif /* __GNOME_INITIAL_SETUP_H__ */
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index e4b16d4..7d7c211 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -220,24 +220,6 @@ log_user_in (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: %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;
@@ -253,7 +235,7 @@ done_cb (GtkButton *button, GisSummaryPage *page)
log_user_in (page);
break;
case GIS_DRIVER_MODE_EXISTING_USER:
- add_setup_done_file ();
+ gis_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]