Commit graph

638 commits

Author SHA1 Message Date
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
Marco Trevisan (Treviño)
e12bfed744 user-panel: Don't wait for fprintd on initialization
When opening the user panel we g-c-c performs lots of sync operations that
may cause a noticeable slowdown, especially when a fingerprint device is
available, in fact set_fingerprint_label() call leads to:
  - DBus sync request of the system bus
  - fprintd dbus-activation
    + This leads to sync opening of all the devices, that might also cause
      a slowdown, depending on the devices drivers
  - Dbus sync calls to the device to get the list of enrolled fingerprints

Only after we've a reply, we update the g-c-c UI and continue the execution.

The fingerprint dialog code would need some global refactor, but to fix this
without big changes, let's just use GTask that runs a thread in wich we do
all the sync operations, and once done we finally update the widget state.
2020-05-27 10:20:48 +00:00
Marco Trevisan (Treviño)
826f83c48a user-panel: Add reference to selected user and clear on dispose
The object was wrongly unreffed (as ActUserManager has the ownership) on
user switch, so add a reference instead when assigning it to our private
ref and unref it on dispose.
2020-05-27 10:20:48 +00:00
Daniel García Moreno
3bcea691b8 user-accounts: Use custom setting to override faces
This patch provides an easy way to override default faces using
org.gnome.desktop.interface.avatar-directories settings configuration
that can be used in gnome-initial-setup too so downstream can override
default avatar faces without the need of a patch.

Fix https://gitlab.gnome.org/GNOME/gnome-control-center/issues/678
2020-05-07 15:06:02 +00:00
Ondrej Holy
502583fcc5 user-accounts: Move add user button tooltip in UI file
The add user button is shown only if the panel is unlocked, but
tooltips are also set for the case when the panel is not unlocked.
Let's move the tooltip text in the UI file directly and remove
the obsolete codes.
2020-05-05 09:25:41 +00:00
Ondrej Holy
1a38a971ec user-accounts: Show add user button also if no users found
The add user button is not shown currently if no users are found
even if the panel is unlocked. Let's show the button to allow
user creation in this case.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/988
2020-05-05 09:25:41 +00:00
Ondrej Holy
ac46922b65 user-accounts: Show permissions toolbar also if no users found
The permissions toolbar is not shown currently if no users are found
which prevents creation of new user accounts. Let's show the toolbar
also in this case.

https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/988
2020-05-05 09:25:41 +00:00
Robert Ancell
100d3684f2 user-accounts: Connect signals with g_signal_connect_object in swapped form 2020-03-30 16:18:50 +13:00
Felipe Borges
b4bcae2d2d user-accounts: Only set "Add User" visibility when permission changed
To avoid showing and hiding rapidly.

See #859
2020-02-17 15:04:26 +01:00
Felipe Borges
61dc4489de user-accounts: Always generate user avatars
Never fallback to default-user avatar icons.

See #859
2020-02-17 15:04:25 +01:00
Robert Ancell
93b14a4339 panel: Move shared GCancellable code into panel class
Make the panel class provide a cancellable that will be cancelled when the panel
is destroyed. Panel implementations can use this and not have to mangage the
cancellable themselves. Consolidate cases where panels had multiple cancellables
that were all being used for this behaviour.
2020-02-03 09:36:24 +13:00
Felipe Borges
8a1c6f696e user-accounts: Rename "Last Login" entry to "Account Activity"
According to the mockups at
https://gitlab.gnome.org/Teams/Design/settings-mockups/raw/master/users/users.png

Other than renaming the label, we prepend "Last login" to the
date-time string.

Fixes #771
2020-01-30 08:04:09 +00:00
Felipe Borges
6db4d9e933 user-account: Add border around user image button
According to the mockups at
https://gitlab.gnome.org/Teams/Design/settings-mockups/raw/master/users/users.png

Fixes #771
2020-01-30 08:04:09 +00:00
Felipe Borges
05313d35e2 user-accounts: UI style improvements
According to the mockups at
https://gitlab.gnome.org/Teams/Design/settings-mockups/raw/master/users/users.png

Fixes #771
2020-01-30 08:04:09 +00:00
Felipe Borges
43b41cb1fa user-accounts: Make the full_name_entry and editable widget
According to the mockups at
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/users/users.png

Fixes #771
2020-01-30 08:04:09 +00:00
Philip Withnall
6284162a1d user-accounts: Fix use of an uninitialised variable in the carousel
`dest_x` is not set if `gtk_widget_translate_coordinates()` fails, which
it can do before the widget is realised.

This fixes a valgrind warning, but doesn’t change any user-visible
behaviour as far as I can tell.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 17:43:24 +00:00
Ondrej Holy
7f010f3138 users: Show username hint immediately
Changes made by GNOME/gnome-control-center!359 caused that the username
hint ("This will be used to name your home folder and can’t be changed.")
is not shown immediately after opening the "Add User" dialog. This change
was unwanted. Let's show the hint immediately after opening the dialog as
it was before.
2020-01-22 10:55:13 +01:00
Ondrej Holy
7611e07e3f user-accounts: Prevent usage of uninitialized value
gtk_widget_translate_coordinates() doesn't have to always set the
dest_x argument. Let's initialize the argument before use to prevent
usage of uninitialized value, which also prevents "Conditional jump
or move depends on uninitialised value(s)" messages from valgrind.
2020-01-13 16:20:01 +00:00
Philip Withnall
8052466726 user-accounts: Fix a leak on destruction of CcCarousel
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-13 11:50:40 +00:00
Felipe Borges
3576133654 user-accounts: Use CcPermissionInfobar to lock/unlock the panel
This moves the GtkLockButton out of the headerbar and starts to
consume the CcPermissionInfobar API to lock/unlock the panel.

See #771
2020-01-06 14:43:11 +00:00
Philip Withnall
9f018a2d62 user-accounts: Use a more specific GtkSettings object
Otherwise we might potentially be using the GtkSettings for the wrong
screen, which might make a difference if one screen has animations
enabled but another doesn’t.

(This is an edge case I spotted while reading the code, but not one that
I’ve experienced practically.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-11 14:23:39 +00:00
Philip Withnall
b2d607df44 user-accounts: Fix carousel arrow location when animations are disabled
When animations are disabled, the @keyframes CSS rule doesn’t work, and
neither does animation-name — so we need to set the margin-left to the
arrow’s final location directly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-11 14:23:36 +00:00
Xiaoguang Wang
c6be204af0 user-accounts: Use absolute path of command usermod
On distro openSUSE Tumbleweed and SUSE Linux Enterprise the path
of command usermod is not in environment variable PATH, we need to
use absolute path to find command.
2019-12-11 15:30:33 +08:00
Robert Ancell
36645259fd user-accouts: Don't use page names for CcCarousel
Ultimately the code was just trying to access the nth entry.
2019-12-10 09:54:27 +00:00
Robert Ancell
cb6241f540 user-accounts: Replace GtkStack child names with widget references
The child names are easier to break if widgets are changed - this can't be
detected by the compiler.
2019-12-10 09:54:27 +00:00
Robert Ancell
bf0a757c7f user-accounts: Fix small memory leak 2019-12-10 09:54:27 +00:00
Robert Ancell
f1e0666eca Simplify usage of g_variant_iter_loop
Access strings via pointers, which reduces copying and the chances of leaks.
Simplify cases where string arrays were modified - no need to replace the value as it's no longer allocated.
Always complete the loop so references are freed.
2019-11-27 21:25:34 +00:00