gobjectification: 73111921: Starting gobject on blist

aluink at soc.pidgin.im aluink at soc.pidgin.im
Tue Jun 23 00:15:32 EDT 2009


-----------------------------------------------------------------
Revision: 731119219643d9640f3a88bb08e456bd5e1d84ab
Ancestor: ea249c11e7db598e9f5065f1108f036aafaf902b
Author: aluink at soc.pidgin.im
Date: 2009-06-22T17:02:29
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/731119219643d9640f3a88bb08e456bd5e1d84ab

Modified files:
        libpurple/blist-node.c libpurple/blist.h

ChangeLog: 

Starting gobject on blist

-------------- next part --------------
============================================================
--- libpurple/blist-node.c	012ebcef37b491e77286755a9c9ae5b67424ea86
+++ libpurple/blist-node.c	480b46f9e12bcac2bf8847e5197a863306b13b80
@@ -633,3 +633,48 @@ purple_blist_node_get_extended_menu(Purp
 			n, &menu);
 	return menu;
 }
+
+/******************/
+/*  GObject Code  */
+/******************/
+
+static void
+purple_blist_node_class_init(PurpleBlistNodeClass *klass)
+{
+
+}
+
+static void
+purple_blist_node_init(GTypeInstance *instance, gpointer class)
+{
+
+}
+
+GType
+purple_blist_node_get_gtype(void)
+{
+	static GType type = 0;
+
+	if(type == 0) {
+		static const GTypeInfo info = {
+			sizeof(PurpleBlistNodeClass),
+			NULL,					/* base_init		*/
+			NULL,					/* base_finalize	*/
+			(GClassInitFunc)purple_blist_node_class_init,
+			NULL,
+			NULL,					/* class_data		*/
+			sizeof(PurpleBlistNode),
+			0,						/* n_preallocs		*/
+			purple_blist_node_init,					/* instance_init	*/
+			NULL					/* value_table		*/
+		};
+
+		type = g_type_register_static(PURPLE_BLIST_NODE_TYPE,
+									  "PurpleBlistNode",
+									  &info, G_TYPE_FLAG_ABSTRACT);
+	}
+
+	return type;
+}
+
+
============================================================
--- libpurple/blist.h	933584f74e0bda74d03dfb0311c4ef52e01cebed
+++ libpurple/blist.h	025b23b1e0e43ac016fe9b51d71dbc6dd470b453
@@ -37,6 +37,7 @@ typedef struct _PurpleBlistNode PurpleBl
 typedef struct _PurpleBlistUiOps PurpleBlistUiOps;
 /** @copydoc _PurpleBlistNode */
 typedef struct _PurpleBlistNode PurpleBlistNode;
+typedef struct _PurpleBlistNodeClass PurpleBlistNodeClass;
 
 /** @copydoc _PurpleChat */
 typedef struct _PurpleChat PurpleChat;
@@ -78,8 +79,6 @@ typedef enum
 /**
  * @since 2.6.0
  */
-#define PURPLE_BLIST_NODE(obj) ((PurpleBlistNode *)(obj))
-
 #define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f))
 #define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE))
 
@@ -106,6 +105,26 @@ typedef enum
  */
 #define PURPLE_CHAT(obj) ((PurpleChat *)(obj))
 
+/* Template */
+/*
+#define MAMAN_TYPE                  (maman_get_type ())
+#define MAMAN(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE, Maman))
+#define MAMAN_IS(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE))
+#define MAMAN_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE, MamanClass))
+#define MAMAN_IS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE))
+#define MAMAN_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE, MamanClass))
+*/
+
+/* GObject macros */
+
+#define PURPLE_BLIST_NODE_TYPE                  (purple_blist_node_get_gtype ())
+#define PURPLE_BLIST_NODE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), PURPLE_BLIST_NODE_TYPE, PurpleBlistNode))
+#define PURPLE_BLIST_NODE_IS(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PURPLE_BLIST_NODE_TYPE))
+#define PURPLE_BLIST_NODE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_BLIST_NODE_TYPE, PurpleBlistNodeClass))
+#define PURPLE_BLIST_NODE_IS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_BLIST_NODE_TYPE))
+#define PURPLE_BLIST_NODE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_BLIST_NODE_TYPE, PurpleBlistNodeClass))
+
+
 #include "account.h"
 #include "buddyicon.h"
 #include "status.h"
@@ -121,6 +140,7 @@ struct _PurpleBlistNode {
  * This is a base class for PurpleBuddy, PurpleContact, PurpleGroup, and for
  * anything else that wants to put itself in the buddy list. */
 struct _PurpleBlistNode {
+  GObject _parent;
 	PurpleBlistNodeType type;             /**< The type of node this is       */
 	PurpleBlistNode *prev;                /**< The sibling before this buddy. */
 	PurpleBlistNode *next;                /**< The sibling after this buddy.  */
@@ -137,6 +157,10 @@ struct _PurpleBlistNode {
 	PurpleBlistNodeFlags flags;           /**< The buddy flags                */
 };
 
+struct _PurpleBlistNodeClass {
+  GObjectClass parent;
+};
+
 /**
  * A buddy.  This contains everything Purple will ever need to know about someone on the buddy list.  Everything.
  */
@@ -1256,6 +1280,11 @@ void purple_blist_uninit(void);
  */
 void purple_blist_uninit(void);
 
+/**
+ * Get the GType for PurpleBlistNode
+ */
+GType purple_blist_node_get_gtype(void);
+
 /*@}*/
 
 #ifdef __cplusplus


More information about the Commits mailing list