[nanny: 10/15] And Unlock policykit bases to AdminConsole



commit 6dcf6ef269bbc7f14d88d1fc6b04b4dcf04e9500
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Sat Mar 13 22:03:57 2010 +0100

    And Unlock policykit bases to AdminConsole

 client/gnome/admin/src/AdminConsole.py |   38 ++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/client/gnome/admin/src/AdminConsole.py b/client/gnome/admin/src/AdminConsole.py
index 6716d42..685e953 100644
--- a/client/gnome/admin/src/AdminConsole.py
+++ b/client/gnome/admin/src/AdminConsole.py
@@ -24,6 +24,7 @@
 # USA
 
 import os
+import dbus
 
 import gtk
 import pango
@@ -56,6 +57,7 @@ class AdminConsole:
         self.help_button.connect ('clicked', self.__on_help_button_clicked)
         self.close_button.connect ('clicked', self.__on_close_button_clicked)
         self.apply_button.connect ('clicked', self.__on_apply_button_clicked)
+        self.unlock_button.connect('clicked', self.__on_unlock_button_clicked)
 
         self.session_hoursday_checkbutton.connect ('toggled', self.__on_session_hoursday_checkbutton_toggled)
         self.session_hoursday_spinbutton.connect ('value-changed', self.__on_session_hoursday_spinbutton_changed)
@@ -68,6 +70,8 @@ class AdminConsole:
         self.im_hoursday_checkbutton.connect ('toggled', self.__on_im_hoursday_checkbutton_toggled)
         self.im_hoursday_spinbutton.connect ('value-changed', self.__on_im_hoursday_spinbutton_changed)
 
+        
+
         self.session_schedule_widget = nanny.client.gnome.admin.ScheduleCalendar()
         self.session_schedule_alignment.add (self.session_schedule_widget)
         self.session_schedule_alignment.show_all()
@@ -99,6 +103,33 @@ class AdminConsole:
         self.window.set_position (gtk.WIN_POS_CENTER)
         self.window.show_all ()
 
+        self.__lock_widgets()
+
+    def __lock_widgets(self) :
+        lock_status = self.dbus_client.is_unlocked()
+        if lock_status == True :
+            self.unlock_area.hide()
+        else:
+            self.unlock_area.show()
+
+        self.apply_button.set_sensitive(lock_status)
+
+        self.session_hoursday_checkbutton.set_sensitive(lock_status)
+        self.session_hoursday_spinbutton.set_sensitive(lock_status)
+        self.browser_configure_proxy_button.set_sensitive(lock_status)
+        self.browser_use_proxy_checkbutton.set_sensitive(lock_status)
+        self.browser_hoursday_checkbutton.set_sensitive(lock_status)
+        self.browser_hoursday_spinbutton.set_sensitive(lock_status)
+        self.mail_hoursday_checkbutton.set_sensitive(lock_status)
+        self.mail_hoursday_spinbutton.set_sensitive(lock_status)
+        self.im_hoursday_checkbutton.set_sensitive(lock_status)
+        self.im_hoursday_spinbutton.set_sensitive(lock_status)
+
+        self.session_schedule_widget.set_sensitive(lock_status)
+        self.browser_schedule_widget.set_sensitive(lock_status)
+        self.mail_schedule_widget.set_sensitive(lock_status)
+        self.im_schedule_widget.set_sensitive(lock_status)
+
     def __create_users_treeview (self):
         # UID
         col = gtk.TreeViewColumn ('uid')
@@ -311,6 +342,8 @@ class AdminConsole:
             self.__selected_user_id = None
             self.window.set_title (_('Nanny Admin Console'))
 
+        self.__lock_widgets()
+
     def __on_session_hoursday_spinbutton_changed (self, widget, data=None):
         self.__config_changed = True
     def __on_session_hoursday_checkbutton_toggled (self, widget, data=None):
@@ -353,6 +386,11 @@ class AdminConsole:
         except:
             os.system("yelp ghelp:nanny")
 
+
+    def __on_unlock_button_clicked (self, widget, data=None):
+        self.dbus_client.unlock()
+        self.__lock_widgets()
+
     def __on_close_button_clicked (self, widget, data=None):
         gtk.main_quit()
 



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