Nowadays the way to go is to use dbus services to get/set information so that any other program or process that could be interested in that info can be informed of any changes to it. There is a dbus service org.freedesktop.Accounts that holds data for user Accounts (currently only local ones); like IconFile, home directory, real name, etc. Desktop tools like gnome-control-center use it to manage user account information. userdrake should use it too. Reproducible: Steps to Reproduce:
Created attachment 4058 [details] small patch to show dbus use attached is a small patch that adds displaying icon file defined in dbus, if any userdrake should still be improved to allow selecting a custom icon (the dbus system automatically convert it and place it at the right place, if needed; it just needs a pathname); and to use the dbus service for other account properties too. to test it: set a user icon trough a org.freedesktop.Accounts aware program (eg: gnome-control-center); then launch userdrake: you should see the right icon now.
Description of the dbus service: * service name: "org.freedesktop.Accounts" * manager path: "/org/freedesktop/Accounts" ** manager interface: "org.freedesktop.Accounts" ** interesting methods: CreateUser, DeleteUser, FindUserByName * path for a given user: "/org/freedesktop/Accounts/User${uid}" ** interface to set properties for a given user: "org.freedesktop.Accounts.User" *** some methods: SetIconFile, SetEmail, SetRealName,.... ** interface to read properties: "org.freedesktop.DBus.Properties *** read with Get("org.freedesktop.Accounts.User", property_name) you can explore it with d-feet for more info
Keywords: (none) => Junior_jobCC: (none) => thierry.vignaud
Created attachment 4126 [details] small patch to show dbus use this small and dirty patch to userdrake uses the dbus org.freedesktop.Accounts service to get/set the user icon. correction from previous patch: don't call service if no user name (it's the case when creating a new user and user name hasn't yet been provided). todo: * clicking on icon should not cycle in a closed list of icons but rather open a dialog to choose a file. * use dbus service for other account properties (but, with exception of "email" and "icon", others are already seen by the dbus service trough old mechanisms (gecos, etc); we just lack the instant notice on change provided by dbus what patch alredy does: * shows on userdrake the user icon already set by other user account tools (like gnome-control-center) * sets user icon trough dbus (but functionality limited due to drakuser interface not providing a file browser to choose image) * image conversion/scaling is done by the dbus service itself, no need to care
Attachment 4058 is obsolete: 0 => 1CC: (none) => pablo
Keywords: (none) => PATCH
CC: (none) => derekjenn
Created attachment 5892 [details] 1/2: GetFaceIcon() can be called w/o $user parameter split from previous patch so that it's easier to review
Created attachment 5893 [details] use the dbus org.freedesktop.Accounts service to get/set the user icon v2.0 (Thierry Vignaud): simplify ; use eval {} as DBus sometiles fail
Attachment 4126 is obsolete: 0 => 1
Assignee: bugsquad => mageiatools