libpurple/purpledebugui.c

Tue, 15 Oct 2024 00:47:42 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Tue, 15 Oct 2024 00:47:42 -0500
changeset 43011
ce3144e2bc33
parent 42594
eddde70cedd8
permissions
-rw-r--r--

Port prefs to AdwSwitchRow

Now that we depend on Adwaita 1.4, we can flip the switch on using these (pun intended).

This also simplifies some extra tracking we needed to do for activations and focus, since the Adwaita widgets do that for us.

Testing Done:
Opened prefs, confirmed all the switches were there, and toggled them all without any warnings.

Also used the mnemonics to toggle the switches from the keyboard.

Reviewed at https://reviews.imfreedom.org/r/3582/

40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
12 * any later version.
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
17 * more details.
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "purpledebugui.h"
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 gboolean
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 purple_debug_ui_is_enabled(PurpleDebugUi *ui, PurpleDebugLevel level,
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 const gchar *category)
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 {
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 PurpleDebugUiInterface *iface = NULL;
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 g_return_val_if_fail(PURPLE_IS_DEBUG_UI(ui), FALSE);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 iface = PURPLE_DEBUG_UI_GET_IFACE(ui);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 if(iface != NULL && iface->is_enabled != NULL) {
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 return iface->is_enabled(ui, level, category);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 }
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 return FALSE;
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 }
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 void
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 purple_debug_ui_print(PurpleDebugUi *ui, PurpleDebugLevel level,
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 const gchar *category, const gchar *arg_s)
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 {
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 PurpleDebugUiInterface *iface = NULL;
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 g_return_if_fail(PURPLE_IS_DEBUG_UI(ui));
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 if(!purple_debug_ui_is_enabled(ui, level, category)) {
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 return;
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 }
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 iface = PURPLE_DEBUG_UI_GET_IFACE(ui);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 if(iface != NULL && iface->print != NULL) {
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 iface->print(ui, level, category, arg_s);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 }
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 }
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 G_DEFINE_INTERFACE(PurpleDebugUi, purple_debug_ui, G_TYPE_OBJECT);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 static void
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40950
diff changeset
62 purple_debug_ui_default_init(G_GNUC_UNUSED PurpleDebugUiInterface *iface) {
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 }
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64

mercurial