[gnome-control-center/wip/oholy/avatar-size: 2/2] user-accounts: Remove custom file size limit for avatars
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/oholy/avatar-size: 2/2] user-accounts: Remove custom file size limit for avatars
- Date: Wed, 6 Feb 2019 09:51:55 +0000 (UTC)
commit 12854b00855c966f5d2776ef607f39fccdcf16f7
Author: Ondrej Holy <oholy redhat com>
Date: Wed Feb 7 15:45:07 2018 +0100
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 rely just on accountsservice
limits.
https://bugzilla.gnome.org/show_bug.cgi?id=792243
panels/user-accounts/cc-user-image.c | 48 +++---------------------------------
1 file changed, 4 insertions(+), 44 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-image.c b/panels/user-accounts/cc-user-image.c
index 79fefc7cb..5fdf72572 100644
--- a/panels/user-accounts/cc-user-image.c
+++ b/panels/user-accounts/cc-user-image.c
@@ -30,46 +30,12 @@ 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,
gint scale)
{
GdkPixbuf *pixbuf;
- gboolean res;
GError *error;
const gchar *icon_file;
cairo_surface_t *surface = NULL;
@@ -80,16 +46,10 @@ 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) {
- pixbuf = gdk_pixbuf_new_from_file_at_size (icon_file,
- icon_size * scale,
- icon_size * scale,
- NULL);
- }
- else {
- pixbuf = NULL;
- }
+ pixbuf = gdk_pixbuf_new_from_file_at_size (icon_file,
+ icon_size * scale,
+ icon_size * scale,
+ NULL);
}
if (pixbuf != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]