summaryrefslogtreecommitdiff
path: root/panels/user-accounts
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2018-02-07 15:45:07 +0100
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-03-02 14:47:52 +0000
commit03bf65f78f33d85ec88f26482361f48b1f722be3 (patch)
tree8d764308fd01763dda78d6cc19d51ddc0046e48d /panels/user-accounts
parentaddc65a6fdf08c36238e5047c6ca62513b67ca99 (diff)
downloadgnome-control-center-03bf65f78f33d85ec88f26482361f48b1f722be3.tar.gz
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
Diffstat (limited to 'panels/user-accounts')
-rw-r--r--panels/user-accounts/cc-user-image.c49
1 files changed, 5 insertions, 44 deletions
diff --git a/panels/user-accounts/cc-user-image.c b/panels/user-accounts/cc-user-image.c
index a8197c369..d8a871967 100644
--- a/panels/user-accounts/cc-user-image.c
+++ b/panels/user-accounts/cc-user-image.c
@@ -32,39 +32,6 @@ struct _CcUserImage {
G_DEFINE_TYPE (CcUserImage, cc_user_image, GTK_TYPE_IMAGE)
-#define MAX_FILE_SIZE 65536
-
-static gboolean
-check_user_file (const char *filename,
- gssize max_file_size)
-{
- struct stat fileinfo;
-
- if (max_file_size < 0) {
- max_file_size = G_MAXSIZE;
- }
-
- /* Exists/Readable? */
- if (stat (filename, &fileinfo) < 0) {
- g_debug ("File does not exist");
- return FALSE;
- }
-
- /* Is a regular file */
- if (G_UNLIKELY (!S_ISREG (fileinfo.st_mode))) {
- g_debug ("File is not a regular file");
- return FALSE;
- }
-
- /* Size is sane? */
- if (G_UNLIKELY (fileinfo.st_size > max_file_size)) {
- g_debug ("File is too large");
- return FALSE;
- }
-
- return TRUE;
-}
-
static cairo_surface_t *
render_user_icon (ActUser *user,
gint icon_size,
@@ -72,7 +39,6 @@ render_user_icon (ActUser *user,
{
g_autoptr(GdkPixbuf) source_pixbuf = NULL;
GdkPixbuf *pixbuf = NULL;
- gboolean res;
GError *error;
const gchar *icon_file;
cairo_surface_t *surface = NULL;
@@ -83,17 +49,12 @@ render_user_icon (ActUser *user,
icon_file = act_user_get_icon_file (user);
pixbuf = NULL;
if (icon_file) {
- res = check_user_file (icon_file, MAX_FILE_SIZE);
- if (res) {
- source_pixbuf = gdk_pixbuf_new_from_file_at_size (icon_file,
- icon_size * scale,
- icon_size * scale,
- NULL);
+ source_pixbuf = gdk_pixbuf_new_from_file_at_size (icon_file,
+ icon_size * scale,
+ icon_size * scale,
+ NULL);
+ if (source_pixbuf)
pixbuf = round_image (source_pixbuf, icon_size * scale);
- }
- else {
- pixbuf = NULL;
- }
}
if (pixbuf != NULL) {