/soc/2013/ankitkv/gobjectification: 57724af9660d: Added temporar...
Ankit Vani
a at nevitus.org
Tue Jul 16 11:46:23 EDT 2013
Changeset: 57724af9660db01de79f7f0d08ef46674ad99910
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-16 21:16 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/57724af9660d
Description:
Added temporary GBoxed to PurpleStoredImage
diffstat:
libpurple/imgstore.c | 27 +++++++++++++++++++++++++++
libpurple/imgstore.h | 9 +++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
diffs (56 lines):
diff --git a/libpurple/imgstore.c b/libpurple/imgstore.c
--- a/libpurple/imgstore.c
+++ b/libpurple/imgstore.c
@@ -229,3 +229,30 @@ purple_imgstore_uninit()
purple_signals_unregister_by_instance(purple_imgstore_get_handle());
}
+
+static PurpleStoredImage *
+purple_imgstore_copy(PurpleStoredImage *img)
+{
+ PurpleStoredImage *img_copy;
+
+ g_return_val_if_fail(img != NULL, NULL);
+
+ img_copy = g_new(PurpleStoredImage, 1);
+ *img_copy = *img;
+
+ return img_copy;
+}
+
+GType
+purple_imgstore_get_type(void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ type = g_boxed_type_register_static("PurpleStoredImage",
+ (GBoxedCopyFunc)purple_imgstore_copy,
+ (GBoxedFreeFunc)g_free);
+ }
+
+ return type;
+}
diff --git a/libpurple/imgstore.h b/libpurple/imgstore.h
--- a/libpurple/imgstore.h
+++ b/libpurple/imgstore.h
@@ -37,9 +37,18 @@
*/
typedef struct _PurpleStoredImage PurpleStoredImage;
+#define PURPLE_TYPE_STORED_IMAGE (purple_imgstore_get_type())
+
G_BEGIN_DECLS
/**
+ * Returns the GType for the PurpleStoredImage boxed structure.
+ * TODO Boxing of PurpleStoredImage is a temporary solution to having a GType
+ * for stored images. This should rather be a GObject instead of a GBoxed.
+ */
+GType purple_imgstore_get_type(void);
+
+/**
* Create a new PurpleStoredImage.
*
* The image is not added to the image store and no ID is assigned. If you
More information about the Commits
mailing list