pidgin/pidgin

Parents 7aa6153abf4d
Children 1b0fa96b5ca3
Remove ui_data from PurpleConversation and move finch and pidgin to g_object_[gs]et_data.

Testing Done:
Compiled and ran pidgin, but didn't run finch.

Reviewed at https://reviews.imfreedom.org/r/467/
--- a/finch/gntconv.c Sat Jan 30 01:30:00 2021 -0600
+++ b/finch/gntconv.c Sat Jan 30 01:31:44 2021 -0600
@@ -380,11 +380,13 @@
static void
conv_updated(PurpleConversation *conv, PurpleConversationUpdateType type)
{
- if (purple_conversation_get_ui_data(conv) == NULL)
+ FinchConv *finch_conv = FINCH_CONV(conv);
+ if(finch_conv == NULL) {
return;
+ }
- if (type == PURPLE_CONVERSATION_UPDATE_FEATURES) {
- gg_extended_menu(purple_conversation_get_ui_data(conv));
+ if(type == PURPLE_CONVERSATION_UPDATE_FEATURES) {
+ gg_extended_menu(finch_conv);
return;
}
}
@@ -748,7 +750,7 @@
ggc->list = g_list_prepend(ggc->list, conv);
ggc->active_conv = conv;
- purple_conversation_set_ui_data(conv, ggc);
+ g_object_set_data(G_OBJECT(conv), "finch", ggc);
if (cc && FINCH_CONV(cc) && cc != conv) {
finch_conversation_set_active(conv);
--- a/finch/gntconv.h Sat Jan 30 01:30:00 2021 -0600
+++ b/finch/gntconv.h Sat Jan 30 01:31:44 2021 -0600
@@ -39,7 +39,7 @@
#include <purple.h>
/* Grabs the conv out of a PurpleConverstation */
-#define FINCH_CONV(conv) ((FinchConv *)purple_conversation_get_ui_data(conv))
+#define FINCH_CONV(conv) ((FinchConv *)g_object_get_data(G_OBJECT(conv), "finch"))
/***************************************************************************
* GNT Conversations API
--- a/libpurple/conversation.c Sat Jan 30 01:30:00 2021 -0600
+++ b/libpurple/conversation.c Sat Jan 30 01:31:44 2021 -0600
@@ -762,20 +762,6 @@
return priv->message_history;
}
-void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data)
-{
- g_return_if_fail(PURPLE_IS_CONVERSATION(conv));
-
- conv->ui_data = ui_data;
-}
-
-gpointer purple_conversation_get_ui_data(const PurpleConversation *conv)
-{
- g_return_val_if_fail(PURPLE_IS_CONVERSATION(conv), NULL);
-
- return conv->ui_data;
-}
-
gboolean
purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline,
const gchar *markup, gchar **error)
--- a/libpurple/conversation.h Sat Jan 30 01:30:00 2021 -0600
+++ b/libpurple/conversation.h Sat Jan 30 01:31:44 2021 -0600
@@ -135,9 +135,6 @@
struct _PurpleConversation
{
GObject gparent;
-
- /*< public >*/
- gpointer ui_data;
};
/**
@@ -516,31 +513,6 @@
void purple_conversation_clear_message_history(PurpleConversation *conv);
/**
- * purple_conversation_set_ui_data:
- * @conv: The conversation.
- * @ui_data: A pointer to associate with this conversation.
- *
- * Set the UI data associated with this conversation.
- *
- * Since: 3.0.0
- */
-void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data);
-
-/**
- * purple_conversation_get_ui_data:
- * @conv: The conversation.
- *
- * Get the UI data associated with this conversation.
- *
- * Returns: (transfer none): The UI data associated with this conversation.
- * This is a convenience field provided to the UIs--it is not
- * used by the libpurple core.
- *
- * Since: 3.0.0
- */
-gpointer purple_conversation_get_ui_data(const PurpleConversation *conv);
-
-/**
* purple_conversation_send_confirm:
* @conv: The conversation.
* @message: The message to send.
--- a/pidgin/gtkconv.c Sat Jan 30 01:30:00 2021 -0600
+++ b/pidgin/gtkconv.c Sat Jan 30 01:31:44 2021 -0600
@@ -4103,7 +4103,7 @@
PurpleBlistNode *convnode;
if (PURPLE_IS_IM_CONVERSATION(conv) && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
- purple_conversation_set_ui_data(conv, gtkconv);
+ g_object_set_data(G_OBJECT(conv), "pidgin", gtkconv);
if (!g_list_find(gtkconv->convs, conv))
gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
pidgin_conv_switch_active_conversation(conv);
@@ -4111,7 +4111,7 @@
}
gtkconv = g_new0(PidginConversation, 1);
- purple_conversation_set_ui_data(conv, gtkconv);
+ g_object_set_data(G_OBJECT(conv), "pidgin", gtkconv);
gtkconv->active_conv = conv;
gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
gtkconv->send_history = g_list_append(NULL, NULL);
@@ -4135,7 +4135,7 @@
g_free(gtkconv->u.im);
g_free(gtkconv);
- purple_conversation_set_ui_data(conv, NULL);
+ g_object_set_data(G_OBJECT(conv), "pidgin", NULL);
return;
}
--- a/pidgin/gtkconv.h Sat Jan 30 01:30:00 2021 -0600
+++ b/pidgin/gtkconv.h Sat Jan 30 01:31:44 2021 -0600
@@ -69,7 +69,7 @@
};
#define PIDGIN_CONVERSATION(conv) \
- ((PidginConversation *)purple_conversation_get_ui_data(conv))
+ ((PidginConversation *)g_object_get_data(G_OBJECT(conv), "pidgin"))
#define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \
(purple_conversation_get_ui_ops(conv) == \