/soc/2013/ankitkv/gobjectification: edbea75bd68f: Merged default...

Ankit Vani a at nevitus.org
Mon Mar 31 05:09:41 EDT 2014


Changeset: edbea75bd68f8ed46d16ff1351b62341cd1ff90c
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-03-31 14:39 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/edbea75bd68f

Description:

Merged default branch

diffstat:

 pidgin/gtksmiley.c  |  35 +++++++++++++++++++++++++++++++++++
 pidgin/gtksmiley.h  |   9 +++++++++
 pidgin/gtkwebview.c |  39 +++++++++++++++++++++++++++++++++++++++
 pidgin/gtkwebview.h |  13 ++++++++++---
 pidgin/gtkxfer.c    |  39 +++++++++++++++++++++++++++++++++++++++
 pidgin/gtkxfer.h    |   9 +++++++++
 6 files changed, 141 insertions(+), 3 deletions(-)

diffs (248 lines):

diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c
--- a/pidgin/gtksmiley.c
+++ b/pidgin/gtksmiley.c
@@ -39,6 +39,7 @@
 
 struct _PidginSmiley
 {
+	gint box_count;
 	PurpleSmiley *smiley;
 	GtkWidget *parent;
 	GtkWidget *smile;
@@ -82,6 +83,40 @@ pidgin_smiley_destroy(PidginSmiley *smil
 	g_free(smiley);
 }
 
+static PidginSmiley *
+pidgin_smiley_ref(PidginSmiley *smiley)
+{
+	g_return_val_if_fail(smiley != NULL, NULL);
+
+	smiley->box_count++;
+
+	return smiley;
+}
+
+static void
+pidgin_smiley_unref(PidginSmiley *smiley)
+{
+	g_return_if_fail(smiley != NULL);
+	g_return_if_fail(smiley->box_count >= 0);
+
+	if (!smiley->box_count--)
+		pidgin_smiley_destroy(smiley);
+}
+
+GType
+pidgin_smiley_get_type(void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PidginSmiley",
+				(GBoxedCopyFunc)pidgin_smiley_ref,
+				(GBoxedFreeFunc)pidgin_smiley_unref);
+	}
+
+	return type;
+}
+
 /******************************************************************************
  * PidginWebViewSmileys stuff
  *****************************************************************************/
diff --git a/pidgin/gtksmiley.h b/pidgin/gtksmiley.h
--- a/pidgin/gtksmiley.h
+++ b/pidgin/gtksmiley.h
@@ -30,11 +30,20 @@
 
 #include "smiley.h"
 
+#define PIDGIN_TYPE_SMILEY (pidgin_smiley_get_type())
+
 typedef struct _PidginSmiley PidginSmiley;
 
 G_BEGIN_DECLS
 
 /**
+ * pidgin_smiley_get_type:
+ *
+ * Returns: The #GType for the #PidginSmiley boxed structure.
+ */
+GType pidgin_smiley_get_type(void);
+
+/**
  * pidgin_smiley_add_to_list:
  * @smiley:	The smiley to be added.
  *
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -86,6 +86,7 @@ typedef struct {
 } PidginWebViewProtocol;
 
 struct _PidginWebViewSmiley {
+	gint box_count;
 	gchar *smile;
 	gchar *file;
 	GdkPixbufAnimation *icon;
@@ -674,6 +675,44 @@ pidgin_webview_insert_smiley(PidginWebVi
 	g_free(unescaped);
 }
 
+/**************************************************************************
+ * PidginWebViewSmiley GBoxed code
+ **************************************************************************/
+
+static PidginWebViewSmiley *
+pidgin_webview_smiley_ref(PidginWebViewSmiley *smiley)
+{
+	g_return_val_if_fail(smiley != NULL, NULL);
+
+	smiley->box_count++;
+
+	return smiley;
+}
+
+static void
+pidgin_webview_smiley_unref(PidginWebViewSmiley *smiley)
+{
+	g_return_if_fail(smiley != NULL);
+	g_return_if_fail(smiley->box_count >= 0);
+
+	if (!smiley->box_count--)
+		pidgin_webview_smiley_destroy(smiley);
+}
+
+GType
+pidgin_webview_smiley_get_type(void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PidginWebViewSmiley",
+				(GBoxedCopyFunc)pidgin_webview_smiley_ref,
+				(GBoxedFreeFunc)pidgin_webview_smiley_unref);
+	}
+
+	return type;
+}
+
 /******************************************************************************
  * Helpers
  *****************************************************************************/
diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h
--- a/pidgin/gtkwebview.h
+++ b/pidgin/gtkwebview.h
@@ -42,6 +42,8 @@
 #define PIDGIN_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_WEBVIEW))
 #define PIDGIN_WEBVIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_WEBVIEW, PidginWebViewClass))
 
+#define PIDGIN_TYPE_WEBVIEW_SMILEY (pidgin_webview_smiley_get_type())
+
 typedef enum {
 	PIDGIN_WEBVIEW_BOLD          = 1 << 0,
 	PIDGIN_WEBVIEW_ITALIC        = 1 << 1,
@@ -114,13 +116,18 @@ G_BEGIN_DECLS
 /**
  * pidgin_webview_get_type:
  *
- * Returns the GType for a PidginWebView widget
- *
- * Returns: The GType for PidginWebView widget
+ * Returns: The #GType for #PidginWebView widget
  */
 GType pidgin_webview_get_type(void);
 
 /**
+ * pidgin_webview_smiley_get_type:
+ *
+ * Returns: The #GType for the #PidginWebViewSmiley boxed structure.
+ */
+GType pidgin_webview_smiley_get_type(void);
+
+/**
  * pidgin_webview_new:
  * @editable: Whether this PidginWebView will be user-editable
  *
diff --git a/pidgin/gtkxfer.c b/pidgin/gtkxfer.c
--- a/pidgin/gtkxfer.c
+++ b/pidgin/gtkxfer.c
@@ -37,6 +37,8 @@
 
 struct _PidginXferDialog
 {
+	gint box_count;
+
 	gboolean keep_open;
 	gboolean auto_clear;
 
@@ -1077,6 +1079,43 @@ pidgin_xfer_dialog_update_xfer(PidginXfe
 }
 
 /**************************************************************************
+ * PidginXferDialog GBoxed code
+ **************************************************************************/
+static PidginXferDialog *
+pidgin_xfer_dialog_ref(PidginXferDialog *dialog)
+{
+	g_return_val_if_fail(dialog != NULL, NULL);
+
+	dialog->box_count++;
+
+	return dialog;
+}
+
+static void
+pidgin_xfer_dialog_unref(PidginXferDialog *dialog)
+{
+	g_return_if_fail(dialog != NULL);
+	g_return_if_fail(dialog->box_count >= 0);
+
+	if (!dialog->box_count--)
+		pidgin_xfer_dialog_destroy(dialog);
+}
+
+GType
+pidgin_xfer_dialog_get_type(void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PidginXferDialog",
+				(GBoxedCopyFunc)pidgin_xfer_dialog_ref,
+				(GBoxedFreeFunc)pidgin_xfer_dialog_unref);
+	}
+
+	return type;
+}
+
+/**************************************************************************
  * File Transfer UI Ops
  **************************************************************************/
 static void
diff --git a/pidgin/gtkxfer.h b/pidgin/gtkxfer.h
--- a/pidgin/gtkxfer.h
+++ b/pidgin/gtkxfer.h
@@ -40,6 +40,8 @@
  */
 typedef struct _PidginXferDialog PidginXferDialog;
 
+#define PIDGIN_TYPE_XFER_DIALOG (pidgin_xfer_dialog_get_type())
+
 G_BEGIN_DECLS
 
 /**************************************************************************/
@@ -47,6 +49,13 @@ G_BEGIN_DECLS
 /**************************************************************************/
 
 /**
+ * pidgin_xfer_dialog_get_type:
+ *
+ * Returns: The #GType for the #PidginXferDialog boxed structure.
+ */
+GType pidgin_xfer_dialog_get_type(void);
+
+/**
  * pidgin_xfer_dialog_new:
  *
  * Creates a new file transfer dialog.



More information about the Commits mailing list