1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/* This file is part of GPump, a Pump.io client.
*
* GPump (THE SOFTWARE) is made available under the terms and conditions of the
* GNU Lesser General Public Licence 3.0. A copy of the licence can be read
* in the file lgpl-3.0.txt in the root of this project.
*/
/** @file
*/
const Gtk = imports.gi.Gtk;
const _ = imports.gettext.gettext;
const Lang = imports.lang;
const AccountUI = imports.account_ui;
/** @class
* UserMenu is a custom GtkPopover that shows the accounts that can be
* switched between and accsess to the user wizard/account maneger.
*/
const UserMenu = new Lang.Class ({
Name: "UserMenu",
Extends: Gtk.Popover,
_init: function (params) {
this.parent (params);
this["width_request"] = 300;
this["height_request"]= 400;
this.layout = new Gtk.Box ({
orientation: Gtk.Orientation.VERTICAL,
spacing: 8,
border_width: 8
});
this.add (this.layout);
this.layout.pack_start (
(new Gtk.ScrolledWindow ({
child: (this.list_box = new Gtk.ListBox ()),
shadow_type: Gtk.ShadowType.ETCHED_IN
})),
true,
true,
3
);
for (let i = 0; i <= 20; i++) {
this.list_box.add (new Gtk.Label ({label: "user " + i}));
}
this.layout.pack_end (
(this.accounts_btn = new Gtk.Button ({
"label": _("Accounts")
})),
false,
false,
3
);
this.accounts_btn.connect ("clicked", Lang.bind (this, function () {
let account_ui = new AccountUI.AccountUI ();
this.hide ();
account_ui.set_transient_for (this.get_toplevel());
account_ui.run ();
}));
this.connect ("show", Lang.bind (this, function () {
this.layout.show_all ();
}));
}
});
|