Commit graph

714 commits

Author SHA1 Message Date
Bastien Nocera
51500e38a8 user-accounts: Add debug when launching malcontent-control 2021-09-05 21:55:06 +00:00
Bastien Nocera
3e26f594fc user-accounts: Avoid double password prompt
Don't require a password to be typed just to be able to launch the
parental controls app which itself will ask for a password to be typed.
2021-09-05 21:55:06 +00:00
Bastien Nocera
97e858d697 user-accounts: Hide parental controls row if unavailable
Don't show the parental controls line for administrator accounts.
2021-09-05 21:55:06 +00:00
Kalev Lember
e65a4ba77b user-accounts: Fix spurious underscore in front of "Parental Controls" label 2021-08-26 16:34:04 +02:00
Mohammed Sadiq
179d6aeb2d user: Use content style for listboxes 2021-05-19 03:25:47 +00:00
Mohammed Sadiq
092c77b0c1 user: Allow activating rows
HdyActionRow are not activatable by default. Explicitly enable them.
2021-05-12 03:18:35 +00:00
Nishal Kulkarni
df8eb92efc cc-avatar-chooser.c: Enable remote file selection
Currently user can choose avatar only from local files.

This prevents users from loading a file at a remote location.

Changes made include:

1. Setting local-only property to false in `cc_avatar_chooser_select_file`
2. Getting file uri and creating a GFile from it.
3. Reading the GFile into an input stream.
4. Loading image from this stream.

Closes: #813
2021-05-07 03:37:01 +00:00
Ian Douglas Scott
5e858826c5 user-accounts: Use HdyClamp 2021-05-07 03:23:31 +00:00
Ian Douglas Scott
aff0b446bc user-accounts: Use HdyActionRow 2021-05-07 03:23:31 +00:00
Robert Ancell
cbb2d31a38 user-accounts: Add missing GTK_WIDGET cast
Was missing in 77df081fec
2021-02-11 16:14:47 +13:00
Philip Withnall
77df081fec user-accounts: Make dim-label behaviour better for parental controls row
This makes it behave a bit more like other rows.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/26
2021-02-01 03:46:14 +00:00
Philip Withnall
dc09e0633c user-accounts: Imply parental controls permissions when unlocking
This allows querying the parental controls status of other non-admin
users once the panel is unlocked.

Implication is not recursive in polkit, so it’s unfortunately not
sufficient to just imply
`org.freedesktop.MalcontentControl.administration` (which itself implies
all the other actions).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-01 03:46:14 +00:00
Philip Withnall
2d41210b2f user-accounts: Add a description label for the Parental Controls row
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/26
2021-02-01 03:46:14 +00:00
Robert Ancell
c86d1c09c8 user-accounts: Simplify render_user_icon function 2021-01-08 15:28:47 +13:00
Robert Ancell
ff6aabb511 user-accounts: Use consistent whitespace 2021-01-08 15:25:07 +13:00
Robert Ancell
c690e921ca user-accounts: Use g_autoptr/g_autofree 2021-01-08 15:25:07 +13:00
Marco Trevisan (Treviño)
b031bb5758 fingerprint-dialog: Use auto-cleanup to manage removal of dialog states
For sake of simplicity we were just releasing a state once we got a
callback, however during the handling of the callback itself we are
still technically under that scenario, so we should release a state only
after the callback is completed.

This is more relevant now since when converting errors to human readable
strings we check the state we are in, and so we need to ensure that this
state is preserved until this point.
2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
ff7e4d6ebc fingerprint-dialog: Use exact comparision on all the dbus errors 2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
01fdfaccf8 fingerprint-dialog: Use more user friendly errors when showing them to user
Translate dbus errors into something that can be translated to user,
while leave to warnings all the details to help debugging.

Fixes: #1200
2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
d4745fdac1 fingerprint-dialog: Handle the 'enroll-disconnected' error properly
In case the device got disconnected while enrolling we should not try
to stop or unclaim it, but indeed show an error related to the device
not being available.

To get this we only have to remove the enrolling and claimed states now
2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
a0f028671c fingerprint-dialog: Add generic dialog actions state tracking
Use flags to track the dialog actions state so that we can:
 1. Remove multiple flags to track specific states
 2. Prevent starting again an action we're still waiting for completion
 3. Handle global visual elements (such as the busy spinner) correctly

Specifically point 3. allows to ensure that when doing concurrent
actions such as prints listing and device claiming, we will stop the
spinner only once all the operations are over.
2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
ae23cea4d1 fingerprint-dialog: Properly handle claiming errors if we're already claiming
We were a bit too permissive in handling the AlreadyInUse error during
claim, as we assumed it was always us causing it instead of properly
handing the case a device was already claimed by another caller.

So to ensure this is the case we need to avoid multiple calls to claim
until we've finished one.

Unfortunately we can't rely on a cancellable here as we may end up
cancelling the request that succeeded and we'll only get an
AlreadyClaimed error without know if it was us succeeding.

Fixes: #1201
2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
269feb1940 fingerprint-dialog: Always call EnrollStop on enrollment completed
Even if we got an error we need to always call EnrollStop so don't unset
enrolling_finger status until we're really done with it.
2020-12-11 17:46:38 +00:00
Marco Trevisan (Treviño)
5a7b9e09bf fingerprint-dialog: Don't crash when showing an error during release
We unset the local device early when releasing it, so use the one we
get the callback instead of relying in the private instance that has
been already cleared.
2020-12-11 17:46:38 +00:00
Philip Withnall
2809316fd1 user-accounts: Show ‘Add User’ button when panel is locked
Rather than hiding the ‘Add User’ button when the panel is locked, show
it in an insensitive state. This gives the user a hint that in order to
add a new user, they will need to unlock the panel.

See: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/26#note_705945

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-11 17:19:11 +00:00
Philip Withnall
a9bb55c3c4 user-accounts: Make infobar label more relevant
Highlight that the panel needs to be unlocked in order to add new users.
Currently, while the panel is locked, it’s not at all obvious how to add
new users.

In particular, this helps improve the flow from the parental controls
application, which opens g-c-c to allow new users to be added.

See: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/26#note_705945

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-11 17:19:11 +00:00
Philip Withnall
243ff6a511 user-accounts: Fix a critical warning if loading a cursor fails
It’s possible for `gdk_cursor_new_for_display()` to return `NULL`. It’s
OK to pass `NULL` to `gdk_window_set_cursor()`, but not OK to then unref
it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-02 21:41:03 +00:00
Philip Withnall
e8d9fc565b user-accounts: Pass --user argument to select user in malcontent-control
This eases the transition from g-c-c to malcontent-control a little.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/19
2020-10-20 12:50:48 +01:00
Benjamin Berg
64686cfee3 user-accounts: Consistently return translated strings for fprint helper
Always return translated strings from the fprint translation helper
header. This makes things more consistent overall.
2020-10-13 09:31:00 +00:00
Benjamin Berg
e80b4b5f58 user-accounts: Fix free of const string due to incorrect translations
A duplicatend and translated string could be passed to gettext another
time. If that string can be translated, then a static string would be
returned rather than the const one, causing an invalid free.

Fixes: #1149
2020-10-13 09:31:00 +00:00
Sebastien Bacher
57b01cf695 user-account: don't segfault trying to get the user initials
it's possible that act_user_get_real_name returns null, handle that case
fixes bug #959
2020-08-19 10:26:08 +12:00
Felipe Borges
6db6d8a402 user-accounts: Show "Take a picture" button only when cam is available
We already had the machanism to show/hide the button based on the number
of camera devices detected. We were just not checking for that at
startup.

Fixes #1087
2020-08-07 00:14:33 +00:00
Yuri Chornoivan
e7050ab6f4 Fix minor typos 2020-07-20 10:38:09 +03:00
Marco Trevisan (Treviño)
29add4ed51 fingerprint-dialog: Wiggle the enroll status label on retry events
When a retry event happens we need to wiggle the label, unfortunately we
can't just use translate operations via CSS so we need to simulate it using
padding.

Also we have to manually reset the retry class once the animation is done
otherwise gtk won't re-animate again once the class is added (in the same
paint cycle).
2020-06-26 01:54:04 +00:00
Marco Trevisan (Treviño)
d517a092aa user-accounts: Implement new designed fingerprint dialog
Implement the new designed interface for fingerprint enrollment, so that the
dialog is now based on a stack of views:
 - A list of devices to choose (shown only if multiple are available)
 - A gallery of enrolled prints available where manage them
 - An enrollment progress view when enrolling a new finger

Move part of the logic into a new FingerprintManager (to manage gdbus proxies
generated via gdbus-codegen) that is created when configuring the current
user and that tracks the devices states, while move most of the UI into a new
CcFingerprintDialog that does all the operations in async way.

Due to fprintd lack of APIs, there are few features missing, compared to
the final design (none is a regression):
 - Identify the finger when the enroll dialog is visible
 - Delete a single fingerprint
 - Highlight the finger when the sensor is touched during enrollment
 - Add customized labels to fingerprints
 - Devices hotpluging

However most of the code has been written considering these, and so they could
be easily implemented in future re-iterations once newer APIs are defined for
such bits.

Closes https://gitlab.gnome.org/Teams/Design/settings-mockups/-/issues/18
2020-06-26 01:54:04 +00:00
Marco Trevisan (Treviño)
840b906efe fingerprint-manager: Add state for state updating
Add add an "updating" state to the fingerprint manager so that the UI can
adapt the widgets depending on it, as the dbus calls might be a bit slow at
times.
2020-06-26 01:54:04 +00:00
Marco Trevisan (Treviño)
d5f6d8e965 fingerprint-manager: Add a getter for the user 2020-06-26 01:54:04 +00:00
Marco Trevisan (Treviño)
811d3584b6 fingerprint-manager: Cleanup devices cache when fprintd stops 2020-06-26 01:54:04 +00:00
Marco Trevisan (Treviño)
e155b95da6 fingerprint-manager: Add ability to cache devices 2020-06-26 01:54:03 +00:00
Marco Trevisan (Treviño)
d8c119db2d fingerprint-manager: Add completion callback to update state 2020-06-26 01:54:03 +00:00
Marco Trevisan (Treviño)
e935cb9d74 fingerprint-dialog: Use fingerprint manager to notify state changes 2020-06-26 01:54:03 +00:00
Marco Trevisan (Treviño)
25079fc505 user-panel: Use fingerprint manager to track the enrollment state 2020-06-26 01:54:03 +00:00
Marco Trevisan (Treviño)
9d1038db1f user-accounts: Add fingerprint manager
This is a wrapper to read the state of the fingerprint devices and to check
asynchronously whether we have them and if they have enrolled prints we can
use to log-in.
2020-06-26 01:54:03 +00:00
Umang Jain
cd391b4942 user-accounts: Add a launcher for parental controls app
malcontent ships malcontent-control[1] which is the user interface
to interact with various parental-control settings. Add a launcher
as per the design mockups[2] to launch malcontent-control.

[1]: https://gitlab.freedesktop.org/pwithnall/malcontent/-/blob/master/README.md
[2]: https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/users/users.png
2020-06-17 12:56:43 +01:00
Marco Trevisan (Treviño)
3c158afa5e fingerprint-dialog: Disconnect signals and reset stages on enroll-restart
This happens if going to the previous page when enrolling a finger
2020-05-27 10:20:48 +00:00
Marco Trevisan (Treviño)
6bbbd8d04e fingerprint-dialog: Don't limit the number of maximum enroll stages
There are devices with more than 10 enroll stages we should handle, so
instead of hardcoding a grid of images, let's just build this dynamically
using a flowbox
2020-05-27 10:20:48 +00:00
Marco Trevisan (Treviño)
97965e1619 fingerprint-dialog: Don't use sync calls for deleting fingerprints
Don't make the UI to block while deleting the saved prints (that might take
some time, especially for devices with internal storage) but just use a task
with a thread that:
 - Mark the fingerprint row as unsenstive
 - Calls the method to delete prints
 - In the same thread, calls the method to fetch the updated informations
 - Returns in set_fingerprint_row_cb where we update the UI again

Again this would be nicer to be done just using async calls but this is
something to do in some bigger refactor.
2020-05-27 10:20:48 +00:00
Marco Trevisan (Treviño)
014c7d77cc user-panel: Only load the fingerprint state once
Don't load the fingerprint information all the times we update the view, but
load it during initialization only.

The fingerprint state in fact can only change because we requested it
through the dialog that we control already and that would update the
relevant widgets state anyways.

Also, given that the fingerprint settings are visible for the current user
anyway, we can track this only with a simple boolean, instead of using a set
of UIDs.
2020-05-27 10:20:48 +00:00
Marco Trevisan (Treviño)
3107279759 user-panel: Pass a cancellable to the fingerprint operations
And cancel it when changing user and on disposition
2020-05-27 10:20:48 +00:00
Marco Trevisan (Treviño)
8ace2050f7 fingerprint-dialog: Make the operations cancellable 2020-05-27 10:20:48 +00:00