[gnome-initial-setup: 6/20] gis-driver: Add a parental-controls-enabled property
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup: 6/20] gis-driver: Add a parental-controls-enabled property
- Date: Fri, 14 Feb 2020 16:49:13 +0000 (UTC)
commit 18e88538a8a0c34bca3457ab1cf9e48226bd2353
Author: Philip Withnall <withnall endlessm com>
Date: Thu Feb 6 12:58:26 2020 +0000
gis-driver: Add a parental-controls-enabled property
This will be used by upcoming commits to communicate state from one page
to another about whether parental controls should be enabled for this
system.
The overall plan is that, if parental controls are enabled, two users
will be created: one child (standard user) and one parent
(administrator). Parental controls will be configured on the child user.
Signed-off-by: Philip Withnall <withnall endlessm com>
gnome-initial-setup/gis-driver.c | 69 +++++++++++++++++++++++++++++++++++++++-
gnome-initial-setup/gis-driver.h | 5 +++
2 files changed, 73 insertions(+), 1 deletion(-)
---
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index b3f6606..15dc26b 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -61,9 +61,10 @@ typedef enum {
PROP_MODE = 1,
PROP_USERNAME,
PROP_SMALL_SCREEN,
+ PROP_PARENTAL_CONTROLS_ENABLED,
} GisDriverProperty;
-static GParamSpec *obj_props[PROP_SMALL_SCREEN + 1];
+static GParamSpec *obj_props[PROP_PARENTAL_CONTROLS_ENABLED + 1];
struct _GisDriverPrivate {
GtkWindow *main_window;
@@ -76,6 +77,8 @@ struct _GisDriverPrivate {
ActUser *user_account;
gchar *user_password;
+ gboolean parental_controls_enabled;
+
gchar *lang_id;
gchar *username;
@@ -273,6 +276,47 @@ gis_driver_get_account_mode (GisDriver *driver)
return priv->account_mode;
}
+/**
+ * gis_driver_set_parental_controls_enabled:
+ * @driver: a #GisDriver
+ * @parental_controls_enabled: whether parental controls are enabled for the main user
+ *
+ * Set the #GisDriver:parental-controls-enabled property.
+ *
+ * Since: 3.36
+ */
+void
+gis_driver_set_parental_controls_enabled (GisDriver *driver,
+ gboolean parental_controls_enabled)
+{
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
+
+ if (priv->parental_controls_enabled == parental_controls_enabled)
+ return;
+
+ priv->parental_controls_enabled = parental_controls_enabled;
+ rebuild_pages (driver);
+
+ g_object_notify_by_pspec (G_OBJECT (driver), obj_props[PROP_PARENTAL_CONTROLS_ENABLED]);
+}
+
+/**
+ * gis_driver_get_parental_controls_enabled:
+ * @driver: a #GisDriver
+ *
+ * Get the #GisDriver:parental-controls-enabled property.
+ *
+ * Returns: whether parental controls are enabled for the main user
+ * Since: 3.36
+ */
+gboolean
+gis_driver_get_parental_controls_enabled (GisDriver *driver)
+{
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
+
+ return priv->parental_controls_enabled;
+}
+
gboolean
gis_driver_get_gdm_objects (GisDriver *driver,
GdmGreeter **greeter,
@@ -441,6 +485,9 @@ gis_driver_get_property (GObject *object,
case PROP_SMALL_SCREEN:
g_value_set_boolean (value, priv->small_screen);
break;
+ case PROP_PARENTAL_CONTROLS_ENABLED:
+ g_value_set_boolean (value, priv->parental_controls_enabled);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -464,6 +511,9 @@ gis_driver_set_property (GObject *object,
g_free (priv->username);
priv->username = g_value_dup_string (value);
break;
+ case PROP_PARENTAL_CONTROLS_ENABLED:
+ gis_driver_set_parental_controls_enabled (driver, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -732,6 +782,23 @@ gis_driver_class_init (GisDriverClass *klass)
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ /**
+ * GisDriver:parental-controls-enabled:
+ *
+ * Whether parental controls are enabled for the main user. If this is %TRUE,
+ * two user accounts will be created when this page is saved: one for the main
+ * user (a child) which will be a standard account; and one for the parent
+ * which will be an administrative account.
+ *
+ * Since: 3.36
+ */
+ obj_props[PROP_PARENTAL_CONTROLS_ENABLED] =
+ g_param_spec_boolean ("parental-controls-enabled",
+ "Parental Controls Enabled",
+ "Whether parental controls are enabled for the main user.",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
+
g_object_class_install_properties (gobject_class, G_N_ELEMENTS (obj_props), obj_props);
}
diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h
index cd49ffd..da7605d 100644
--- a/gnome-initial-setup/gis-driver.h
+++ b/gnome-initial-setup/gis-driver.h
@@ -80,6 +80,11 @@ void gis_driver_set_account_mode (GisDriver *driver,
UmAccountMode gis_driver_get_account_mode (GisDriver *driver);
+void gis_driver_set_parental_controls_enabled (GisDriver *driver,
+ gboolean parental_controls_enabled);
+
+gboolean gis_driver_get_parental_controls_enabled (GisDriver *driver);
+
void gis_driver_set_user_language (GisDriver *driver,
const gchar *lang_id,
gboolean update_locale);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]