bzr branch
http://gegoxaren.bato24.eu/bzr/gpump/trunk
52.1.3
by Gustav Hartvigsson
* Woops |
1 |
/* This file is part of GPump, a Pump.io client.
|
2 |
*
|
|
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.
|
|
6 |
*/
|
|
7 |
||
8 |
/** @file
|
|
9 |
*/
|
|
10 |
||
11 |
const Gtk = imports.gi.Gtk; |
|
12 |
const _ = imports.gettext.gettext; |
|
13 |
const Lang = imports.lang; |
|
14 |
||
52.1.6
by Gustav Hartvigsson
* added StackSwitcher for the main and meanwhile wievs. |
15 |
const AccountUI = imports.account_ui; |
52.1.3
by Gustav Hartvigsson
* Woops |
16 |
|
52.1.8
by Gustav Hartvigsson
* Strted work on changing how the SettingsData class works, |
17 |
/** @class
|
18 |
* UserMenu is a custom GtkPopover that shows the accounts that can be
|
|
19 |
* switched between and accsess to the user wizard/account maneger.
|
|
20 |
*/
|
|
52.1.3
by Gustav Hartvigsson
* Woops |
21 |
const UserMenu = new Lang.Class ({ |
22 |
Name: "UserMenu", |
|
23 |
Extends: Gtk.Popover, |
|
24 |
|
|
25 |
_init: function (params) { |
|
26 |
this.parent (params); |
|
27 |
this["width_request"] = 300; |
|
28 |
this["height_request"]= 400; |
|
29 |
|
|
30 |
this.layout = new Gtk.Box ({ |
|
31 |
orientation: Gtk.Orientation.VERTICAL, |
|
32 |
spacing: 8, |
|
33 |
border_width: 8 |
|
34 |
}); |
|
35 |
|
|
36 |
this.add (this.layout); |
|
37 |
|
|
38 |
this.layout.pack_start ( |
|
39 |
(new Gtk.ScrolledWindow ({ |
|
40 |
child: (this.list_box = new Gtk.ListBox ()), |
|
41 |
shadow_type: Gtk.ShadowType.ETCHED_IN |
|
42 |
})), |
|
43 |
true, |
|
44 |
true, |
|
45 |
3 |
|
46 |
); |
|
47 |
|
|
48 |
for (let i = 0; i <= 20; i++) { |
|
49 |
this.list_box.add (new Gtk.Label ({label: "user " + i})); |
|
50 |
} |
|
51 |
|
|
52 |
this.layout.pack_end ( |
|
53 |
(this.accounts_btn = new Gtk.Button ({ |
|
54 |
"label": _("Accounts") |
|
55 |
})), |
|
56 |
false, |
|
57 |
false, |
|
58 |
3 |
|
59 |
); |
|
60 |
|
|
61 |
this.accounts_btn.connect ("clicked", Lang.bind (this, function () { |
|
52.1.6
by Gustav Hartvigsson
* added StackSwitcher for the main and meanwhile wievs. |
62 |
let account_ui = new AccountUI.AccountUI (); |
63 |
this.hide (); |
|
64 |
account_ui.set_transient_for (this.get_toplevel()); |
|
65 |
account_ui.run (); |
|
52.1.3
by Gustav Hartvigsson
* Woops |
66 |
})); |
67 |
|
|
68 |
this.connect ("show", Lang.bind (this, function () { |
|
69 |
this.layout.show_all (); |
|
70 |
})); |
|
71 |
|
|
72 |
} |
|
73 |
|
|
74 |
});
|