/soc/2013/ankitkv/gobjectification: 5acc823db81d: Added GBoxed w...

Ankit Vani a at nevitus.org
Mon Jul 8 16:08:40 EDT 2013


Changeset: 5acc823db81d02839a8f5942cc09c9e198898bc7
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-09 01:38 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/5acc823db81d

Description:

Added GBoxed wrapping to PurpleBuddyList

diffstat:

 libpurple/buddylist.c |  23 +++++++++++++++++++++++
 libpurple/buddylist.h |   9 ++++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)

diffs (63 lines):

diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -2453,3 +2453,26 @@ purple_blist_uninit(void)
 	purple_signals_disconnect_by_handle(purple_blist_get_handle());
 	purple_signals_unregister_by_instance(purple_blist_get_handle());
 }
+
+static PurpleBuddyList *
+purple_buddy_list_copy(PurpleBuddyList *blist)
+{
+	PurpleBuddyList *newlist = g_new(PurpleBuddyList, 1);
+	*newlist = *blist;
+
+	return newlist;
+}
+
+GType
+purple_buddy_list_get_type(void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PurpleBuddyList",
+				(GBoxedCopyFunc)purple_buddy_list_copy,
+				(GBoxedFreeFunc)g_free);
+	}
+
+	return type;
+}
diff --git a/libpurple/buddylist.h b/libpurple/buddylist.h
--- a/libpurple/buddylist.h
+++ b/libpurple/buddylist.h
@@ -31,6 +31,8 @@
 
 #include "blistnodetypes.h"
 
+#define PURPLE_TYPE_BUDDY_LIST  (purple_buddy_list_get_type())
+
 /** @copydoc _PurpleBuddyList */
 typedef struct _PurpleBuddyList PurpleBuddyList;
 /** @copydoc _PurpleBListUiOps */
@@ -40,7 +42,7 @@ typedef struct _PurpleBListUiOps PurpleB
 /* Data Structures                                                        */
 /**************************************************************************/
 
-/** TODO GBoxed
+/**
  * The Buddy List
  */
 struct _PurpleBuddyList {
@@ -122,6 +124,11 @@ G_BEGIN_DECLS
 /*@{*/
 /* TODO move node methods to appropriate nodes */
 /**
+ * Returns the GType for the PurpleBuddyList boxed structure.
+ */
+GType purple_buddy_list_get_type(void);
+
+/**
  * Returns the main buddy list.
  *
  * @return The main buddy list.



More information about the Commits mailing list