[gnome-initial-setup: 7/20] gis-driver: Add parent account storage in the driver
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup: 7/20] gis-driver: Add parent account storage in the driver
- Date: Fri, 14 Feb 2020 16:49:18 +0000 (UTC)
commit f02a2724456674ced2128c95135fb0d529bb93a8
Author: Philip Withnall <withnall endlessm com>
Date: Thu Feb 6 13:00:49 2020 +0000
gis-driver: Add parent account storage in the driver
This will allow details of the parent account to be forwarded from one
page to another, to allow correct configuration of the user accounts
when saving all the data.
Signed-off-by: Philip Withnall <withnall endlessm com>
gnome-initial-setup/gis-driver.c | 55 ++++++++++++++++++++++++++++++++++++++++
gnome-initial-setup/gis-driver.h | 8 ++++++
2 files changed, 63 insertions(+)
---
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 15dc26b..5909750 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -77,6 +77,9 @@ struct _GisDriverPrivate {
ActUser *user_account;
gchar *user_password;
+ ActUser *parent_account; /* (owned) (nullable) */
+ gchar *parent_password; /* (owned) (nullable) */
+
gboolean parental_controls_enabled;
gchar *lang_id;
@@ -120,6 +123,9 @@ gis_driver_finalize (GObject *object)
g_clear_object (&priv->user_account);
g_clear_pointer (&priv->vendor_conf_file, g_key_file_free);
+ g_clear_object (&priv->parent_account);
+ g_free (priv->parent_password);
+
if (priv->locale != (locale_t) 0)
{
uselocale (LC_GLOBAL_LOCALE);
@@ -261,6 +267,55 @@ gis_driver_get_user_permissions (GisDriver *driver,
*password = priv->user_password;
}
+/**
+ * gis_driver_set_parent_permissions:
+ * @driver: a #GisDriver
+ * @parent: (transfer none): user account for the parent
+ * @password: password for the parent
+ *
+ * Stores the parent account details for later use when saving the initial setup
+ * data.
+ *
+ * Since: 3.36
+ */
+void
+gis_driver_set_parent_permissions (GisDriver *driver,
+ ActUser *parent,
+ const gchar *password)
+{
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
+
+ g_set_object (&priv->parent_account, parent);
+ g_assert (priv->parent_password == NULL);
+ priv->parent_password = g_strdup (password);
+}
+
+/**
+ * gis_driver_get_parent_permissions:
+ * @driver: a #GisDriver
+ * @parent: (out) (transfer none) (optional) (nullable): return location for the
+ * user account for the parent, which may be %NULL
+ * @password: (out) (transfer none) (optional) (nullable): return location for
+ * the password for the parent
+ *
+ * Gets the parent account details saved from an earlier step in the initial
+ * setup process. They may be %NULL if not set yet.
+ *
+ * Since: 3.36
+ */
+void
+gis_driver_get_parent_permissions (GisDriver *driver,
+ ActUser **parent,
+ const gchar **password)
+{
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
+
+ if (parent != NULL)
+ *parent = priv->parent_account;
+ if (password != NULL)
+ *password = priv->parent_password;
+}
+
void
gis_driver_set_account_mode (GisDriver *driver,
UmAccountMode mode)
diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h
index da7605d..c0474ca 100644
--- a/gnome-initial-setup/gis-driver.h
+++ b/gnome-initial-setup/gis-driver.h
@@ -75,6 +75,14 @@ void gis_driver_get_user_permissions (GisDriver *driver,
ActUser **user,
const gchar **password);
+void gis_driver_set_parent_permissions (GisDriver *driver,
+ ActUser *parent,
+ const gchar *password);
+
+void gis_driver_get_parent_permissions (GisDriver *driver,
+ ActUser **parent,
+ const gchar **password);
+
void gis_driver_set_account_mode (GisDriver *driver,
UmAccountMode mode);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]