[gnome-control-center] screen: honor disable-lock-screen setting



commit 509da80abdac1463f3caa176da38309ffd74dcf2
Author: William Jon McCann <jmccann redhat com>
Date:   Sun Mar 20 19:20:56 2011 -0400

    screen: honor disable-lock-screen setting

 panels/screen/cc-screen-panel.c |   35 +++++++++++++++++++++++++++++++++++
 panels/screen/screen.ui         |    2 +-
 2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/panels/screen/cc-screen-panel.c b/panels/screen/cc-screen-panel.c
index 35c9aba..5463d6c 100644
--- a/panels/screen/cc-screen-panel.c
+++ b/panels/screen/cc-screen-panel.c
@@ -33,6 +33,7 @@ struct _CcScreenPanelPrivate
   GSettings     *lock_settings;
   GSettings     *gsd_settings;
   GSettings     *session_settings;
+  GSettings     *lockdown_settings;
   GCancellable  *cancellable;
   GtkBuilder    *builder;
   GDBusProxy    *proxy;
@@ -86,6 +87,11 @@ cc_screen_panel_dispose (GObject *object)
       g_object_unref (priv->session_settings);
       priv->session_settings = NULL;
     }
+  if (priv->lockdown_settings)
+    {
+      g_object_unref (priv->lockdown_settings);
+      priv->lockdown_settings = NULL;
+    }
   if (priv->cancellable != NULL)
     {
       g_object_unref (priv->cancellable);
@@ -123,6 +129,28 @@ on_lock_settings_changed (GSettings     *settings,
 }
 
 static void
+update_lock_screen_sensitivity (CcScreenPanel *self)
+{
+  GtkWidget *widget;
+  gboolean   locked;
+
+  widget = WID ("screen_lock_main_box");
+  locked = g_settings_get_boolean (self->priv->lockdown_settings, "disable-lock-screen");
+  gtk_widget_set_sensitive (widget, !locked);
+}
+
+static void
+on_lockdown_settings_changed (GSettings     *settings,
+                              const char    *key,
+                              CcScreenPanel *panel)
+{
+  if (g_str_equal (key, "disable-lock-screen") == FALSE)
+    return;
+
+  update_lock_screen_sensitivity (panel);
+}
+
+static void
 cc_screen_panel_class_init (CcScreenPanelClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -457,6 +485,11 @@ cc_screen_panel_init (CcScreenPanel *self)
                     self);
   self->priv->gsd_settings = g_settings_new ("org.gnome.settings-daemon.plugins.power");
   self->priv->session_settings = g_settings_new ("org.gnome.desktop.session");
+  self->priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
+  g_signal_connect (self->priv->lockdown_settings,
+                    "changed",
+                    G_CALLBACK (on_lockdown_settings_changed),
+                    self);
 
   /* bind the auto dim checkbox */
   widget = WID ("screen_auto_reduce_checkbutton");
@@ -492,6 +525,8 @@ cc_screen_panel_init (CcScreenPanel *self)
                    widget, "sensitive",
                    G_SETTINGS_BIND_GET);
 
+  update_lock_screen_sensitivity (self);
+
   widget = WID ("screen_vbox");
   gtk_widget_reparent (widget, (GtkWidget *) self);
 }
diff --git a/panels/screen/screen.ui b/panels/screen/screen.ui
index 6ac9a64..d1bd77b 100644
--- a/panels/screen/screen.ui
+++ b/panels/screen/screen.ui
@@ -202,7 +202,7 @@
                     <property name="top_padding">6</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <object class="GtkVBox" id="vbox5">
+                      <object class="GtkVBox" id="screen_lock_main_box">
                         <property name="visible">True</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">6</property>



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