I am working on an extension for gnome, in which there is a popupmenu with menuitems.One of the menuitems is called "Log out" .I have managed to display next to "Log out" the real name of the user with this code:
let username = GLib.get_real_name();
.........
.........
item = new PopupMenu.PopupMenuItem(_(list[x].text) + username);
Now I want to display and the user profile image next to real name.I tried this code but it does not work:
let usename= GLib.get_user_name();
let user = AccountsService.UserManager.get_default().get_user(username);
let iconpath = user.get_icon_file();
let icon = Gio.icon_new_for_string(iconpath);
Icon = new St.Icon(icon);
boxicon = new St.BoxLayout();
boxicon.add(Icon);
It seems that the "iconpath" is null.How can I get the user profile image and display it in the menu. Thanks in advance.