/soc/2013/ankitkv/gobjectification: 56e06ab47188: Made PurpleCon...
Ankit Vani
a at nevitus.org
Fri Jun 28 17:45:22 EDT 2013
Changeset: 56e06ab47188e737d6dc08095e4b1d919e17eacc
Author: Ankit Vani <a at nevitus.org>
Date: 2013-06-29 03:15 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/56e06ab47188
Description:
Made PurpleConversationMessage a GBoxed
diffstat:
libpurple/conversation.c | 38 +++++++++++++++++++++++++++++++++++++-
libpurple/conversation.h | 5 +++++
2 files changed, 42 insertions(+), 1 deletions(-)
diffs (70 lines):
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -65,7 +65,7 @@ struct _PurpleConversationPrivate
GList *message_history; /**< Message history, as a GList of PurpleConversationMessage's */
};
-/** TODO GBoxed
+/**
* Description of a conversation message
*/
struct _PurpleConversationMessage
@@ -850,6 +850,42 @@ PurpleConversation *purple_conversation_
return msg->conv;
}
+static PurpleConversationMessage *
+purple_conversation_message_copy(PurpleConversationMessage *msg)
+{
+ PurpleConversationMessage *newmsg = g_new(PurpleConversationMessage, 1);
+ *newmsg = *msg;
+ newmsg->who = g_strdup(msg->who);
+ newmsg->what = g_strdup(msg->what);
+ newmsg->alias = g_strdup(msg->alias);
+
+ return newmsg;
+}
+
+static void
+purple_conversation_message_free(PurpleConversationMessage *msg)
+{
+ g_free(msg->who);
+ g_free(msg->what);
+ g_free(msg->alias);
+
+ g_free(msg);
+}
+
+GType
+purple_conversation_message_get_type(void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ type = g_boxed_type_register_static("PurpleConversationMessage",
+ (GBoxedCopyFunc)purple_conversation_message_copy,
+ (GBoxedFreeFunc)purple_conversation_message_free);
+ }
+
+ return type;
+}
+
void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data)
{
PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv);
diff --git a/libpurple/conversation.h b/libpurple/conversation.h
--- a/libpurple/conversation.h
+++ b/libpurple/conversation.h
@@ -658,6 +658,11 @@ gboolean purple_conversation_helper_pres
/*@{*/
/**
+ * Returns the GType for the PurpleConversationMessage boxed structure.
+ */
+GType purple_conversation_message_get_type(void);
+
+/**
* Get the sender from a PurpleConversationMessage
*
* @param msg A PurpleConversationMessage
More information about the Commits
mailing list