Tue, 13 May 2025 00:49:03 -0500
Start of the appearance preferences
Testing Done:
Toggled the preference and verified the key file updated. Also edited the key file and verified the widget updated.
Bugs closed: PIDGIN-18082
Reviewed at https://reviews.imfreedom.org/r/3996/
|
43249
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <purple.h> |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include <adwaita.h> |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include "pidginappearanceprefs.h" |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | #include "pidgincore.h" |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | struct _PidginAppearancePrefs { |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | AdwPreferencesPage parent; |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | GtkWidget *show_formatting; |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | }; |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | G_DEFINE_FINAL_TYPE(PidginAppearancePrefs, pidgin_appearance_prefs, |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | ADW_TYPE_PREFERENCES_PAGE) |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | /****************************************************************************** |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | * GObject Implementation |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | *****************************************************************************/ |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | static void |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | pidgin_appearance_prefs_class_init(PidginAppearancePrefsClass *klass) { |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | gtk_widget_class_set_template_from_resource(widget_class, |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | "/im/pidgin/Pidgin3/Prefs/appearance.ui"); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | gtk_widget_class_bind_template_child(widget_class, PidginAppearancePrefs, |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | show_formatting); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | } |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | static void |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | pidgin_appearance_prefs_init(PidginAppearancePrefs *prefs) { |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | GSettings *settings = NULL; |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | gtk_widget_init_template(GTK_WIDGET(prefs)); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | settings = g_settings_new_with_backend("im.pidgin.Pidgin3.Appearance", |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | purple_core_get_settings_backend()); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | g_settings_bind(settings, "show-formatting", |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | prefs->show_formatting, "active", G_SETTINGS_BIND_DEFAULT); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | g_clear_object(&settings); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | } |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | /****************************************************************************** |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | * API |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | *****************************************************************************/ |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | GtkWidget * |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | pidgin_appearance_prefs_new(void) { |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | return g_object_new(PIDGIN_TYPE_APPEARANCE_PREFS, NULL); |
|
ae9ab6159a80
Start of the appearance preferences
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | } |