/gpump/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/gpump/trunk

« back to all changes in this revision

Viewing changes to src/user_menu.js

  • Committer: Gustav Hartvigsson
  • Date: 2014-11-18 19:38:00 UTC
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: gustav.hartvigsson@gmail.com-20141118193800-p6ts3zetyf7he8xy
* Woops

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * UserMenu is a custom GtkPopover that shows the accounts that can be
 
10
 * switched between and accsess to the user wizard/account maneger.
 
11
 */
 
12
 
 
13
const Gtk = imports.gi.Gtk;
 
14
const _ = imports.gettext.gettext;
 
15
const Lang = imports.lang;
 
16
 
 
17
 
 
18
const UserMenu = new Lang.Class ({
 
19
  Name: "UserMenu",
 
20
  Extends: Gtk.Popover,
 
21
  
 
22
  _init: function (params) {
 
23
    this.parent (params);
 
24
    this["width_request"] = 300;
 
25
    this["height_request"]= 400;
 
26
    
 
27
    this.layout = new Gtk.Box ({
 
28
      orientation: Gtk.Orientation.VERTICAL,
 
29
      spacing: 8,
 
30
      border_width: 8
 
31
    });
 
32
    
 
33
    this.add (this.layout);
 
34
    
 
35
    this.layout.pack_start (
 
36
      (new Gtk.ScrolledWindow ({
 
37
        child: (this.list_box = new Gtk.ListBox ()),
 
38
        shadow_type: Gtk.ShadowType.ETCHED_IN
 
39
      })),
 
40
      true,
 
41
      true,
 
42
      3
 
43
    );
 
44
    
 
45
    for (let i = 0; i <= 20; i++) {
 
46
      this.list_box.add (new Gtk.Label ({label: "user " + i}));
 
47
    }
 
48
    
 
49
    this.layout.pack_end (
 
50
      (this.accounts_btn = new Gtk.Button ({
 
51
        "label": _("Accounts")
 
52
      })),
 
53
      false,
 
54
      false,
 
55
      3
 
56
    );
 
57
    
 
58
    this.accounts_btn.connect ("clicked", Lang.bind (this, function () {
 
59
      print ("Blubb!")
 
60
    }));
 
61
    
 
62
    this.connect ("show", Lang.bind (this, function () {
 
63
      this.layout.show_all ();
 
64
    }));
 
65
    
 
66
  }
 
67
  
 
68
});