Added GObject boilerplate code for headers, also _new() and _get_type() functions. soc.2013.gobjectification

Sat, 22 Jun 2013 19:15:06 +0530

author
Ankit Vani <a@nevitus.org>
date
Sat, 22 Jun 2013 19:15:06 +0530
branch
soc.2013.gobjectification
changeset 34609
28b0f26f011f
parent 34608
3feba564faed
child 34610
56e8d15f249f

Added GObject boilerplate code for headers, also _new() and _get_type() functions.

libpurple/conversation.h file | annotate | diff | comparison | revisions
libpurple/conversationtypes.h file | annotate | diff | comparison | revisions
libpurple/plugins/perl/common/Conversation.xs file | annotate | diff | comparison | revisions
--- a/libpurple/conversation.h	Sat Jun 22 17:20:09 2013 +0530
+++ b/libpurple/conversation.h	Sat Jun 22 19:15:06 2013 +0530
@@ -26,6 +26,13 @@
 #ifndef _PURPLE_CONVERSATION_H_
 #define _PURPLE_CONVERSATION_H_
 
+#define PURPLE_TYPE_CONVERSATION             (purple_conversation_get_type())
+#define PURPLE_CONVERSATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CONVERSATION, PurpleConversation))
+#define PURPLE_CONVERSATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CONVERSATION, PurpleConversationClass))
+#define PURPLE_IS_CONVERSATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CONVERSATION))
+#define PURPLE_IS_CONVERSATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CONVERSATION))
+#define PURPLE_CONVERSATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CONVERSATION, PurpleConversationClass))
+
 /**************************************************************************/
 /** Data Structures                                                       */
 /**************************************************************************/
@@ -242,19 +249,10 @@
 /**************************************************************************/
 /*@{*/
 
-/** TODO GObjectify
- * Creates a new conversation of the specified type.
- *
- * @param type    The type of conversation.
- * @param account The account opening the conversation window on the purple
- *                user's end.
- * @param name    The name of the conversation. For PURPLE_CONVERSATION_TYPE_IM,
- *                this is the name of the buddy.
- *
- * @return The new conversation.
+/** TODO
+ * Returns the GType for the Conversation object.
  */
-PurpleConversation *purple_conversation_new(GType type, PurpleAccount *account,
-		const char *name);
+GType purple_conversation_get_type(void);
 
 /** TODO dispose/fnalize
  * Destroys the specified conversation and removes it from the parent
@@ -267,7 +265,6 @@
  */
 void purple_conversation_destroy(PurpleConversation *conv);
 
-
 /**
  * Present a conversation to the user. This allows core code to initiate a
  * conversation by displaying the IM dialog.
@@ -275,16 +272,6 @@
  */
 void purple_conversation_present(PurpleConversation *conv);
 
-
-/** TODO REMOVE, return the GObject GType
- * Returns the specified conversation's type.
- *
- * @param conv The conversation.
- *
- * @return The conversation's type.
- */
-/*PurpleConversationType purple_conversation_get_type(const PurpleConversation *conv);*/
-
 /**
  * Sets the specified conversation's UI operations structure.
  *
--- a/libpurple/conversationtypes.h	Sat Jun 22 17:20:09 2013 +0530
+++ b/libpurple/conversationtypes.h	Sat Jun 22 19:15:06 2013 +0530
@@ -30,16 +30,61 @@
 /** Data Structures                                                       */
 /**************************************************************************/
 
+#define PURPLE_TYPE_IM_CONVERSATION       (purple_im_conversation_get_type())
+#define PURPLE_IM_CONVERSATION(obj)       (G_TYPE_CHECK_INSTANCE_CAST((obj),  \
+                                           PURPLE_TYPE_IM_CONVERSATION,       \
+                                           PurpleIMConversation))
+#define PURPLE_IM_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
+                                           PURPLE_TYPE_IM_CONVERSATION,       \
+                                           PurpleIMConversationClass))
+#define PURPLE_IS_IM_CONVERSATION(obj)    (G_TYPE_CHECK_INSTANCE_TYPE((obj),  \
+                                           PURPLE_TYPE_IM_CONVERSATION))
+#define PURPLE_IS_IM_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
+                                           PURPLE_TYPE_IM_CONVERSATION))
+#define PURPLE_IM_CONVERSATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),\
+                                           PURPLE_TYPE_IM_CONVERSATION,       \
+                                           PurpleIMConversationClass))
+
 /** @copydoc _PurpleIMConversation */
 typedef struct _PurpleIMConversation         PurpleIMConversation;
 /** @copydoc _PurpleIMConversationClass */
 typedef struct _PurpleIMConversationClass    PurpleIMConversationClass;
 
+#define PURPLE_TYPE_CHAT_CONVERSATION     (purple_chat_conversation_get_type())
+#define PURPLE_CHAT_CONVERSATION(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj),  \
+                                           PURPLE_TYPE_CHAT_CONVERSATION,     \
+                                           PurpleChatConversation))
+#define PURPLE_CHAT_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION,     \
+                                           PurpleChatConversationClass))
+#define PURPLE_IS_CHAT_CONVERSATION(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj),  \
+                                           PURPLE_TYPE_CHAT_CONVERSATION))
+#define PURPLE_IS_CHAT_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION))
+#define PURPLE_CHAT_CONVERSATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION,     \
+                                           PurpleChatConversationClass))
+
 /** @copydoc _PurpleChatConversation */
 typedef struct _PurpleChatConversation       PurpleChatConversation;
 /** @copydoc _PurpleChatConversationClass */
 typedef struct _PurpleChatConversationClass  PurpleChatConversationClass;
 
+#define PURPLE_TYPE_CHAT_CONVERSATION_BUDDY (purple_chat_conversation_buddy_get_type())
+#define PURPLE_CHAT_CONVERSATION_BUDDY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+                                           PURPLE_TYPE_CHAT_CONVERSATION_BUDDY,\
+                                           PurpleChatConversationBuddy))
+#define PURPLE_CHAT_CONVERSATION_BUDDY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION_BUDDY,\
+                                           PurpleChatConversationBuddyClass))
+#define PURPLE_IS_CHAT_CONVERSATION_BUDDY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION_BUDDY))
+#define PURPLE_IS_CHAT_CONVERSATION_BUDDY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION_BUDDY))
+#define PURPLE_CHAT_CONVERSATION_BUDDY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),\
+                                           PURPLE_TYPE_CHAT_CONVERSATION_BUDDY,\
+                                           PurpleChatConversationBuddyClass))
+
 /** @copydoc _PurpleChatConversationBuddy */
 typedef struct _PurpleChatConversationBuddy       PurpleChatConversationBuddy;
 /** @copydoc _PurpleChatConversationBuddyClass */
@@ -158,6 +203,23 @@
 /**************************************************************************/
 /*@{*/
 
+/** TODO
+ * Returns the GType for the IMConversation object.
+ */
+GType purple_im_conversation_get_type(void);
+
+/** TODO take from conversation.c purple_conversation_new()
+ * Creates a new IM conversation.
+ *
+ * @param account The account opening the conversation window on the purple
+ *                user's end.
+ * @param name    Name of the buddy.
+ *
+ * @return The new conversation.
+ */
+PurpleIMConversation *purple_im_conversation_new(PurpleAccount *account,
+		const char *name);
+
 /**
  * Sets the IM's buddy icon.
  *
@@ -313,6 +375,23 @@
 /**************************************************************************/
 /*@{*/
 
+/** TODO
+ * Returns the GType for the ChatConversation object.
+ */
+GType purple_chat_conversation_get_type(void);
+
+/** TODO take from conversation.c purple_conversation_new()
+ * Creates a new chat conversation.
+ *
+ * @param account The account opening the conversation window on the purple
+ *                user's end.
+ * @param name    The name of the conversation.
+ *
+ * @return The new conversation.
+ */
+PurpleChatConversation *purple_chat_conversation_new(PurpleAccount *account,
+		const char *name);
+
 /**
  * Returns a list of users in the chat room.  The members of the list
  * are PurpleChatConversationBuddy objects.
@@ -622,6 +701,11 @@
 /**************************************************************************/
 /*@{*/
 
+/** TODO
+ * Returns the GType for the ChatConversationBuddy object.
+ */
+GType purple_chat_conversation_buddy_get_type(void);
+
 /**
  * Get an attribute of a chat buddy
  *
--- a/libpurple/plugins/perl/common/Conversation.xs	Sat Jun 22 17:20:09 2013 +0530
+++ b/libpurple/plugins/perl/common/Conversation.xs	Sat Jun 22 19:15:06 2013 +0530
@@ -183,14 +183,6 @@
 	Purple::Conversation conv
 	Purple::Conversation::UpdateType type
 
-Purple::Conversation
-purple_conversation_new(class, type, account, name)
-	GType type
-	Purple::Account account
-	const char *name
-    C_ARGS:
-	type, account, name
-
 void
 purple_conversation_set_account(conv, account);
 	Purple::Conversation conv
@@ -214,6 +206,13 @@
 MODULE = Purple::Conversation  PACKAGE = Purple::IMConversation  PREFIX = purple_im_conversation_
 PROTOTYPES: ENABLE
 
+Purple::IMConversation
+purple_im_conversation_new(class, account, name)
+	Purple::Account account
+	const char *name
+    C_ARGS:
+	account, name
+
 void
 purple_im_conversation_set_icon(im, icon)
 	Purple::IMConversation im
@@ -309,6 +308,13 @@
 MODULE = Purple::Conversation  PACKAGE = Purple::ChatConversation  PREFIX = purple_chat_conversation_
 PROTOTYPES: ENABLE
 
+Purple::ChatConversation
+purple_chat_conversation_new(class, account, name)
+	Purple::Account account
+	const char *name
+    C_ARGS:
+	account, name
+
 void
 purple_chat_conversation_get_users(chat)
 	Purple::ChatConversation chat

mercurial