[gnome-control-center/useraccounts-fixups: 16/17] user-accounts: Always generate user avatars



commit 152202ece1b03409782e9d378a81ee12ab6fde9e
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Feb 11 14:14:38 2020 +0100

    user-accounts: Always generate user avatars
    
    Never fallback to default-user avatar icons.
    
    See #859

 panels/user-accounts/cc-avatar-chooser.c |  1 -
 panels/user-accounts/cc-avatar-chooser.h |  2 ++
 panels/user-accounts/cc-user-image.c     | 16 ++++++----------
 3 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/panels/user-accounts/cc-avatar-chooser.c b/panels/user-accounts/cc-avatar-chooser.c
index 221e2d8c9..70346ca49 100644
--- a/panels/user-accounts/cc-avatar-chooser.c
+++ b/panels/user-accounts/cc-avatar-chooser.c
@@ -42,7 +42,6 @@
 #include "user-utils.h"
 
 #define ROW_SPAN 5
-#define AVATAR_CHOOSER_PIXEL_SIZE 80
 #define PIXEL_SIZE 512
 
 struct _CcAvatarChooser {
diff --git a/panels/user-accounts/cc-avatar-chooser.h b/panels/user-accounts/cc-avatar-chooser.h
index 56a1699fe..1479c675e 100644
--- a/panels/user-accounts/cc-avatar-chooser.h
+++ b/panels/user-accounts/cc-avatar-chooser.h
@@ -23,6 +23,8 @@
 #include <gtk/gtk.h>
 #include <act/act.h>
 
+#define AVATAR_CHOOSER_PIXEL_SIZE 80
+
 G_BEGIN_DECLS
 
 #define CC_TYPE_AVATAR_CHOOSER (cc_avatar_chooser_get_type())
diff --git a/panels/user-accounts/cc-user-image.c b/panels/user-accounts/cc-user-image.c
index 26a430d44..a996154f8 100644
--- a/panels/user-accounts/cc-user-image.c
+++ b/panels/user-accounts/cc-user-image.c
@@ -22,6 +22,7 @@
 #include <act/act.h>
 #include <sys/stat.h>
 
+#include "cc-avatar-chooser.h"
 #include "user-utils.h"
 
 struct _CcUserImage {
@@ -39,7 +40,6 @@ render_user_icon (ActUser *user,
 {
         g_autoptr(GdkPixbuf) source_pixbuf = NULL;
         GdkPixbuf    *pixbuf = NULL;
-        GError       *error;
         const gchar  *icon_file;
         cairo_surface_t *surface = NULL;
 
@@ -61,17 +61,13 @@ render_user_icon (ActUser *user,
                 goto out;
         }
 
-        error = NULL;
-        pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                           "avatar-default",
-                                           icon_size * scale,
-                                           GTK_ICON_LOOKUP_FORCE_SIZE,
-                                           &error);
-        if (error) {
-                g_warning ("%s", error->message);
-                g_error_free (error);
+        if (source_pixbuf != NULL) {
+                g_object_unref (source_pixbuf);
         }
 
+        source_pixbuf = generate_default_avatar (user, AVATAR_CHOOSER_PIXEL_SIZE);
+        if (source_pixbuf)
+            pixbuf = round_image (source_pixbuf);
  out:
 
         if (pixbuf != NULL) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]