Bug 10310

Summary: userdrake should use dbus org.freedesktop.Accounts to get/set user account info
Product: Mageia Reporter: Pablo Saratxaga <pablo>
Component: RPM PackagesAssignee: Mageia tools maintainers <mageiatools>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Normal CC: derekjenn, pablo, thierry.vignaud
Version: CauldronKeywords: Junior_job, PATCH
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: userdrake-1.14-1.mga3.i586.rpm CVE:
Status comment:
Attachments: small patch to show dbus use
small patch to show dbus use
1/2: GetFaceIcon() can be called w/o $user parameter
use the dbus org.freedesktop.Accounts service to get/set the user icon

Description Pablo Saratxaga 2013-05-27 10:45:32 CEST
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:
Comment 1 Pablo Saratxaga 2013-05-27 10:52:16 CEST
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.
Comment 2 Pablo Saratxaga 2013-05-27 10:59:25 CEST
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
Manuel Hiebel 2013-05-27 23:44:08 CEST

Keywords: (none) => Junior_job
CC: (none) => thierry.vignaud

Comment 3 Pablo Saratxaga 2013-06-11 09:52:59 CEST
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 => 1
CC: (none) => pablo

Pablo Saratxaga 2013-06-11 09:53:39 CEST

Keywords: (none) => PATCH

Derek Jennings 2013-08-31 19:03:32 CEST

CC: (none) => derekjenn

Comment 4 Thierry Vignaud 2015-02-11 08:54:15 CET
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
Comment 5 Thierry Vignaud 2015-02-11 08:55:00 CET
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

Samuel Verschelde 2016-10-15 22:50:20 CEST

Assignee: bugsquad => mageiatools