pidgin/pidginiconname.c

Fri, 16 Sep 2022 01:54:11 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 16 Sep 2022 01:54:11 -0500
changeset 41694
83e6692c76a3
parent 41027
aa0e688f2f46
child 42163
b0c31c877bde
permissions
-rw-r--r--

Change the credential provider row active indicator to a CheckButton

Because I noticed that Adw has a style that is for this sort of thing.

Testing Done:
Opened Credential prefs, and changed selected provider. Also checked that clicking the check button didn't accidentally change its state without changing the row, and that it could not be selected by keyboard separately from the row.

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

41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "pidginiconname.h"
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 /******************************************************************************
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 * Public API
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 *****************************************************************************/
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 pidgin_icon_name_from_status_primitive(PurpleStatusPrimitive primitive,
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 const gchar *fallback)
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 switch(primitive) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 case PURPLE_STATUS_OFFLINE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 return "pidgin-user-offline";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 case PURPLE_STATUS_AVAILABLE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 return "pidgin-user-available";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 case PURPLE_STATUS_UNAVAILABLE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 return "pidgin-user-unavailable";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 case PURPLE_STATUS_AWAY:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 return "pidgin-user-away";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 case PURPLE_STATUS_INVISIBLE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 return "pidgin-user-invisible";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 case PURPLE_STATUS_EXTENDED_AWAY:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 return "pidgin-user-extended-away";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 case PURPLE_STATUS_MOBILE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 case PURPLE_STATUS_TUNE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 case PURPLE_STATUS_MOOD:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 case PURPLE_STATUS_UNSET:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 default:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 pidgin_icon_name_from_status_type(PurpleStatusType *type, const gchar *fallback)
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 PurpleStatusPrimitive primitive;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 if(type == NULL) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 primitive = purple_status_type_get_primitive(type);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 return pidgin_icon_name_from_status_primitive(primitive, fallback);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 pidgin_icon_name_from_status(PurpleStatus *status, const gchar *fallback) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 PurpleStatusType *type = NULL;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 if(!PURPLE_IS_STATUS(status)) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 type = purple_status_get_status_type(status);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 if(type == NULL) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 return pidgin_icon_name_from_status_type(type, fallback);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 pidgin_icon_name_from_presence(PurplePresence *presence, const gchar *fallback)
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 PurpleStatus *status = NULL;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 if(!PURPLE_IS_PRESENCE(presence)) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 status = purple_presence_get_active_status(presence);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 return pidgin_icon_name_from_status(status, fallback);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 }

mercurial