diff libpurple/smiley.h @ 23134:6c4f47b9d201

Make PurpleSmiley a GObject. Removed some functions from the API that are not really necessary, including purple_smileys_add and purple_smileys_remove. They are called automatically when a new smiley is created or removed. PurpleSmiley has a 'destroy' signal, and 'shortcut' and 'image' properties. These might be of interest to UIs.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 10 May 2008 16:31:06 +0000
parents 3da84b370eda
children d7e66b6137f9
line wrap: on
line diff
--- a/libpurple/smiley.h	Wed May 07 18:53:13 2008 +0000
+++ b/libpurple/smiley.h	Sat May 10 16:31:06 2008 +0000
@@ -1,5 +1,5 @@
 /**
- * @file Smiley.h Smiley API
+ * @file smiley.h Smiley API
  * @ingroup core
  */
 
@@ -28,6 +28,8 @@
 #ifndef _PURPLE_SMILEY_H_
 #define _PURPLE_SMILEY_H_
 
+#include <glib-object.h>
+
 #include "imgstore.h"
 #include "util.h"
 
@@ -35,8 +37,18 @@
  * A custom smiley.
  * This contains everything Purple will ever need to know about a custom smiley.
  * Everything.
+ *
+ * PurpleSmiley is a GObject.
  */
-typedef struct _PurpleSmiley PurpleSmiley;
+typedef struct _PurpleSmiley        PurpleSmiley;
+typedef struct _PurpleSmileyClass   PurpleSmileyClass;
+
+#define PURPLE_TYPE_SMILEY             (purple_smiley_get_type ())
+#define PURPLE_SMILEY(smiley)          (G_TYPE_CHECK_INSTANCE_CAST ((smiley), PURPLE_TYPE_SMILEY, PurpleSmiley))
+#define PURPLE_SMILEY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SMILEY, PurpleSmileyClass))
+#define PURPLE_IS_SMILEY(smiley)       (G_TYPE_CHECK_INSTANCE_TYPE ((smiley), PURPLE_TYPE_SMILEY))
+#define PURPLE_IS_SMILEY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY))
+#define PURPLE_SMILEY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass))
 
 #ifdef __cplusplus
 extern "C" {
@@ -48,6 +60,12 @@
 /*@{*/
 
 /**
+ * GObject foo.
+ * @internal.
+ */
+GType purple_smiley_get_type(void);
+
+/**
  * Creates a new custom smiley structure and populates it.
  *
  * If a custom smiley with the informed shortcut already exist, it
@@ -64,22 +82,6 @@
 /**
  * Creates a new custom smiley structure and populates it.
  *
- * If a custom smiley with the informed shortcut already exist, it
- * will be automaticaly returned.
- *
- * @param shortcut           The custom smiley associated shortcut.
- * @param smiley_data        The custom smiley data.
- * @param smiley_data_len    The custom smiley data length.
- *
- * @return The custom smiley structure filled up.
- */
-PurpleSmiley *
-purple_smiley_new_from_stream(const char *shortcut, guchar *smiley_data,
-                        size_t smiley_data_len, const char *filename);
-
-/**
- * Creates a new custom smiley structure and populates it.
- *
  * The data is retrieved from an already existent file.
  *
  * If a custom smiley with the informed shortcut already exist, it
@@ -118,7 +120,7 @@
  * Changes the custom smiley's data.
  *
  * When the filename controling is made outside this API, the param
- * @keepfilename must be TRUE.
+ * #keepfilename must be TRUE.
  * Otherwise, the file and filename will be regenerated, and the
  * old one will be removed.
  *
@@ -204,7 +206,7 @@
 
 
 /**************************************************************************/
-/** @name Custom Smiley Subsistem API                                     */
+/** @name Custom Smiley Subsystem API                                     */
 /**************************************************************************/
 /*@{*/
 
@@ -217,24 +219,6 @@
 purple_smileys_get_all(void);
 
 /**
- * Adds the custom smiley to the library persistence.
- *
- * @param smiley   The custom smiley.
- *
- */
-void
-purple_smileys_add(PurpleSmiley *smiley);
-
-/**
- * Remove the custom smiley from persistence.
- *
- * @param smiley   The custom smiley.
- *
- */
-void
-purple_smileys_remove(PurpleSmiley *smiley);
-
-/**
  * Returns the custom smiley given it's shortcut.
  *
  * @param shortcut The custom smiley's shortcut.