blob: 14abc580b39711d2e9851359464909be4a21a33a (
plain) (
blame)
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
|
using Gtk;
using Dino.Entities;
namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/Dino/settings_dialog.ui")]
class SettingsDialog : Dialog {
[GtkChild] private unowned CheckButton typing_checkbutton;
[GtkChild] private unowned CheckButton marker_checkbutton;
[GtkChild] private unowned CheckButton notification_checkbutton;
[GtkChild] private unowned CheckButton emoji_checkbutton;
[GtkChild] private unowned CheckButton check_spelling_checkbutton;
[GtkChild] private unowned RadioButton encryption_radio_undecided;
[GtkChild] private unowned RadioButton encryption_radio_omemo;
[GtkChild] private unowned RadioButton encryption_radio_openpgp;
[GtkChild] private unowned CheckButton send_button_checkbutton;
[GtkChild] private unowned CheckButton enter_newline_checkbutton;
[GtkChild] private unowned CheckButton quit_ctrl_q_checkbutton;
Dino.Entities.Settings settings = Dino.Application.get_default().settings;
public SettingsDialog() {
Object(use_header_bar : Util.use_csd() ? 1 : 0);
typing_checkbutton.active = settings.send_typing;
marker_checkbutton.active = settings.send_marker;
notification_checkbutton.active = settings.notifications;
emoji_checkbutton.active = settings.convert_utf8_smileys;
check_spelling_checkbutton.active = settings.check_spelling;
encryption_radio_undecided.active = settings.default_encryption == Encryption.UNKNOWN;
encryption_radio_omemo.active = settings.default_encryption == Encryption.OMEMO;
encryption_radio_openpgp.active = settings.default_encryption == Encryption.PGP;
send_button_checkbutton.active = settings.send_button;
enter_newline_checkbutton.active = settings.enter_newline;
enter_newline_checkbutton.sensitive = settings.send_button;
quit_ctrl_q_checkbutton.active = settings.quit_ctrl_q;
typing_checkbutton.toggled.connect(() => { settings.send_typing = typing_checkbutton.active; } );
marker_checkbutton.toggled.connect(() => { settings.send_marker = marker_checkbutton.active; } );
notification_checkbutton.toggled.connect(() => { settings.notifications = notification_checkbutton.active; } );
emoji_checkbutton.toggled.connect(() => { settings.convert_utf8_smileys = emoji_checkbutton.active; });
check_spelling_checkbutton.toggled.connect(() => { settings.check_spelling = check_spelling_checkbutton.active; });
encryption_radio_undecided.toggled.connect(() => {
if (encryption_radio_undecided.active) {
settings.default_encryption = Encryption.UNKNOWN;
}
});
encryption_radio_omemo.toggled.connect(() => {
if (encryption_radio_omemo.active) {
settings.default_encryption = Encryption.OMEMO;
}
});
encryption_radio_openpgp.toggled.connect(() => {
if (encryption_radio_openpgp.active) {
settings.default_encryption = Encryption.PGP;
}
});
send_button_checkbutton.toggled.connect(() => { settings.send_button = send_button_checkbutton.active; });
enter_newline_checkbutton.toggled.connect(() => { settings.enter_newline = enter_newline_checkbutton.active; });
settings.send_button_update.connect((visible) => {
enter_newline_checkbutton.sensitive = visible;
if (visible == false) {
enter_newline_checkbutton.active = visible;
}
});
quit_ctrl_q_checkbutton.toggled.connect(() => { settings.quit_ctrl_q = quit_ctrl_q_checkbutton.active; });
}
}
}
|