Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
--- a/doc/reference/libpurple/libpurple-docs.xml Thu Apr 30 20:57:31 2020 -0500
+++ b/doc/reference/libpurple/libpurple-docs.xml Thu Apr 30 23:43:54 2020 -0500
@@ -66,6 +66,7 @@
<xi:include href="xml/purple-gio.xml" />
<xi:include href="xml/purpleaccountoption.xml" />
<xi:include href="xml/purpleaccountusersplit.xml" />
+ <xi:include href="xml/purplekeyvaluepair.xml" /> <xi:include href="xml/purpleprotocolfactory.xml" />
<xi:include href="xml/purpleuiinfo.xml" />
<xi:include href="xml/queuedoutputstream.xml" />
--- a/finch/gntaccount.c Thu Apr 30 20:57:31 2020 -0500
+++ b/finch/gntaccount.c Thu Apr 30 23:43:54 2020 -0500
@@ -36,13 +36,7 @@
-#include <purpleaccountoption.h>
-#include <savedstatuses.h>
--- a/finch/gntplugin.c Thu Apr 30 20:57:31 2020 -0500
+++ b/finch/gntplugin.c Thu Apr 30 23:43:54 2020 -0500
@@ -32,9 +32,7 @@
--- a/finch/gntrequest.c Thu Apr 30 20:57:31 2020 -0500
+++ b/finch/gntrequest.c Thu Apr 30 23:43:54 2020 -0500
@@ -35,8 +35,8 @@
--- a/libpurple/group.h Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/group.h Thu Apr 30 23:43:54 2020 -0500
@@ -43,7 +43,6 @@
--- a/libpurple/media/backend-fs2.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/media/backend-fs2.c Thu Apr 30 23:43:54 2020 -0500
@@ -28,6 +28,7 @@
+#include <purplekeyvaluepair.h> #include <farstream/fs-conference.h>
#include <farstream/fs-element-added-notifier.h>
--- a/libpurple/media/codec.h Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/media/codec.h Thu Apr 30 23:43:54 2020 -0500
@@ -37,7 +37,7 @@
typedef struct _PurpleMediaCodec PurpleMediaCodec;
+#include <purplekeyvaluepair.h> --- a/libpurple/meson.build Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/meson.build Thu Apr 30 23:43:54 2020 -0500
@@ -48,6 +48,7 @@
'purpleaccountusersplit.c',
+ 'purplekeyvaluepair.c', 'purpleprotocolfactory.c',
@@ -125,6 +126,7 @@
'purpleaccountusersplit.h',
+ 'purplekeyvaluepair.h', 'purpleprotocolfactory.h',
--- a/libpurple/pluginpref.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/pluginpref.c Thu Apr 30 23:43:54 2020 -0500
@@ -29,6 +29,7 @@
+#include "purplekeyvaluepair.h" struct _PurplePluginPrefFrame
--- a/libpurple/protocol.h Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/protocol.h Thu Apr 30 23:43:54 2020 -0500
@@ -46,7 +46,6 @@
--- a/libpurple/protocols/gg/gg.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/protocols/gg/gg.c Thu Apr 30 23:43:54 2020 -0500
@@ -28,17 +28,7 @@
-#include "purpleaccountoption.h"
--- a/libpurple/protocols/jabber/gtalk.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/protocols/jabber/gtalk.c Thu Apr 30 23:43:54 2020 -0500
@@ -21,10 +21,7 @@
-#include "purpleaccountusersplit.h"
--- a/libpurple/protocols/jabber/jingle/rtp.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/protocols/jabber/jingle/rtp.c Thu Apr 30 23:43:54 2020 -0500
@@ -26,16 +26,15 @@
#include "google/google_p2p.h"
-#include "mediamanager.h"
--- a/libpurple/protocols/jabber/xmpp.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/protocols/jabber/xmpp.c Thu Apr 30 23:43:54 2020 -0500
@@ -21,10 +21,7 @@
-#include "purpleaccountusersplit.h"
--- a/libpurple/protocols/silc/silc.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/protocols/silc/silc.c Thu Apr 30 23:43:54 2020 -0500
@@ -18,13 +18,13 @@
PURPLE_BEGIN_IGNORE_CAST_ALIGN
PURPLE_END_IGNORE_CAST_ALIGN
--- a/libpurple/purpleaccountoption.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/purpleaccountoption.c Thu Apr 30 23:43:54 2020 -0500
@@ -20,9 +20,9 @@
#include "purpleaccountoption.h"
+#include "purplekeyvaluepair.h" * An option for an account.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purplekeyvaluepair.c Thu Apr 30 23:43:54 2020 -0500
@@ -0,0 +1,65 @@
+ * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. +#include "purplekeyvaluepair.h" +G_DEFINE_BOXED_TYPE(PurpleKeyValuePair, purple_key_value_pair, + purple_key_value_pair_copy, purple_key_value_pair_free); +purple_key_value_pair_new(const gchar *key, gpointer value) { + return purple_key_value_pair_new_full(key, value, NULL); +purple_key_value_pair_new_full(const gchar *key, gpointer value, + GDestroyNotify value_destroy_func) + PurpleKeyValuePair *kvp; + kvp = g_new0(PurpleKeyValuePair, 1); + kvp->key = g_strdup(key); + kvp->value_destroy_func = value_destroy_func; +purple_key_value_pair_free(PurpleKeyValuePair *kvp) { + g_return_if_fail(kvp != NULL); + if(kvp->value_destroy_func) { + kvp->value_destroy_func(kvp->value); +purple_key_value_pair_copy(PurpleKeyValuePair *kvp) { + g_return_val_if_fail(kvp != NULL, NULL); + return purple_key_value_pair_new_full(kvp->key, kvp->value, + kvp->value_destroy_func); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purplekeyvaluepair.h Thu Apr 30 23:43:54 2020 -0500
@@ -0,0 +1,120 @@
+ * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. +#ifndef PURPLE_KEY_VALUE_PAIR_H +#define PURPLE_KEY_VALUE_PAIR_H + * SECTION:purplekeyvaluepair + * @section_id: libpurple-key-value-pair + * @short_description: <filename>purplekeyvaluepair.h</filename> + * @title: Key Value Pairs +#define PURPLE_TYPE_KEY_VALUE_PAIR (purple_key_value_pair_get_type()) + * @value_destroy_func: A #GDestroyNotify to free @value when + * purple_key_value_pair_free() is called. + * This is used by, among other things, purple_gtk_combo* functions to pass in + * a list of key-value pairs so it can display a user-friendly value. +typedef struct _PurpleKeyValuePair PurpleKeyValuePair; +#include <glib-object.h> +struct _PurpleKeyValuePair { + GDestroyNotify value_destroy_func; + * purple_key_value_pair_get_type: + * The standard %_GET_TYPE function for #PurpleKeyValuePair. + * Returns: The #GType for #PurpleKeyValuePair. +GType purple_key_value_pair_get_type(void); + * purple_key_value_pair_new: + * @key: The key part of PurpleKeyValuePair + * @value: The value part of PurpleKeyValuePair + * Creates a new PurpleKeyValuePair allocating memory for @key, + * free value function is NULL. + * Returns: (transfer full): The created PurpleKeyValuePair +PurpleKeyValuePair *purple_key_value_pair_new(const gchar *key, gpointer value); + * purple_key_value_pair_new_full: + * @key: The key part of PurpleKeyValuePair + * @value: The value part of PurpleKeyValuePair + * @value_destroy_func: a function to free the memory for the @value + * Creates a new PurpleKeyValuePair allocating memory for @key, + * set free value function to @value_destroy_func. + * Returns: (transfer full): The created PurpleKeyValuePair +PurpleKeyValuePair *purple_key_value_pair_new_full(const gchar *key, gpointer value, GDestroyNotify value_destroy_func); + * purple_key_value_pair_free: + * @kvp: The PurpleKeyValuePair to free. +void purple_key_value_pair_free(PurpleKeyValuePair *kvp); + * purple_key_value_pair_copy: + * @kvp: The #PurpleKeyValuePair to copy. + * Creates a copy of @kvp. + * Returns: (transfer full): A new copy of @kvp. +PurpleKeyValuePair *purple_key_value_pair_copy(PurpleKeyValuePair *kvp); +#endif /* PURPLE_KEY_VALUE_PAIR_H */ --- a/libpurple/request.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/request.c Thu Apr 30 23:43:54 2020 -0500
@@ -24,6 +24,7 @@
+#include "purplekeyvaluepair.h" static PurpleRequestUiOps *request_ui_ops = NULL;
static GList *handles = NULL;
--- a/libpurple/util.c Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/util.c Thu Apr 30 23:43:54 2020 -0500
@@ -3782,43 +3782,6 @@
return g_string_free(string, FALSE);
-purple_key_value_pair_new(const char *key, gpointer value)
- PurpleKeyValuePair *kvp;
- kvp = g_new0(PurpleKeyValuePair, 1);
- kvp->key = g_strdup(key);
- kvp->value_destroy_func = NULL;
-purple_key_value_pair_new_full(const char *key, gpointer value, GDestroyNotify value_destroy_func)
- PurpleKeyValuePair *kvp = purple_key_value_pair_new(key, value);
- kvp->value_destroy_func = value_destroy_func;
-purple_key_value_pair_free(PurpleKeyValuePair *kvp)
- g_return_if_fail(kvp != NULL);
- if (kvp->value_destroy_func) {
- kvp->value_destroy_func(kvp->value);
--- a/libpurple/util.h Thu Apr 30 20:57:31 2020 -0500
+++ b/libpurple/util.h Thu Apr 30 23:43:54 2020 -0500
@@ -33,18 +33,6 @@
- * This is used by, among other things, purple_gtk_combo* functions to pass in a
- * list of key-value pairs so it can display a user-friendly value.
-typedef struct _PurpleKeyValuePair PurpleKeyValuePair;
@@ -54,13 +42,6 @@
typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len);
-struct _PurpleKeyValuePair
- GDestroyNotify value_destroy_func;
@@ -88,45 +69,6 @@
char * purple_util_format_song_info(const char *title, const char *artist,
const char *album, gpointer unused);
- * purple_key_value_pair_new:
- * @key: The key part of PurpleKeyValuePair
- * @value: The value part of PurpleKeyValuePair
- * Creates a new PurpleKeyValuePair allocating memory for @key,
- * free value function is NULL.
- * Returns: The created PurpleKeyValuePair
-PurpleKeyValuePair *purple_key_value_pair_new(const char *key, gpointer value);
- * purple_key_value_pair_new_full:
- * @key: The key part of PurpleKeyValuePair
- * @value: The value part of PurpleKeyValuePair
- * @value_destroy_func: a function to free the memory for the @value
- * Creates a new PurpleKeyValuePair allocating memory for @key,
- * set free value function to @value_destroy_func.
- * Returns: The created PurpleKeyValuePair
-PurpleKeyValuePair *purple_key_value_pair_new_full(const char *key, gpointer value, GDestroyNotify value_destroy_func);
- * purple_key_value_pair_free:
- * @kvp: The PurpleKeyValuePair to free.
-void purple_key_value_pair_free(PurpleKeyValuePair *kvp);
/**************************************************************************/
/**************************************************************************/
--- a/pidgin/gtkaccount.c Thu Apr 30 20:57:31 2020 -0500
+++ b/pidgin/gtkaccount.c Thu Apr 30 23:43:54 2020 -0500
@@ -22,18 +22,7 @@
-#include "purpleaccountoption.h"
-#include "savedstatuses.h"
--- a/pidgin/gtkprefs.c Thu Apr 30 20:57:31 2020 -0500
+++ b/pidgin/gtkprefs.c Thu Apr 30 23:43:54 2020 -0500
@@ -24,22 +24,7 @@
-#include "savedstatuses.h"
-#include "sound-theme.h"
-#include "theme-manager.h"
--- a/pidgin/gtkrequest.c Thu Apr 30 20:57:31 2020 -0500
+++ b/pidgin/gtkrequest.c Thu Apr 30 23:43:54 2020 -0500
@@ -24,9 +24,7 @@