After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 671858 - port user panel to use libaccountservice
port user panel to use libaccountservice
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: User Accounts
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
: 688953 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-03-12 00:29 UTC by Jan Alexander Steffens (heftig)
Modified: 2013-01-03 16:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.25 KB, patch)
2012-03-12 00:29 UTC, Jan Alexander Steffens (heftig)
reviewed Details | Review
wip: new API for g-c-c port (11.68 KB, patch)
2012-11-15 15:01 UTC, Allison Karlitskaya (desrt)
committed Details | Review
wip: port user panel to libaccountservice (129.50 KB, patch)
2012-11-15 15:01 UTC, Allison Karlitskaya (desrt)
none Details | Review
tested patch (130.06 KB, patch)
2012-11-19 03:36 UTC, Matthias Clasen
none Details | Review
require a new enough accountsservice (1.06 KB, patch)
2012-11-19 03:39 UTC, Matthias Clasen
none Details | Review
updated patch (131.59 KB, patch)
2012-12-05 16:12 UTC, Allison Karlitskaya (desrt)
needs-work Details | Review
a log (12.45 KB, application/octet-stream)
2012-12-07 11:35 UTC, Matthias Clasen
  Details
remove queued user requests (3.53 KB, patch)
2012-12-08 01:50 UTC, Matthias Clasen
none Details | Review
user-accounts: port to libaccountsservice (197.89 KB, patch)
2012-12-21 21:06 UTC, Ray Strode [halfline]
none Details | Review
user-accounts: port to libaccountsservice (197.40 KB, patch)
2013-01-03 03:02 UTC, Ray Strode [halfline]
needs-work Details | Review
user-accounts: port to libaccountsservice (197.91 KB, patch)
2013-01-03 15:07 UTC, Ray Strode [halfline]
needs-work Details | Review
user-accounts: port to libaccountsservice (132.15 KB, patch)
2013-01-03 15:40 UTC, Ray Strode [halfline]
reviewed Details | Review
user-accounts: port to libaccountsservice (198.02 KB, patch)
2013-01-03 16:38 UTC, Ray Strode [halfline]
committed Details | Review
user-panel: add UmPasswordDialogMode enum instead of using numeric literals (3.92 KB, patch)
2013-01-03 16:38 UTC, Ray Strode [halfline]
committed Details | Review

Description Jan Alexander Steffens (heftig) 2012-03-12 00:29:24 UTC
Created attachment 209458 [details] [review]
patch

Be nice to distributions where systemd is optional. This will select
the code path at runtime depending on whether the system was booted
using systemd.
Comment 1 Bastien Nocera 2012-03-14 11:38:44 UTC
See the comments in bug 671861
Comment 2 Bastien Nocera 2012-11-10 15:11:41 UTC
Should use the API in bug 687821 instead.
Comment 3 Allison Karlitskaya (desrt) 2012-11-14 17:08:29 UTC
It seems like the API in bug 687821 won't work here.  That API is for determining if we're in the active session whereas the code here is trying to discover if another user has an active session...
Comment 4 Colin Walters 2012-11-14 17:16:36 UTC
This patch would need to be rebased on top of master, in combination with reverting f6cc4a970a98f82a2eb1c70515648869bc8bdb90 .
Comment 5 Colin Walters 2012-11-14 17:21:37 UTC
Review of attachment 209458 [details] [review]:

::: panels/user-accounts/um-user.c
@@ +1023,3 @@
         GVariant *result;
         GVariantIter *iter;
         gint n_sessions;

Minor: these declarations should be moved up to the top of the block; the rest of the code is C89, so let's not add C99 here.
Comment 6 Allison Karlitskaya (desrt) 2012-11-15 15:01:18 UTC
I think a better way to solve this problem is to toss out the home-grown copy (or sibling) of libaccountservice we have in g-c-c and use the real deal directly.

I'm attaching a patch to libaccountservice to add some API that we need and then a patch for g-c-c that uses that API.  Both are very much WIP.
Comment 7 Allison Karlitskaya (desrt) 2012-11-15 15:01:29 UTC
Created attachment 229058 [details] [review]
wip: new API for g-c-c port
Comment 8 Allison Karlitskaya (desrt) 2012-11-15 15:01:40 UTC
Created attachment 229059 [details] [review]
wip: port user panel to libaccountservice
Comment 9 Matthias Clasen 2012-11-18 18:17:15 UTC
Review of attachment 229058 [details] [review]:

Looks good to me - do you have commit access on f.d.o ?
Comment 10 Matthias Clasen 2012-11-18 19:39:51 UTC
I've pushed the accountsservice patch to http://cgit.freedesktop.org/accountsservice/log/?h=async-api
It would be great if somebody could double-check that I didn't mess up the backport from GTask to GSimpleAsyncResult - I don't want to depend on unstable glib api in accountsservice
Comment 11 Matthias Clasen 2012-11-18 23:57:30 UTC
Comment on attachment 229058 [details] [review]
wip: new API for g-c-c port

libaccountsservice api included in 0.6.27
Comment 12 Matthias Clasen 2012-11-19 03:36:55 UTC
Created attachment 229330 [details] [review]
tested patch

Here is another iteration of Ryans patch, which has been tested to work with accountsservice 0.6.28
Comment 13 Matthias Clasen 2012-11-19 03:39:33 UTC
Created attachment 229331 [details] [review]
require a new enough accountsservice
Comment 14 Bastien Nocera 2012-11-23 22:49:31 UTC
*** Bug 688953 has been marked as a duplicate of this bug. ***
Comment 15 Allison Karlitskaya (desrt) 2012-12-05 16:12:12 UTC
Created attachment 230782 [details] [review]
updated patch

a few changes to master have broken the old patch.  here's a rebased one.

it depends on a non-existent act_user_manager_get_user_by_id() though... this is required by the recent last-login-time work...

it may be possible to work around that.
Comment 16 Matthias Clasen 2012-12-06 04:16:31 UTC
The patch looks good to me - without trying it. Did you have a patch for get_user_by_id ?
Comment 17 Allison Karlitskaya (desrt) 2012-12-06 07:27:49 UTC
no...

The patch still has the commented-out error checking code from before.  Probably it should be removed.
Comment 18 Matthias Clasen 2012-12-07 05:06:12 UTC
I've written and committed act_user_manager_get_user_by_id now, and I'm afraid to say this patch doesn't currently work - it breaks changing the selected user. The control-center just freezes when I click on another user
Comment 19 Matthias Clasen 2012-12-07 05:06:39 UTC
Review of attachment 230782 [details] [review]:

needs work
Comment 20 Matthias Clasen 2012-12-07 11:35:48 UTC
Created attachment 230963 [details]
a log
Comment 21 Matthias Clasen 2012-12-08 01:49:24 UTC
Mmh, I spent some time on this, but the libaccountsservice startup code is a mess of async requests.

I've found one issue so far: We don't remove queued fetch user requests when the user is loaded before the service is marked as loaded. This later causes us to remove_user/add_user the user, which confuses the user panel, since it moves the selection when the user is removed, and then doesn't know to move it back when the user is re-added.

I have a patch which fixes this, but now I don't get the green bullet on my own user anymore, because the library loads sessions too early, and fails to associate them with the not-yet-loaded user.

More debugging needed. But not by me, tonight.
Comment 22 Matthias Clasen 2012-12-08 01:50:11 UTC
Created attachment 231017 [details] [review]
remove queued user requests
Comment 23 Ray Strode [halfline] 2012-12-10 18:09:24 UTC
Hey,

(In reply to comment #18)
> I've written and committed act_user_manager_get_user_by_id now

I had a look at that:

http://cgit.freedesktop.org/accountsservice/commit/?id=729a2feb54dbbaeea051f36ff81093dc682202f3

I don't think it's quite right, since it never calls FindUserById, it will only work if the user is already cached by the daemon and has an associated object path.

I'm going to try the stuff mentioned in this bug, too, and will report back.
Comment 25 Ray Strode [halfline] 2012-12-12 17:34:58 UTC
Review of attachment 230782 [details] [review]:

one thing first:

::: panels/user-accounts/um-user-panel.c
@@ +924,3 @@
         g_debug ("Got %d users\n", g_slist_length (list));
 
         g_signal_connect (d->um, "user-changed", G_CALLBACK (user_changed), d);

Also need to connect to "user-is-logged-in-changed"
Comment 26 Ray Strode [halfline] 2012-12-12 17:47:42 UTC
Comment on attachment 231017 [details] [review]
remove queued user requests

(this is fixed a different way now)
Comment 27 Bastien Nocera 2012-12-18 17:06:55 UTC
Is there anything left to be done on the accounts service side? Will we get an updated patch here?
Comment 28 Ray Strode [halfline] 2012-12-18 17:11:56 UTC
Yea i plan to update the patch here. i had to put it down for a couple of days but will get back to it soon.
Comment 29 Ray Strode [halfline] 2012-12-21 21:06:13 UTC
Created attachment 232092 [details] [review]
user-accounts: port to libaccountsservice

This removes a bunch of duplicated code, and also drops
a direct dependency on libsystemd-login.
Comment 30 Matthias Clasen 2012-12-27 03:37:38 UTC
Ok, I had some trouble getting this patch to apply to master. After forcing it, it turned out that the accountsservice code in 0.6.30 is even more confused than before :-(

If I create a new account, it does not get added to the list anymore. This seems to be because ActUserManager::user-added is never emitted due to confusion in various overlapping state machines.

I see two calls to act-user-manager.c:create_new_user. The first is coming from
on_new_user_in_accounts_service; the second coming from act_user_manager_create_user_finish. The two are probably stepping on each others toes and prevent ActUser::is-loaded from ever being set.
Comment 31 Ray Strode [halfline] 2013-01-03 03:02:59 UTC
Created attachment 232602 [details] [review]
user-accounts: port to libaccountsservice

This removes a bunch of duplicated code, and also drops
a direct dependency on libsystemd-login.

Updated for latest control-center
Comment 32 Ray Strode [halfline] 2013-01-03 03:09:55 UTC
I've ported it to the latest control-center master above. I'm not hitting the problems you're talking about though.  I'll grab you tomorrow and see what's going on.

To be sure, you killed the old accountsservice after upgrading?

It is possible to have more than one ActUser object with the same object path in play at once.
Comment 33 Matthias Clasen 2013-01-03 11:34:20 UTC
patch doesn't apply here
Comment 34 Bastien Nocera 2013-01-03 13:44:55 UTC
(In reply to comment #32)
> I've ported it to the latest control-center master above. I'm not hitting the
> problems you're talking about though.  I'll grab you tomorrow and see what's
> going on.
> 
> To be sure, you killed the old accountsservice after upgrading?

We need to make sure that it fails gracefully with older versions of accountsservice.
Comment 35 Bastien Nocera 2013-01-03 13:45:25 UTC
Comment on attachment 232602 [details] [review]
user-accounts: port to libaccountsservice

Marking as needs-work as it doesn't apply.
Comment 36 Ray Strode [halfline] 2013-01-03 15:07:17 UTC
odd, attachment 232602 [details] [review] isn't what's in my local branch. I must have had some sort of git branching snafu
Comment 37 Ray Strode [halfline] 2013-01-03 15:07:36 UTC
Created attachment 232643 [details] [review]
user-accounts: port to libaccountsservice

This removes a bunch of duplicated code, and also drops
a direct dependency on libsystemd-login.
Comment 38 Bastien Nocera 2013-01-03 15:27:56 UTC
Comment on attachment 232643 [details] [review]
user-accounts: port to libaccountsservice

Still doesn't apply to master.
Comment 39 Ray Strode [halfline] 2013-01-03 15:39:27 UTC
weird, i'll just attach it manually instead of using git bz
Comment 40 Ray Strode [halfline] 2013-01-03 15:40:21 UTC
Created attachment 232646 [details] [review]
user-accounts: port to libaccountsservice

This removes a bunch of duplicated code, and also drops
a direct dependency on libsystemd-login.
Comment 41 Bastien Nocera 2013-01-03 15:54:59 UTC
Review of attachment 232646 [details] [review]:

Rest looks fine, and seems to work in my limited testing (adding/removing users, and the likes).

::: panels/user-accounts/um-password-dialog.c
@@ +199,3 @@
 
+        switch (mode) {
+                case 0: /* normal set */

This needs to use symbolic names from an enum, not magic numbers.
Aren't those defined in the accounts service library?

::: panels/user-accounts/um-user-panel.c
@@ +353,3 @@
+        if (!act_user_manager_delete_user_finish (manager, res, &error)) {
+#if 0
+  this needs an accountsservice release > 0.6.28

Given that we require accountsservice 0.6.30...

::: panels/user-accounts/um-utils.c
@@ +811,3 @@
+        }
+
+        /* Size is kosher? */

s/kosher/sane/

@@ +985,3 @@
+        GError *error;
+
+        path = g_build_filename (g_get_tmp_dir (), "usericonXXXXXX", NULL);

can you please use gnome-control-center in the pattern as well?
Comment 42 Ray Strode [halfline] 2013-01-03 16:37:52 UTC
(In reply to comment #41)
> Review of attachment 232646 [details] [review]:
> 
> Rest looks fine, and seems to work in my limited testing (adding/removing
> users, and the likes).
> 
> ::: panels/user-accounts/um-password-dialog.c
> @@ +199,3 @@
> 
> +        switch (mode) {
> +                case 0: /* normal set */
> 
> This needs to use symbolic names from an enum, not magic numbers.
> Aren't those defined in the accounts service library?
This is an orthogonal issue, but you're right, that would be a lot cleaner. This mode thing is a um-password-dialog specific construct, that merges various states of the act-user into one enum.

> ::: panels/user-accounts/um-user-panel.c
> @@ +353,3 @@
> +        if (!act_user_manager_delete_user_finish (manager, res, &error)) {
> +#if 0
> +  this needs an accountsservice release > 0.6.28
> 
> Given that we require accountsservice 0.6.30...
yup. That code was what prompted me to edit configure.ac. I guess I neglected to clean this up after making that change

> ::: panels/user-accounts/um-utils.c
> @@ +811,3 @@
> +        }
> +
> +        /* Size is kosher? */
> 
> s/kosher/sane/
sure.

> @@ +985,3 @@
> +        GError *error;
> +
> +        path = g_build_filename (g_get_tmp_dir (), "usericonXXXXXX", NULL);
> 
> can you please use gnome-control-center in the pattern as well?
sounds good.

Will push with above changes.
Comment 43 Ray Strode [halfline] 2013-01-03 16:38:38 UTC
The following fixes have been pushed:
9deb4d6 user-accounts: port to libaccountsservice
db97299 user-panel: add UmPasswordDialogMode enum instead of using numeric literals
Comment 44 Ray Strode [halfline] 2013-01-03 16:38:41 UTC
Created attachment 232650 [details] [review]
user-accounts: port to libaccountsservice

This removes a bunch of duplicated code, and also drops
a direct dependency on libsystemd-login.
Comment 45 Ray Strode [halfline] 2013-01-03 16:38:44 UTC
Created attachment 232651 [details] [review]
user-panel: add UmPasswordDialogMode enum instead of using numeric literals

The um-password-dialog combobox has a column in its model associated
with what password action to apply. Possible actions are:

- Normal password
- Set password at next login
- No password needed
- Lock account
- Unlock account

These actions are currently represented in the code with harded coded
numeric values (0-4).

This commit cleans up the hard coding to use a symbolic enumeration
instead.