aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dbus-shared-names.h2
-rw-r--r--src/user-menu-mgr.c23
-rw-r--r--src/user-widget.c55
3 files changed, 47 insertions, 33 deletions
diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h
index c71dc61..c5372e4 100644
--- a/src/dbus-shared-names.h
+++ b/src/dbus-shared-names.h
@@ -55,7 +55,7 @@ typedef enum {
#define USER_ITEM_PROP_LOGGED_IN "user-item-logged-in"
#define USER_ITEM_PROP_IS_CURRENT_USER "user-item-is-current-user"
#define USER_ITEM_PROP_ICON "user-item-icon-path"
-#define USER_ITEM_ICON_DEFAULT "user-offline"
+#define USER_ITEM_ICON_DEFAULT "avatar-default"
#define RESTART_ITEM_TYPE "x-canonical-restart-item"
#define RESTART_ITEM_LABEL "restart-label"
diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c
index 30ea0ff..1bd7468 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -92,8 +92,6 @@ static void
user_menu_mgr_class_init (UserMenuMgrClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
- //GObjectClass* parent_class = G_OBJECT_CLASS (klass);
-
object_class->finalize = user_menu_mgr_finalize;
}
@@ -212,15 +210,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode)
dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, conflictedname);
g_free(conflictedname);
} else {
- //g_debug ("%i %s", (gint)user->uid, user->real_name);
- //g_debug ("users uid = %i", (gint)user->uid);
- //g_debug ("users real name = %s", user->real_name);
- if (user == NULL){
- g_debug ("USER pointer is NULL");
- return;
- }
- g_debug ("%p: %s", user, user->real_name);
-
+ g_debug ("%p: %s", user, user->real_name);
dbusmenu_menuitem_property_set (mi,
USER_ITEM_PROP_NAME,
user->real_name);
@@ -229,9 +219,16 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode)
USER_ITEM_PROP_LOGGED_IN,
user->sessions != NULL);
if (user->icon_file != NULL && user->icon_file[0] != '\0') {
- dbusmenu_menuitem_property_set(mi, USER_ITEM_PROP_ICON, user->icon_file);
+ g_debug ("user %s has this icon : %s",
+ user->user_name,
+ user->icon_file);
+ dbusmenu_menuitem_property_set (mi,
+ USER_ITEM_PROP_ICON,
+ user->icon_file);
} else {
- dbusmenu_menuitem_property_set(mi, USER_ITEM_PROP_ICON, USER_ITEM_ICON_DEFAULT);
+ dbusmenu_menuitem_property_set (mi,
+ USER_ITEM_PROP_ICON,
+ USER_ITEM_ICON_DEFAULT);
}
gboolean logged_in = g_strcmp0 (user->user_name, g_get_user_name()) == 0;
diff --git a/src/user-widget.c b/src/user-widget.c
index 6495e80..172c645 100644
--- a/src/user-widget.c
+++ b/src/user-widget.c
@@ -107,23 +107,6 @@ user_widget_init (UserWidget *self)
// Create the UI elements.
priv->user_image = gtk_image_new ();
- // Just for now set the image to the default avator image
- GdkPixbuf* pixbuf = NULL;
- GError* error = NULL;
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "avatar-default",
- 32,
- GTK_ICON_LOOKUP_FORCE_SIZE,
- &error);
-
- if (pixbuf == NULL || error != NULL) {
- g_warning ("Could not load the default avatar image for some reason");
- }
- else{
- gtk_image_set_from_pixbuf (GTK_IMAGE(priv->user_image), pixbuf);
- g_object_unref (pixbuf);
- }
-
priv->user_name = gtk_label_new ("");
priv->container = gtk_hbox_new (FALSE, 0);
priv->tick_icon = gtk_image_new_from_icon_name ("account-logged-in",
@@ -325,9 +308,43 @@ user_widget_set_twin_item (UserWidget* self,
gtk_widget_hide(priv->tick_icon);
}
- g_debug("Using user icon for '%s' from file: %s",
- dbusmenu_menuitem_property_get(twin_item, USER_ITEM_PROP_NAME), icon_name);
+ GdkPixbuf* pixbuf = NULL;
+ GError* error = NULL;
+ pixbuf = gdk_pixbuf_new_from_file_at_size(icon_name, 32, 32, NULL);
+
+ if (pixbuf == NULL || error != NULL) {
+ g_warning ("Could not load the user image (%s) for some reason",
+ icon_name);
+ if (pixbuf != NULL){
+ g_object_unref (pixbuf);
+ pixbuf = NULL;
+ }
+ if (error != NULL){
+ g_error_free (error);
+ error = NULL;
+ }
+
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ USER_ITEM_ICON_DEFAULT,
+ 32,
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ &error);
+ }
+ if (pixbuf == NULL || error != NULL) {
+ g_warning ("Could not load the user image");
+ if (error != NULL){
+ g_error_free (error);
+ error = NULL;
+ }
+ }
+ else{
+ gtk_image_set_from_pixbuf (GTK_IMAGE(priv->user_image), pixbuf);
+ }
+ if (pixbuf != NULL){
+ g_object_unref (pixbuf);
+ pixbuf = NULL;
+ }
}
/**