1
/* This file is part of GPump, a Pump.io client.
3
* GPump (THE SOFTWARE) is made available under the terms and conditions of the
4
* GNU Lesser General Public Licence 3.0. A copy of the licence can be read
5
* in the file lgpl-3.0.txt in the root of this project.
9
* UserButton is a custom button that displays the users avatar and name.
12
const GObject = imports.gi.GObject;
13
const Gtk = imports.gi.Gtk;
14
const Lang = imports.lang;
16
const UserButton = Lang.Class ({
20
"user_avatar": GObject.param_spec_object ("user_avatar",
22
"A Gtk.Image that is shown in the button",
24
GObject.ParamFlags.READABLE |
25
GObject.ParamFlags.WRITABLE),
27
"user_name": GObject.param_spec_string ("user_name",
29
"The text to be shown on the button",
30
"user name goes here",
31
GObject.ParamFlags.READABLE |
32
GObject.ParamFlags.WRITABLE),
34
"show_avatar_only": GObject.param_spec_boolean ("show_avatar_only",
36
"When set, only the avatar will be shown" +
39
GObject.ParamFlags.READABLE |
40
GObject.ParamFlags.WRITABLE)
44
_init: function (params) {
46
this.set_property ('always-show-image', true);
50
return this._user_avatar;
53
set user_avatar (avatar) {
57
this.set_image (avatar);
58
this._user_avatar = avatar;
63
return this._user_name;
66
set user_name (name) {
67
this._user_name = name;
68
this.parent.set_property ("label", name);
71
get show_avatar_only () {
72
return _show_avatar_only;
75
set show_avatar_only (show_avatar) {
76
this._show_avatar_only = show_avatar;