[nanny/win32: 27/75] Add support for winxp user account files
- From: Roberto Majadas <telemaco src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nanny/win32: 27/75] Add support for winxp user account files
- Date: Tue, 2 Nov 2010 18:53:13 +0000 (UTC)
commit 6690f26c3ae53015e48a7e20c9f331636e80d3de
Author: Roberto Majadas <roberto majadas openshine com>
Date: Sat Sep 18 13:12:20 2010 +0200
Add support for winxp user account files
client/gnome/admin/src/AdminConsole.py | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/client/gnome/admin/src/AdminConsole.py b/client/gnome/admin/src/AdminConsole.py
index 6dce006..e920e62 100644
--- a/client/gnome/admin/src/AdminConsole.py
+++ b/client/gnome/admin/src/AdminConsole.py
@@ -24,7 +24,8 @@
# USA
import os
-import dbus
+if os.name == "posix":
+ import dbus
import gtk
import pango
@@ -180,13 +181,34 @@ class AdminConsole:
model = self.users_treeview.get_model ()
treeselection = self.users_treeview.get_selection()
for uid, name, user_name in self.dbus_client.list_users ():
- face_file = '/home/%s/.face' % name
+ print "uid: %s, name: %s, user_name: %s" % (uid, name, user_name)
+ if os.name == "posix" :
+ face_file = '/home/%s/.face' % name
+ elif os.name == "nt" :
+ import glob
+ all_users_path = os.environ["ALLUSERSPROFILE"]
+ face_file = None
+ for p in glob.glob(os.path.join(all_users_path, "*", "Microsoft", "User Account Pictures", "%s.bmp" % name)):
+ face_file = p
+ print face_file
+ break
+
+ if face_file == None:
+ face_file = "/fake/path"
+
if os.path.exists (face_file):
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(face_file, 50, 50)
else:
- icon_theme = gtk.IconTheme ()
- pixbuf = icon_theme.load_icon ('nobody', 50, gtk.ICON_LOOKUP_USE_BUILTIN)
- model.append ([uid, pixbuf, user_name])
+ if os.name == "posix" :
+ icon_theme = gtk.IconTheme ()
+ pixbuf = icon_theme.load_icon ('nobody', 50, gtk.ICON_LOOKUP_USE_BUILTIN)
+ elif os.name == "nt" :
+ pixbuf = None
+
+ if len(user_name) > 0 :
+ model.append ([uid, pixbuf, user_name])
+ else:
+ model.append ([uid, pixbuf, name])
treeselection.set_mode (gtk.SELECTION_SINGLE)
self.users_selection_change_cb_id = treeselection.connect ("changed", self.__on_users_treeview_selection_changed)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]