| |
1 /* |
| |
2 * Pidgin - Internet Messenger |
| |
3 * Copyright (C) Pidgin Developers <devel@pidgin.im> |
| |
4 * |
| |
5 * Pidgin is the legal property of its developers, whose names are too numerous |
| |
6 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
7 * source distribution. |
| |
8 * |
| |
9 * This program is free software; you can redistribute it and/or modify |
| |
10 * it under the terms of the GNU General Public License as published by |
| |
11 * the Free Software Foundation; either version 2 of the License, or |
| |
12 * (at your option) any later version. |
| |
13 * |
| |
14 * This program is distributed in the hope that it will be useful, |
| |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
17 * GNU General Public License for more details. |
| |
18 * |
| |
19 * You should have received a copy of the GNU General Public License |
| |
20 * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| |
21 */ |
| |
22 |
| |
23 #include <glib/gi18n-lib.h> |
| |
24 |
| |
25 #include <purple.h> |
| |
26 |
| |
27 #include <adwaita.h> |
| |
28 |
| |
29 #include "pidginprivacyprefs.h" |
| |
30 #include "pidgincore.h" |
| |
31 |
| |
32 struct _PidginPrivacyPrefs { |
| |
33 AdwPreferencesPage parent; |
| |
34 |
| |
35 GtkWidget *send_typing_notifications; |
| |
36 }; |
| |
37 |
| |
38 G_DEFINE_FINAL_TYPE(PidginPrivacyPrefs, pidgin_privacy_prefs, |
| |
39 ADW_TYPE_PREFERENCES_PAGE) |
| |
40 |
| |
41 /****************************************************************************** |
| |
42 * GObject Implementation |
| |
43 *****************************************************************************/ |
| |
44 static void |
| |
45 pidgin_privacy_prefs_class_init(PidginPrivacyPrefsClass *klass) { |
| |
46 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
| |
47 |
| |
48 gtk_widget_class_set_template_from_resource(widget_class, |
| |
49 "/im/pidgin/Pidgin3/Prefs/privacy.ui"); |
| |
50 |
| |
51 gtk_widget_class_bind_template_child(widget_class, PidginPrivacyPrefs, |
| |
52 send_typing_notifications); |
| |
53 } |
| |
54 |
| |
55 static void |
| |
56 pidgin_privacy_prefs_init(PidginPrivacyPrefs *prefs) { |
| |
57 GSettings *settings = NULL; |
| |
58 |
| |
59 gtk_widget_init_template(GTK_WIDGET(prefs)); |
| |
60 |
| |
61 settings = g_settings_new_with_backend("im.pidgin.Pidgin3.Privacy", |
| |
62 purple_core_get_settings_backend()); |
| |
63 g_settings_bind(settings, "send-typing-notifications", |
| |
64 prefs->send_typing_notifications, "active", |
| |
65 G_SETTINGS_BIND_DEFAULT); |
| |
66 g_clear_object(&settings); |
| |
67 } |
| |
68 |
| |
69 /****************************************************************************** |
| |
70 * API |
| |
71 *****************************************************************************/ |
| |
72 GtkWidget * |
| |
73 pidgin_privacy_prefs_new(void) { |
| |
74 return g_object_new(PIDGIN_TYPE_PRIVACY_PREFS, NULL); |
| |
75 } |