52
64
/*this.get_content_area ().pack_start ()),
54
66
this.get_content_area ().set_center_widget (
55
(this.list_box = new Gtk.ListBox ({
58
selection_mode: Gtk.SelectionMode.NONE
67
(this.layout = new Gtk.Box ({
68
orientation: Gtk.Orientation.VERTICAL,
76
this.layout.pack_start (
77
new Gtk.Frame ({child:
78
(this.list_box = new Gtk.ListBox ({
80
selection_mode: Gtk.SelectionMode.NONE,
61
90
let settings_object = SettingsData.get_settings ();
63
92
/*************************** Use dark setting *****************************/
64
let edit_clear_icon = new Gtk.Image ({icon_name: 'edit-clear'});
66
this.use_dark_hbox = Gtk.Box.new (Gtk.Orientation.HORIZONTAL, 5);
94
this.use_dark_hbox = new Gtk.Box ({orientation: Gtk.Orientation.HORIZONTAL,
68
97
this.list_box.add (this.use_dark_hbox);
70
99
this.use_dark_hbox.pack_start ((new Gtk.Label ({
71
label: _("Use dark theme")
74
this.use_dark_hbox.pack_end ((this.use_dark_reset =
76
image: edit_clear_icon})),
100
label: _("Use dark theme")
101
})),false, false, 3);
103
this.use_dark_hbox.pack_end ((this.use_dark_reset = new Gtk.Button ({
104
image: (new Gtk.Image ({icon_name: "edit-clear"}))
105
})),false, false, 3);
78
107
this.use_dark_hbox.pack_end ((this.use_dark_switch = new Gtk.Switch ()),
98
127
this.use_dark_reset.connect ("clicked", Lang.bind (this,
99
this._reset_use_dark_theme));
128
this._reset_use_dark_theme));
130
/*********************** Quit on close ************************************/
131
this.quit_on_close_hbox = new Gtk.Box ({
132
orientation: Gtk.Orientation.HORIZONTAL,
136
this.list_box.add (this.quit_on_close_hbox);
138
this.quit_on_close_hbox.pack_start ((new Gtk.Label ({
139
label: _("Quit on close")
140
})), false, false, 3);
142
this.quit_on_close_hbox.pack_end ((this.quit_on_close_reset =
144
image: (new Gtk.Image ({icon_name: "edit-clear"}))
145
})), false, false, 3);
147
this.quit_on_close_hbox.pack_end ((this.quit_on_close_switch =
148
new Gtk.Switch), false, false, 3);
150
if (settings_object.get_setting ("main.quit_on_close").data !=
151
SettingsData.QUIT_ON_CLOSE.UNKNOWN) {
152
this.quit_on_close_switch.set_active (Boolean (
153
settings_object.get_setting ("main.quit_on_close")));
156
this.quit_on_close_switch.set_active (false);
159
this.quit_on_close_switch.connect ("notify::active",
160
Lang.bind (this, function () {
161
let v = settings_object.get_setting ("main.quit_on_close").data;
164
case (SettingsData.QUIT_ON_CLOSE.YES):
165
case (SettingsData.QUIT_ON_CLOSE.NO):
166
if (this.quit_on_close_switch.get_active ()) {
167
settings_object.set_setting ("main.quit_on_close", SettingsData.QUIT_ON_CLOSE.YES);
169
settings_object.set_setting ("main.quit_on_close", SettingsData.QUIT_ON_CLOSE.NO);
173
case (SettingsData.QUIT_ON_CLOSE.UNKNOWN):
174
let popover = new Gtk.Popover ({relative_to: this.quit_on_close_switch, modal: true});
175
let popover_layout1 = new Gtk.Box ({parent: popover, orientation: Gtk.Orientation.VERTICAL});
176
popover_layout1.pack_start ((new Gtk.Label ({
177
label: _("This has not been set yet, if you like to set it to a " +
178
"value, click \"yes\" or \"no\", dismiss this to not set a value"),
182
let popover_layout2 = new Gtk.Box ({orientation: Gtk.Orientation.HORIZONTAL});
183
popover_layout2.get_style_context().add_class ("linked");
184
let btn_yes = new Gtk.Button ({label: _("Yes")});
185
let btn_no = new Gtk.Button ({label: _("No")});
186
popover_layout2.pack_end (btn_yes, true, true, 0);
187
popover_layout2.pack_start (btn_no, true, true, 0);
188
popover_layout1.pack_end (popover_layout2, false, false, 0);
189
btn_no.get_style_context ().add_class("suggested-action");
191
popover.connect_after ("hide", Lang.bind (popover, function () {
195
btn_no.connect ("clicked", Lang.bind ((popover, this), function () {
196
SettingsData.get_settings ().set_setting ("main.quit_on_close",
197
SettingsData.QUIT_ON_CLOSE.NO);
198
this.quit_on_close_switch.set_active (false);
202
btn_yes.connect ("clicked", Lang.bind ((popover, this), function () {
203
SettingsData.get_settings ().set_setting ("main.quit_on_close",
204
SettingsData.QUIT_ON_CLOSE.YES);
205
this.quit_on_close_switch.set_active (true);
212
print ("WOW! Something went wrong!");
213
print (JSON.stringify(v).toString ());
101
218
/*************************** Privacy settings *****************************/
102
219
this.list_box.add ((new Gtk.Label ({label: _("Privacy settings")})));
104
221
/************************ show full name setting **************************/
105
let edit_clear_icon = new Gtk.Image ({icon_name: 'edit-clear'});
107
this.show_full_name_hbox = Gtk.Box.new (Gtk.Orientation.HORIZONTAL, 5);
223
this.show_full_name_hbox = new Gtk.Box ({
224
orientation: Gtk.Orientation.HORIZONTAL,
109
228
this.list_box.add (this.show_full_name_hbox);
111
230
this.show_full_name_hbox.pack_start ((new Gtk.Label ({
112
label: _("Show full name")
231
label: _("Show full name")
232
})),false, false, 3);
115
234
this.show_full_name_hbox.pack_end ((this.show_full_name_reset =
117
image: edit_clear_icon})),
236
image: (new Gtk.Image ({icon_name: "edit-clear"}))
237
})), false, false, 3);
119
239
this.show_full_name_hbox.pack_end (
120
(this.show_full_name_switch = new Gtk.Switch ()),
240
(this.show_full_name_switch = new Gtk.Switch ()), false, false, 3);
122
242
this.show_full_name_switch.set_active (
123
243
settings_object.get_setting ("main.privacy.show_full_name").data
246
this.show_full_name_switch.connect ("notify::active",
247
Lang.bind (this, function () {
248
let app_settings = SettingsData.get_settings ();
249
if (this.show_full_name_switch.get_active ()) {
250
app_settings.set_setting ("main.privacy.show_full_name", true);
252
app_settings.set_setting ("main.privacy.show_full_name", false);
256
this.show_full_name_reset.connect ("clicked", Lang.bind (this,
257
this._reset_show_full_name));
126
259
/*********************** only show avatar setting **************************/
127
let edit_clear_icon = new Gtk.Image ({icon_name: 'edit-clear'});
129
this.only_show_avatar_hbox = Gtk.Box.new (Gtk.Orientation.HORIZONTAL, 5);
261
this.only_show_avatar_hbox = new Gtk.Box ({orientation: Gtk.Orientation.HORIZONTAL,
131
264
this.list_box.add (this.only_show_avatar_hbox);
133
266
this.only_show_avatar_hbox.pack_start ((new Gtk.Label ({
134
label: _("Only show avatar")
137
this.only_show_avatar_hbox.pack_end ((this.only_show_avatar_reset =
139
image: edit_clear_icon})),
267
label: _("Only show avatar")
268
})), false, false, 3);
270
this.only_show_avatar_hbox.pack_end ((this.only_show_avatar_reset =
272
image: (new Gtk.Image ({icon_name: "edit-clear"}))
273
})), false, false, 3);
141
275
this.only_show_avatar_hbox.pack_end (
142
276
(this.only_show_avatar_switch = new Gtk.Switch ()),
143
277
false, false, 3);
145
279
settings_object.get_setting ("main.privacy.only_show_avatar").data
149
//this.list_box.add ((new Gtk.Label ()));
282
this.only_show_avatar_switch.connect ("notify::active",
283
Lang.bind (this, function () {
284
let app_settings = SettingsData.get_settings ();
285
if (this.only_show_avatar_switch.get_active ()) {
286
app_settings.set_setting ("main.privacy.only_show_avatar", true);
288
app_settings.set_setting ("main.privacy.only_show_avatar", false);
151
292
/* Reset all settings */
152
this.list_box.add ((this.reset_all_btn = new Gtk.Button ({
153
label: _("Reset all settings"),
293
this.layout.pack_end (
294
(this.reset_all_btn = new Gtk.Button ({
295
label: _("Reset all settings")
159
302
this.reset_all_btn.connect ("clicked", Lang.bind(this, this._reset_all));
162
305
_reset_all: function () {
163
306
this._reset_use_dark_theme ();
307
this._reset_show_full_name ();
308
this._reset_only_show_avatar ();
309
this._reset_quit_on_close
166
312
_reset_use_dark_theme: function () {