Commit graph

758 commits

Author SHA1 Message Date
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
Ondrej Holy
65d3b71d98 user-accounts: Fix password dialog hangs
On Fedora 31, the "Current Password: " prompt is printed by passwd,
when I enter my current password wrongly. It is not clear to me why
and I don't know how to debug the PAM stack, but it causes that the
checkmark for the old password field is not reliable and what is worse
it causes the dialog hangs when it is submitted. Let's add check for
the "urrent" keyword to fix this issue.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/766
2019-11-12 12:26:29 +00:00
Ondrej Holy
29367abbb0 user-accounts: Fix password dialog crashes
Currently, the password_entry_timeout() callback can be called even after
the dialog disposal, which leads to segfaults. This is because the
corresponding source ids can be cleared in some cases without removing
the sources. Let's prevent direct calls of password_entry_timeout()
without destroying the source ids in order to fix this issue.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/760
2019-11-11 03:51:12 +00:00
Niels De Graef
f83450cebf Chain up to parent finalize()
This was forgotten in a few places, which means you have a memory leak
(albeit tiny).
2019-10-14 09:56:08 +02:00
Ting-Wei Lan
d28d317332 user-accounts: Escape the name of the user for markup
On FreeBSD, the default full name of a user is 'User &'. The '&'
character included in the name is expected to be replaced with the login
name when it is displayed on the user interface. However, it seems that
AccountsService doesn't know it. It just returns 'User &' to the caller,
and it causes the markup to be broken in the user panel.
2019-09-10 23:32:49 +00:00
Ting-Wei Lan
564aa72b5e user-accounts: Use 'pw usershow' to check username validity on FreeBSD
FreeBSD has no standalone 'usermod' command. Most user and group
management functions are provided as subcommands of 'pw' tool.
2019-09-10 23:32:49 +00:00
Ting-Wei Lan
54caab7b07 user-accounts: Initialize GError* to NULL before use
Otherwise, it causes warnings to be shown on the terminal when it is
used and quickly leads to a crash.
2019-09-10 23:32:49 +00:00
Ting-Wei Lan
a72a71ab11 user-accounts: Include sys/wait.h for W* macros
Otherwise, the compiler may treat WIFEXITED and WEXITSTATUS as implicit
declarations of functions and cause linking to fail.
2019-09-10 23:32:49 +00:00
Ondrej Holy
1f71ae6046 user-accounts: Check username validity over usermod
Username policies differ across the distributions. See the discussion on:
https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/359

It is not possible to hard-code some rules here without the need for
downstream modifications. Let's check the validity of usernames dynamically
over "usermod" to prevent this.

Just be careful that this is based on undocumented usermod behavior, which
may change in the future.
2019-08-26 16:26:45 +03:00
Benjamin Berg
fa873a04eb user: Support devices with more than 5 enroll steps
We are currently adding support for Synaptics devices that require 8
steps. Add another row for images which brings us to up to 10
supportable steps for now.
2019-08-12 22:27:07 +00:00
Michael Catanzaro
a22da99aaf Replace unsafe setlocale() use with uselocale()
setlocale() is not threadsafe except when used only to query the locale
without changing it. Let's use uselocale() instead, which changes the
locale only on the calling thread. Much better.
2019-07-03 17:15:33 -05:00
Mohammed Sadiq
48912bef01 user-panel: Fix entry overflow on minimum width
And set a margin on either side, so that it won't expand up to the border
2019-06-10 16:46:16 +00:00
Ondrej Holy
31cee4caf8 user-accounts: Fix crash when password dialog is cancelled
If "Esc" is pressed, the callbacks to handle the `focus-out` signal are
called after the `cc_password_dialog_dispose` function. This leads to
segfaults, because the `user` variable is already cleared. Let's simply
do not continue if `user == NULL` to fix those crashes.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/563
2019-06-07 17:04:47 +00:00
Chris Coulson
7cbccd3578 user-accounts: Fix password check when using LDAP
Usually, passwd exits with an error if the current password is incorrect,
however, when using LDAP, it askes for password again. It causes hangs as
the passwd helper assumes that the password is correct. Let's prevent this
hangs using additional check for "incorrect" keyword.

Based on a patch from https://launchpad.net/bugs/607357 made by Ryan Tandy.

https://bugzilla.gnome.org/show_bug.cgi?id=786530
2019-06-06 07:13:47 +00:00
Georges Basile Stavracas Neto
75f150d5a2 shell: Add position to cc_shell_embed_widget_in_header()
So we can control where the widget should be added to. The
main window only supports left and right positions.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/528
2019-05-21 12:59:36 -03:00
Ondrej Holy
f5f67823db user-accounts: Present the default avatar in the avatar popover
Currently, it is not possible to unset a custom avatar, respective it
is not possible to set the default one. Let's present the default
avatar in the avatar popover as suggested in the mockup:
https://wiki.gnome.org/Design/OS/AvatarChooser

Fixes: GNOME/gnome-control-center#62
2019-05-16 14:50:45 +00:00
Ondrej Holy
65a8c15467 user-accounts: Remove a redundant parameter
The `round_image()` function has the `icon_size` parameter, which is not
used by that function, because the size is determined from a pixbuf size.
Let's remove that redundant `icon_size` parameter.
2019-05-16 14:50:45 +00:00
Andrea Azzarone
f42f39970d user-accounts: Fix memory corruption in the avatar popup
Use g_object_set_data_full and g_steal_pointer to ensure the validity of the
"filename" association.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/399
2019-03-04 11:06:54 +00:00
Ondrej Holy
03bf65f78f user-accounts: Remove custom file size limit for avatars
accountsservice has 1 MB limit for avatars, however, users panels
refuses to show avatars bigger than 64 KB for some historical reasons.
But you can still successfully set avatars up to the accountsservice
limit. Let's remove this custom limit and other redundant check and
rely just on accountsservice limits and errors from GDK.

https://bugzilla.gnome.org/show_bug.cgi?id=792243
2019-03-02 14:47:52 +00:00
Ondrej Holy
addc65a6fd user-accounts: Allow bigger custom avatars
Default set of avatars uses 512x512 currently. However, custom avatars
from file, or webcam are always scaled down to 96x96. Let's increase this
also to 512x512. This change should be safe, because theoretical maximal
file size is 1 MB, which is equal to accountsservice limit.

https://bugzilla.gnome.org/show_bug.cgi?id=792243
2019-03-02 14:47:52 +00:00
Georges Basile Stavracas Neto
cd0954be34 user-accounts: Ellipsize real name label
In the User Accounts panel's carousel, longer real names
push the window geometry to super wide levels -- even with
the 255-char limitation in place.

Fix that by ellipsizing the real name label.
2019-02-13 15:06:53 +00:00
Georges Basile Stavracas Neto
db94f197fa user-panels: Limit full name length
GNOME Settings allows limitless full names, which is
actually accepted by most of the stack but may break
GNOME Settings, GNOME Shell and other user-visible
applications that show the user names.

Limit the user full name entries to 255 characters,
which is the same value used by GNOME Initial Setup.
2019-02-13 15:06:53 +00:00
Ondrej Holy
587238867e user-accounts: Fix crashes when dialog is canceled
Changes from !373 causes crashes when "Add User" dialog is canceled.
Check return value and generate user avatar only if valid user is
returned to fix the crashes.
2019-02-08 09:45:35 +01:00
Felipe Borges
02c288ab6f user-accounts: Generate a default avatar for new users
When a user is created, we generate an avatar with their initials.

See https://gitlab.gnome.org/GNOME/Initiatives/issues/6
2019-02-06 11:53:56 +00:00
Felipe Borges
12ad6a1b18 user-account: Remove border from user image button
See https://gitlab.gnome.org/GNOME/Initiatives/issues/6
2019-02-06 11:53:56 +00:00
Felipe Borges
d263ce1549 user-accounts: Round all user images
This is part of the effort in [0] to standardize the way we display
user images accross GNOME. Images are now going to be rounded and
borderless.

See https://gitlab.gnome.org/GNOME/Initiatives/issues/6
2019-02-06 11:53:56 +00:00
Allan Day
3ababb4bf8 user-accounts: tweak the layout of the faces
For GNOME 3.32 we are pushing to make all our avatar images
round. This commit adjusts the existing stock faces images
to avoid layout issues when they are cropped in this way.

Fixes #289
2019-02-06 11:16:50 +00:00
Philip Withnall
1ca4104844 user-accounts: Allow ‘Remove User’ button to be focused
Otherwise it isn’t included in the tab focus cycle, and can’t be
navigated to with the tab key.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-22 16:50:24 +00:00
Ondrej Holy
a800e97510 user-account: Use the same Categories as other panels
gnome-user-accounts-panel.desktop has some differences in "Categories" in
comparison to other desktop files provided by gnome-control-center for no
obvious reason.

Add "GNOME" and "GTK" categories, which are used in all other desktop files.

Remove "System" and use just "Settings" main category. This among others
prevents the following output from desktop-file-validate:

/usr/share/applications/gnome-user-accounts-panel.desktop: hint: value
"System;Settings;X-GNOME-Settings-Panel;X-GNOME-DetailsSettings;" for key
"Categories" in group "Desktop Entry" contains more than one main
category; application might appear more than once in the application menu

All other desktop files uses just the "Settings" main category.

But maybe this is totally useless patch, because it seems that GNOME Shell
do not care about the most of categories and GNOME Classic do not show those
desktop files in menus at all.
2019-01-05 14:40:35 +00:00
Robert Ancell
f1307baf4e user-accounts: Replace lone tab character with spaces 2018-11-14 10:11:02 +13:00
Robert Ancell
b40b0a4d05 user-accounts: Rename um-utils.[ch] to user-utils.[ch]
Um is a naming hangover from before this was part of g-c-c.
2018-11-14 10:10:15 +13:00