Fri, 10 Mar 2023 16:37:41 -0600
Make PurpleRequestFieldChoice into a GObject
This also does an `hg cp`, though with all the renaming of the parameter names, maybe that wasn't as useful for tracking the diff.
I wonder if this should implement `GListModel`, but the values are currently arbitrary pointers, so it won't work right now.
Testing Done:
Compiled and opened Request Fields from Demo protocol.
Reviewed at https://reviews.imfreedom.org/r/2335/
|
41237
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <libpurple/purplepath.h> |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
41730
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
21 | #include <libpurple/core.h> |
|
41867
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
22 | #include <libpurple/purpleui.h> |
|
41730
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
23 | |
|
41264
46a289816176
We need to include our win32dep.h file for the path api
Gary Kramlich <grim@reaperworld.com>
parents:
41237
diff
changeset
|
24 | #ifdef _WIN32 |
|
46a289816176
We need to include our win32dep.h file for the path api
Gary Kramlich <grim@reaperworld.com>
parents:
41237
diff
changeset
|
25 | # include "win32/win32dep.h" |
|
46a289816176
We need to include our win32dep.h file for the path api
Gary Kramlich <grim@reaperworld.com>
parents:
41237
diff
changeset
|
26 | #endif |
|
46a289816176
We need to include our win32dep.h file for the path api
Gary Kramlich <grim@reaperworld.com>
parents:
41237
diff
changeset
|
27 | |
|
41237
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | /****************************************************************************** |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | * Globals |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | *****************************************************************************/ |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | static gchar *custom_user_dir = NULL; |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | static gchar *user_dir = NULL; |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | static gchar *cache_dir = NULL; |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | static gchar *config_dir = NULL; |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | static gchar *data_dir = NULL; |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | /****************************************************************************** |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | * Helpers |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | *****************************************************************************/ |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | static const gchar * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | purple_xdg_dir(gchar **xdg_dir, const gchar *xdg_base_dir, |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | const gchar *xdg_type) |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | if (!*xdg_dir) { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | if (!custom_user_dir) { |
|
41867
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
46 | PurpleUi *ui = purple_core_get_ui(); |
|
41730
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
47 | const gchar *id = NULL; |
|
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
48 | |
|
41867
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
49 | id = purple_ui_get_id(ui); |
|
41730
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
50 | if(id == NULL) { |
|
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
51 | id = "purple"; |
|
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
52 | } |
|
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
53 | |
|
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
54 | *xdg_dir = g_build_filename(xdg_base_dir, id, NULL); |
|
41237
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | } else { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | *xdg_dir = g_build_filename(custom_user_dir, xdg_type, NULL); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | return *xdg_dir; |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | /****************************************************************************** |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | * Public API |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | *****************************************************************************/ |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | const gchar * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | purple_home_dir(void) { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | #ifndef _WIN32 |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | return g_get_home_dir(); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | #else |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | return wpurple_home_dir(); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | #endif |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | const gchar * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | purple_cache_dir(void) { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | return purple_xdg_dir(&cache_dir, g_get_user_cache_dir(), "cache"); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | const gchar * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | purple_config_dir(void) { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | return purple_xdg_dir(&config_dir, g_get_user_config_dir(), "config"); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | const gchar * |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | purple_data_dir(void) { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | return purple_xdg_dir(&data_dir, g_get_user_data_dir(), "data"); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | } |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | void |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | purple_util_set_user_dir(const gchar *dir) { |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | g_free(custom_user_dir); |
|
41730
f76b8bc39892
Use the id property of PurpleUiInfo as the directory name to use with XDG_CONFIG_HOME
Gary Kramlich <grim@reaperworld.com>
parents:
41680
diff
changeset
|
93 | custom_user_dir = g_strdup(dir); |
|
41237
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | g_clear_pointer(&user_dir, g_free); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | g_clear_pointer(&cache_dir, g_free); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | g_clear_pointer(&config_dir, g_free); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | g_clear_pointer(&data_dir, g_free); |
|
5098e0dd3a09
Move the path based functions from util.c to their own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | } |