/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/preferences_ui.js

  • Committer: Gustav Hartvigsson
  • Date: 2014-06-09 18:12:08 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140609181208-pip0yvqi6d8un0eg
* forgot the bloody file...

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
const Gtk = imports.gi.Gtk;
 
9
const Lang = imports.lang;
 
10
const _ = imports.gettext.gettext;
 
11
 
 
12
const SettingsData = imports.settings_data;
 
13
 
 
14
const PreferencesUI = Lang.Class ({
 
15
  Name: "PrefrencesUI",
 
16
  Extends: Gtk.Dialog,
 
17
  
 
18
  _init: function () {
 
19
    this.parent ({
 
20
      use_header_bar: true,
 
21
      title: _("GPump preferences")
 
22
    });
 
23
    
 
24
    this._prepare_header_bar ();
 
25
    this._prepare_list_box ();
 
26
    
 
27
    this.set_property ('resizable', false);
 
28
    
 
29
    this.show_all ();
 
30
  },
 
31
  
 
32
  _prepare_header_bar: function () {
 
33
    
 
34
    this.headerbar = this.get_header_bar ();
 
35
    this.headerbar.set_show_close_button (false);
 
36
    this.headerbar.pack_end ((this.close_btn = new Gtk.Button ({
 
37
      label: _("close")
 
38
    })));
 
39
    
 
40
    this.close_btn.connect ('clicked', Lang.bind (this, function () {
 
41
      this.destroy ();
 
42
    }));
 
43
    
 
44
  },
 
45
  
 
46
  _prepare_list_box: function () {
 
47
    /*this.get_content_area ().pack_start ()),
 
48
                                         true, true, 25);*/
 
49
    this.get_content_area ().set_center_widget (
 
50
                                          (this.list_box = new Gtk.ListBox ({
 
51
      width_request: 400,
 
52
      margin: 50,
 
53
      selection_mode: Gtk.SelectionMode.NONE
 
54
    })));
 
55
    
 
56
    let settings_object = SettingsData.get_settings ();
 
57
    
 
58
    /*************************** Use dark setting *****************************/
 
59
    let edit_clear_icon = new Gtk.Image ({icon_name: 'edit-clear'});
 
60
    
 
61
    this.use_dark_hbox = Gtk.Box.new (Gtk.Orientation.HORIZONTAL, 5);
 
62
    
 
63
    this.list_box.add (this.use_dark_hbox);
 
64
    
 
65
    this.use_dark_hbox.pack_start ((new Gtk.Label ({
 
66
                                                     label: _("Use dark theme")
 
67
                                                   })),
 
68
                                   false, false, 3);
 
69
    this.use_dark_hbox.pack_end ((this.use_dark_reset =
 
70
                                 new Gtk.Button ({
 
71
                                   image: edit_clear_icon})),
 
72
                                 false, false, 3);
 
73
    this.use_dark_hbox.pack_end ((this.use_dark_switch = new Gtk.Switch ()),
 
74
                                 false, false, 3);
 
75
    
 
76
    this.use_dark_switch.set_active (
 
77
      settings_object.get_setting("main.use_dark").data
 
78
    );
 
79
    
 
80
    /*************************** Privacy settings *****************************/
 
81
    this.list_box.add ((new Gtk.Label ({label: _("Privacy settings")})));
 
82
    
 
83
    /************************ show full name setting **************************/
 
84
    let edit_clear_icon = new Gtk.Image ({icon_name: 'edit-clear'});
 
85
    
 
86
    this.show_full_name_hbox = Gtk.Box.new (Gtk.Orientation.HORIZONTAL, 5);
 
87
    
 
88
    this.list_box.add (this.show_full_name_hbox);
 
89
    
 
90
    this.show_full_name_hbox.pack_start ((new Gtk.Label ({
 
91
                                                     label: _("Show full name")
 
92
                                                   })),
 
93
                                   false, false, 3);
 
94
    this.show_full_name_hbox.pack_end ((this.show_full_name_reset =
 
95
                                 new Gtk.Button ({
 
96
                                   image: edit_clear_icon})),
 
97
                                 false, false, 3);
 
98
    this.show_full_name_hbox.pack_end (
 
99
                               (this.show_full_name_switch = new Gtk.Switch ()),
 
100
                                 false, false, 3);
 
101
    this.show_full_name_switch.set_active (
 
102
      settings_object.get_setting ("main.privacy.show_full_name").data
 
103
    );
 
104
    
 
105
    /*********************** only show avatar setting **************************/
 
106
    let edit_clear_icon = new Gtk.Image ({icon_name: 'edit-clear'});
 
107
    
 
108
    this.only_show_avatar_hbox = Gtk.Box.new (Gtk.Orientation.HORIZONTAL, 5);
 
109
    
 
110
    this.list_box.add (this.only_show_avatar_hbox);
 
111
    
 
112
    this.only_show_avatar_hbox.pack_start ((new Gtk.Label ({
 
113
                                                    label: _("Only show avatar")
 
114
                                                   })),
 
115
                                   false, false, 3);
 
116
    this.only_show_avatar_hbox.pack_end ((this.only_show_avatar_reset =
 
117
                                 new Gtk.Button ({
 
118
                                   image: edit_clear_icon})),
 
119
                                 false, false, 3);
 
120
    this.only_show_avatar_hbox.pack_end (
 
121
                             (this.only_show_avatar_switch = new Gtk.Switch ()),
 
122
                                 false, false, 3);
 
123
    this.only_show_avatar_switch.set_active (
 
124
      settings_object.get_setting ("main.privacy.only_show_avatar").data
 
125
    );
 
126
    
 
127
    /* Spacer */
 
128
    //this.list_box.add ((new Gtk.Label ()));
 
129
    
 
130
    /* Reset all settings */
 
131
    this.list_box.add ((this.reset_all_btn = new Gtk.Button ({
 
132
      label: _("Reset all settings"),
 
133
      margin_left: 50,
 
134
      margin_right: 50,
 
135
      margin_top: 20
 
136
    })));
 
137
  }
 
138
  
 
139
  
 
140
});