/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-08-03 21:09:38 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140803210938-jfhdl23v4mzji6pf
* Added translation files (messeges.po and sv.po)
* fixed a few gettext errors in app.js
* TODO:
  * Make the translations not be as "fixed" as they are now.
  * Add auto update/compile for the translations to makefile.

  * Switch to a better build system?

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
 
 */
10
 
 
11
 
const Gtk = imports.gi.Gtk;
12
 
const _ = imports.gettext.gettext;
13
 
const Lang = imports.lang;
14
 
 
15
 
const AccountUI = imports.account_ui;
16
 
 
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
 
 */
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 () {
62
 
      let account_ui = new AccountUI.AccountUI ();
63
 
      this.hide ();
64
 
      account_ui.set_transient_for (this.get_toplevel());
65
 
      account_ui.run ();
66
 
    }));
67
 
    
68
 
    this.connect ("show", Lang.bind (this, function () {
69
 
      this.layout.show_all ();
70
 
    }));
71
 
    
72
 
  }
73
 
  
74
 
});