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