[sabayon] Move to using add_objects_from_file, add pygtk-2.0 requirement to the configure.ac file



commit e706041a9ee3133cd87f2dc1fe61d1b3756b0305
Author: Scott Balneaves <sbalneav ltsp org>
Date:   Wed Dec 16 23:00:26 2009 -0600

    Move to using add_objects_from_file, add pygtk-2.0 requirement to the configure.ac file

 admin-tool/groupsdialog.py   |    9 +++++----
 admin-tool/profilesdialog.py |   21 ++++++++++++++++-----
 admin-tool/usersdialog.py    |   13 +++++++------
 configure.ac                 |   19 +++++++++++++++----
 4 files changed, 43 insertions(+), 19 deletions(-)
---
diff --git a/admin-tool/groupsdialog.py b/admin-tool/groupsdialog.py
index 24dd571..df0f2cd 100644
--- a/admin-tool/groupsdialog.py
+++ b/admin-tool/groupsdialog.py
@@ -45,10 +45,14 @@ class GroupsDialog:
     def __init__ (self, profile, parent):
         self.profile = profile
         self.groupdb = systemdb.get_group_database ()
+        self.ui_objects_list = [ "groups_dialog",
+                                 "groups_close_button",
+                                 "groups_list_scroll",
+                                 "groups_list" ]
 
         self.builder = gtk.Builder()
         self.builder.set_translation_domain(PACKAGE)
-        self.builder.add_from_file(os.path.join (BUILDERDIR, "sabayon.ui"))
+        self.builder.add_objects_from_file(os.path.join (BUILDERDIR, "sabayon.ui"), self.ui_objects_list)
 
         self.dialog = self.builder.get_object ("groups_dialog")
         self.dialog.set_transient_for (parent)
@@ -58,9 +62,6 @@ class GroupsDialog:
 
         self.close_button = self.builder.get_object ("groups_close_button")
 
-        self.help_button = self.builder.get_object ("groups_help_button")
-        self.help_button.hide ()
-
         self.groups_model = GroupsModel (self.groupdb, self.profile)
         
         self.groups_list_scroll = self.builder.get_object ("groups_list_scroll")
diff --git a/admin-tool/profilesdialog.py b/admin-tool/profilesdialog.py
index 991c8a3..db56231 100755
--- a/admin-tool/profilesdialog.py
+++ b/admin-tool/profilesdialog.py
@@ -268,10 +268,14 @@ class ProfilesModel (gtk.ListStore):
 class AddProfileDialog:
     def __init__ (self, profiles_model):
         self.profiles_model = profiles_model
+        self.ui_objects_list = [ "add_profile_dialog",
+                                 "add_profile_add_button",
+                                 "add_profile_name_entry",
+                                 "add_profile_base_combo" ]
 
         self.builder = gtk.Builder ();
         self.builder.set_translation_domain (PACKAGE)
-        self.builder.add_from_file (os.path.join (BUILDERDIR, "sabayon.ui"))
+        self.builder.add_objects_from_file (os.path.join (BUILDERDIR, "sabayon.ui"), self.ui_objects_list)
          
         self.dialog = self.builder.get_object ("add_profile_dialog")
         self.dialog.connect ("destroy", gtk.main_quit)
@@ -323,10 +327,20 @@ class AddProfileDialog:
 class ProfilesDialog:
     def __init__ (self):
         assert os.geteuid () == 0
+        self.ui_objects_list = [ "profiles_dialog",
+                                 "profiles_list",
+                                 "add_button",
+                                 "remove_button",
+                                 "edit_button",
+                                 "details_button",
+                                 "users_button",
+                                 "groups_button" ]
+
+
 
         self.builder = gtk.Builder ();
         self.builder.set_translation_domain (PACKAGE)
-        self.builder.add_from_file (os.path.join (BUILDERDIR, "sabayon.ui"))
+        self.builder.add_objects_from_file (os.path.join (BUILDERDIR, "sabayon.ui"), self.ui_objects_list)
 
         self.dialog = self.builder.get_object ("profiles_dialog")
         self.dialog.connect ("destroy", gtk.main_quit)
@@ -360,9 +374,6 @@ class ProfilesDialog:
         self.__fix_button_align (self.groups_button)
         self.groups_button.connect ("clicked", self.__groups_button_clicked)
 
-        self.help_button = self.builder.get_object ("help_button")
-        self.help_button.hide()
-
         self.dialog.connect ("response", self.__dialog_response)
 
         (width, height) = self.profiles_list.size_request ()
diff --git a/admin-tool/usersdialog.py b/admin-tool/usersdialog.py
index fb3e306..0372862 100644
--- a/admin-tool/usersdialog.py
+++ b/admin-tool/usersdialog.py
@@ -53,12 +53,17 @@ class UsersDialog:
     def __init__ (self, profile, parent):
         self.profile = profile
         self.userdb = systemdb.get_user_database ()
+        self.ui_objects_list = [ "users_dialog",
+                                 "users_close_button",
+                                 "users_all_check",
+                                 "users_list_scroll",
+                                 "users_list" ]
 
         apply_to_all = self.userdb.get_default_profile (False) == profile
         
         self.builder = gtk.Builder()
         self.builder.set_translation_domain(PACKAGE)
-        self.builder.add_from_file(os.path.join (BUILDERDIR, "sabayon.ui"))
+        self.builder.add_objects_from_file(os.path.join (BUILDERDIR, "sabayon.ui"), self.ui_objects_list)
  
         self.dialog = self.builder.get_object ("users_dialog")
         self.dialog.set_transient_for (parent)
@@ -68,9 +73,6 @@ class UsersDialog:
 
         self.close_button = self.builder.get_object ("users_close_button")
 
-        self.help_button = self.builder.get_object ("users_help_button")
-        self.help_button.hide ()
-
         self.all_check = self.builder.get_object ("users_all_check")
         self.all_check.set_active (apply_to_all)
         self.all_check.connect ("toggled", self.__all_check_toggled)
@@ -85,11 +87,10 @@ class UsersDialog:
         c = gtk.TreeViewColumn (_("Name"),
                                 gtk.CellRendererText (),
                                 text = UsersModel.COLUMN_NAME)
-        c.set_sort_column_id(UsersModel.COLUMN_NAME)        
+        c.set_sort_column_id(UsersModel.COLUMN_NAME)
         self.users_list.append_column (c)
         self.users_model.set_sort_column_id(UsersModel.COLUMN_NAME, gtk.SORT_ASCENDING)
 
-
         toggle = gtk.CellRendererToggle ()
         toggle.connect ("toggled", self.__on_use_toggled)
         c = gtk.TreeViewColumn (_("Use This Profile"))
diff --git a/configure.ac b/configure.ac
index c584cb5..b9a935f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,15 +33,15 @@ AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR([Can't locate python headers])])
 # distros may not be aware that Sabayon *requires* xdg.DesktopEntry to run,
 # so we'll check for it at "compilation" time.
 AC_MSG_CHECKING(whether the xdg.DesktopEntry module for Python is available)
-if [ ! python -c "import xdg.DesktopEntry" ] 
+if [ ! python -c "import xdg.DesktopEntry" ]
 then
 	AC_MSG_FAILURE([Please install the python-xdg or pyxdg package.])
 else
 	AC_MSG_RESULT(yes)
 fi
 
-# Check for GDK/X11 and PyGObject
-PKG_CHECK_MODULES(XLIB_MODULE, gdk-x11-2.0 pygobject-2.0)
+# Check for GDK/X11, PyGObject, and pygtk
+PKG_CHECK_MODULES(XLIB_MODULE, gdk-x11-2.0 pygobject-2.0 pygtk-2.0)
 
 PYGOBJECT_REQUIRED_VERSION=2.15.0
 AC_MSG_CHECKING(for pygobject $PYGOBJECT_REQUIRED_VERSION or greater)
@@ -54,7 +54,18 @@ else
 *** always get the latest version from http://www.pygtk.org/
   ])
 fi
-  
+
+PYGTK_REQUIRED_VERSION=2.16.0
+AC_MSG_CHECKING(for pygtk $PYGTK_REQUIRED_VERSION or greater)
+if $PKG_CONFIG --atleast-version $PYGTK_REQUIRED_VERSION pygtk-2.0
+then
+  AC_MSG_RESULT(found)
+else
+  AC_MSG_ERROR([
+*** pygtk $PYGTK_REQUIRED_VERSION or greater is required.  You can
+*** always get the latest version from http://www.pygtk.org/
+  ])
+fi
 
 AC_SUBST(XLIB_MODULE_CFLAGS)
 AC_SUBST(XLIB_MODULE_LIBS)



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