/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-02-08 17:53:39 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140208175339-yxn38uceduzzvswx
Initial code.

Non of the code is actualy functional.

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