Fri, 12 Aug 2022 03:44:34 -0500
A bunch of random fixes for the the gtk4 branch
Testing Done:
Compiled
Reviewed at https://reviews.imfreedom.org/r/1581/
|
40350
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * purple |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * source distribution. |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | */ |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | #include "purplekeyvaluepair.h" |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | G_DEFINE_BOXED_TYPE(PurpleKeyValuePair, purple_key_value_pair, |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | purple_key_value_pair_copy, purple_key_value_pair_free); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | PurpleKeyValuePair * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | purple_key_value_pair_new(const gchar *key, gpointer value) { |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | return purple_key_value_pair_new_full(key, value, NULL); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | } |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | PurpleKeyValuePair * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | purple_key_value_pair_new_full(const gchar *key, gpointer value, |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | GDestroyNotify value_destroy_func) |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | { |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | PurpleKeyValuePair *kvp; |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
40351
79cbdc5c5989
Add some unit tests for key value pairs
Gary Kramlich <grim@reaperworld.com>
parents:
40350
diff
changeset
|
38 | kvp = g_new(PurpleKeyValuePair, 1); |
|
40350
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | kvp->key = g_strdup(key); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | kvp->value = value; |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | kvp->value_destroy_func = value_destroy_func; |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | return kvp; |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | } |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | void |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | purple_key_value_pair_free(PurpleKeyValuePair *kvp) { |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | g_return_if_fail(kvp != NULL); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | g_free(kvp->key); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | if(kvp->value_destroy_func) { |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | kvp->value_destroy_func(kvp->value); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | } |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | g_free(kvp); |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | } |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | PurpleKeyValuePair * |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | purple_key_value_pair_copy(PurpleKeyValuePair *kvp) { |
|
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | g_return_val_if_fail(kvp != NULL, NULL); |
|
40351
79cbdc5c5989
Add some unit tests for key value pairs
Gary Kramlich <grim@reaperworld.com>
parents:
40350
diff
changeset
|
62 | g_return_val_if_fail(kvp->value_destroy_func == NULL, NULL); |
|
40350
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
40351
79cbdc5c5989
Add some unit tests for key value pairs
Gary Kramlich <grim@reaperworld.com>
parents:
40350
diff
changeset
|
64 | return purple_key_value_pair_new(kvp->key, kvp->value); |
|
40350
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | } |