pidgin/pidginiconname.c

Thu, 12 Oct 2023 22:31:22 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 12 Oct 2023 22:31:22 -0500
changeset 42352
1c53950f9052
parent 42164
cd96db566218
child 42476
5b5e6297cd31
permissions
-rw-r--r--

Migrate from GtkFileChooserNative to GtkFileDialog

Testing Done:
Compiled, and opened a few dialogs from the demo protocol.

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

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_UNSET:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 default:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 return fallback;
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
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 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
62 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 PurpleStatusPrimitive primitive;
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 if(type == NULL) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 primitive = purple_status_type_get_primitive(type);
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 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
72 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 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
76 PurpleStatusType *type = NULL;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 if(!PURPLE_IS_STATUS(status)) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 type = purple_status_get_status_type(status);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 if(type == NULL) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 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
88 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 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
92 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 PurpleStatus *status = NULL;
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 if(!PURPLE_IS_PRESENCE(presence)) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 status = purple_presence_get_active_status(presence);
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 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
102 }

mercurial