/pidgin/main: d06ccc815e2f: Box PidginConversation

Ankit Vani a at nevitus.org
Fri Feb 28 05:31:54 EST 2014


Changeset: d06ccc815e2f73bcf80dbe35dc9f1931eee8d2b5
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-02-28 15:53 +0530
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/d06ccc815e2f

Description:

Box PidginConversation

diffstat:

 pidgin/gtkconv.c |  37 +++++++++++++++++++++++++++++
 pidgin/gtkconv.h |  71 +++++++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 97 insertions(+), 11 deletions(-)

diffs (198 lines):

diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -9083,6 +9083,43 @@ pidgin_conversations_uninit(void)
 	purple_signals_unregister_by_instance(pidgin_conversations_get_handle());
 }
 
+/**************************************************************************
+ * PidginConversation GBoxed code
+ **************************************************************************/
+static PidginConversation *
+pidgin_conversation_ref(PidginConversation *gtkconv)
+{
+	g_return_val_if_fail(gtkconv != NULL, NULL);
+
+	gtkconv->box_count++;
+
+	return gtkconv;
+}
+
+static void
+pidgin_conversation_unref(PidginConversation *gtkconv)
+{
+	g_return_if_fail(gtkconv != NULL);
+	g_return_if_fail(gtkconv->box_count >= 0);
+
+	if (!gtkconv->box_count--)
+		pidgin_conv_destroy(gtkconv->active_conv);
+}
+
+GType
+pidgin_conversation_get_type(void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PidginConversation",
+				(GBoxedCopyFunc)pidgin_conversation_ref,
+				(GBoxedFreeFunc)pidgin_conversation_unref);
+	}
+
+	return type;
+}
+
 
 
 
diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h
--- a/pidgin/gtkconv.h
+++ b/pidgin/gtkconv.h
@@ -29,6 +29,8 @@
  * @see_also: <link linkend="chapter-signals-gtkconv">Conversation signals</link>
  */
 
+#define PIDGIN_TYPE_CONVERSATION (pidgin_conversation_get_type())
+
 typedef struct _PidginImPane       PidginImPane;
 typedef struct _PidginChatPane     PidginChatPane;
 typedef struct _PidginConversation PidginConversation;
@@ -87,6 +89,8 @@ enum {
  */
 struct _PidginConversation
 {
+	gint box_count;
+
 	PurpleConversation *active_conv;
 	PurpleConversation *last_conversed;
 	GList *convs;
@@ -156,6 +160,13 @@ G_BEGIN_DECLS
  **************************************************************************/
 
 /**
+ * pidgin_conversation_get_type:
+ *
+ * Returns: The #GType for the #PidginConversation boxed structure.
+ */
+GType pidgin_conversation_get_type(void);
+
+/**
  * pidgin_conversations_get_conv_ui_ops:
  *
  * Returns the UI operations structure for GTK+ conversations.
@@ -200,9 +211,9 @@ void pidgin_conv_update_buttons_by_proto
 /**
  * pidgin_conversations_get_unseen_all:
  * @min_state:    The minimum unseen state.
- * @hidden_only:  If TRUE, only consider hidden conversations.
+ * @hidden_only:  If %TRUE, only consider hidden conversations.
  * @max_count:    Maximum number of conversations to return, or 0 for
- *                     no maximum.
+ *                no maximum.
  *
  * Returns a list of conversations of any type which have an unseen
  * state greater than or equal to the specified minimum state. Using the
@@ -211,7 +222,7 @@ void pidgin_conv_update_buttons_by_proto
  * converations returned if greater than zero. The returned list should
  * be freed by the caller.
  *
- * Returns:             List of PurpleConversation matching criteria, or %NULL.
+ * Returns: List of PurpleConversation matching criteria, or %NULL.
  */
 GList *
 pidgin_conversations_get_unseen_all(PidginUnseenState min_state,
@@ -221,9 +232,9 @@ pidgin_conversations_get_unseen_all(Pidg
 /**
  * pidgin_conversations_get_unseen_ims:
  * @min_state:    The minimum unseen state.
- * @hidden_only:  If TRUE, only consider hidden conversations.
+ * @hidden_only:  If %TRUE, only consider hidden conversations.
  * @max_count:    Maximum number of conversations to return, or 0 for
- *                     no maximum.
+ *                no maximum.
  *
  * Returns a list of IM conversations which have an unseen state greater
  * than or equal to the specified minimum state. Using the hidden_only
@@ -232,8 +243,7 @@ pidgin_conversations_get_unseen_all(Pidg
  * returned if greater than zero. The returned list should be freed by the
  * caller.
  *
- * Returns:             List of PurpleIMConversation matching criteria,
- *                     or %NULL.
+ * Returns: List of PurpleIMConversation matching criteria, or %NULL.
  */
 GList *
 pidgin_conversations_get_unseen_ims(PidginUnseenState min_state,
@@ -243,9 +253,9 @@ pidgin_conversations_get_unseen_ims(Pidg
 /**
  * pidgin_conversations_get_unseen_chats:
  * @min_state:    The minimum unseen state.
- * @hidden_only:  If TRUE, only consider hidden conversations.
+ * @hidden_only:  If %TRUE, only consider hidden conversations.
  * @max_count:    Maximum number of conversations to return, or 0 for
- *                     no maximum.
+ *                no maximum.
  *
  * Returns a list of chat conversations which have an unseen state greater
  * than or equal to the specified minimum state. Using the hidden_only
@@ -254,8 +264,7 @@ pidgin_conversations_get_unseen_ims(Pidg
  * returned if greater than zero. The returned list should be freed by the
  * caller.
  *
- * Returns:             List of PurpleChatConversation matching criteria,
- *                     or NULL.
+ * Returns: List of PurpleChatConversation matching criteria, or %NULL.
  */
 GList *
 pidgin_conversations_get_unseen_chats(PidginUnseenState min_state,
@@ -293,10 +302,50 @@ void pidgin_conv_present_conversation(Pu
  */
 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv);
 
+/**
+ * pidgin_conv_get_window:
+ * @gtkconv: The GTK+ conversation.
+ *
+ * Returns: The window the conversation belongs to.
+ */
 PidginConvWindow *pidgin_conv_get_window(PidginConversation *gtkconv);
+
+/**
+ * pidgin_conv_get_tab_icon:
+ * @conv:       The conversation.
+ * @small_icon: Whether to get the small icon.
+ *
+ * Returns: The tab icon.
+ */
 GdkPixbuf *pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon);
+
+/**
+ * pidgin_conv_new:
+ * @conv: The conversation.
+ *
+ * Creates a new GTK+ conversation for a given #PurpleConversation.
+ */
 void pidgin_conv_new(PurpleConversation *conv);
+
+/**
+ * pidgin_conv_get_tab_at_xy:
+ * @win:      The conversation window.
+ * @x:        X-coordinate to look up.
+ * @y:        Y-coordinate to look up.
+ * @to_right: (out): Return address for a boolean which will be %TRUE if the
+ *            coordinates are on the right side of the tab (or bottom in case of
+ *            a vertical notebook), %FALSE otherwise.
+ *
+ * Returns: The tab index of a conversation in @win at (@x, @y).
+ */
 int pidgin_conv_get_tab_at_xy(PidginConvWindow *win, int x, int y, gboolean *to_right);
+
+/**
+ * pidgin_conv_is_hidden:
+ * @gtkconv: The GTK+ conversation.
+ *
+ * Returns: %TRUE if the conversation is hidden, %FALSE otherwise.
+ */
 gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv);
 
 /**************************************************************************/



More information about the Commits mailing list