/dev/tomkiewicz/new-smileys: 34f4a4318d19: Initial PurpleSmileyL...

Tomasz Wasilczyk twasilczyk at pidgin.im
Sat Mar 29 12:25:28 EDT 2014


Changeset: 34f4a4318d19c3575cbaa0324eb86bd5f2bbb97a
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-03-29 17:25 +0100
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/34f4a4318d19

Description:

Initial PurpleSmileyList implementation

diffstat:

 libpurple/Makefile.am   |    6 +-
 libpurple/smiley-list.c |  131 ++++++++++++++++++++++++++++++++++++++++++++++++
 libpurple/smiley-list.h |   72 ++++++++++++++++++++++++++
 libpurple/smiley.h      |   16 ++--
 4 files changed, 215 insertions(+), 10 deletions(-)

diffs (270 lines):

diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -101,6 +101,7 @@ purple_coresources = \
 	savedstatuses.c \
 	server.c \
 	signals.c \
+	smiley-list.c \
 	smiley.c \
 	dnsquery.c \
 	dnssrv.c\
@@ -176,6 +177,7 @@ purple_coreheaders = \
 	savedstatuses.h \
 	server.h \
 	signals.h \
+	smiley-list.h \
 	smiley.h \
 	dnsquery.h \
 	dnssrv.h \
@@ -266,8 +268,8 @@ dbus_headers  = dbus-bindings.h dbus-pur
 dbus_exported = dbus-useful.h dbus-define-api.h account.h accounts.h blistnode.h \
                 blistnodetypes.h buddylist.h buddyicon.h connection.h conversation.h \
                 conversationtypes.h conversations.h core.h xfer.h log.h notify.h \
-                prefs.h presence.h roomlist.h savedstatuses.h smiley.h status.h \
-                server.h util.h xmlnode.h prpl.h
+                prefs.h presence.h roomlist.h savedstatuses.h smiley.h smiley-list.h \
+                status.h server.h util.h xmlnode.h prpl.h
 
 purple_build_coreheaders = $(addprefix $(srcdir)/, $(purple_coreheaders)) \
 		$(addprefix $(srcdir)/ciphers/, $(purple_cipherheaders)) \
diff --git a/libpurple/smiley-list.c b/libpurple/smiley-list.c
new file mode 100644
--- /dev/null
+++ b/libpurple/smiley-list.c
@@ -0,0 +1,131 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#include "smiley-list.h"
+
+#include "dbus-maybe.h"
+
+#define PURPLE_SMILEY_LIST_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_SMILEY_LIST, \
+	PurpleSmileyListPrivate))
+
+typedef struct {
+	int x;
+} PurpleSmileyListPrivate;
+
+enum
+{
+	PROP_0,
+	PROP_LAST
+};
+
+static GObjectClass *parent_class;
+static GParamSpec *properties[PROP_LAST];
+
+/*******************************************************************************
+ * Object stuff
+ ******************************************************************************/
+
+static void
+purple_smiley_list_init(GTypeInstance *instance, gpointer klass)
+{
+	PurpleSmileyList *sl = PURPLE_SMILEY_LIST(instance);
+	PURPLE_DBUS_REGISTER_POINTER(sl, PurpleSmileyList);
+}
+
+static void
+purple_smiley_list_finalize(GObject *obj)
+{
+	PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj);
+	PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(sl);
+
+	(void)priv;
+
+	PURPLE_DBUS_UNREGISTER_POINTER(sl);
+}
+
+static void
+purple_smiley_list_get_property(GObject *object, guint par_id, GValue *value,
+	GParamSpec *pspec)
+{
+	PurpleSmileyList *sl = PURPLE_SMILEY_LIST(object);
+	PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(sl);
+
+	(void)priv;
+
+	switch (par_id) {
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, par_id, pspec);
+			break;
+	}
+}
+
+static void
+purple_smiley_list_set_property(GObject *object, guint par_id, const GValue *value,
+	GParamSpec *pspec)
+{
+	PurpleSmileyList *sl = PURPLE_SMILEY_LIST(object);
+	PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(sl);
+
+	(void)priv;
+
+	switch (par_id) {
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, par_id, pspec);
+			break;
+	}
+}
+
+static void
+purple_smiley_list_class_init(PurpleSmileyListClass *klass)
+{
+	GObjectClass *gobj_class = G_OBJECT_CLASS(klass);
+
+	parent_class = g_type_class_peek_parent(klass);
+
+	g_type_class_add_private(klass, sizeof(PurpleSmileyListPrivate));
+
+	gobj_class->get_property = purple_smiley_list_get_property;
+	gobj_class->set_property = purple_smiley_list_set_property;
+	gobj_class->finalize = purple_smiley_list_finalize;
+
+	g_object_class_install_properties(gobj_class, PROP_LAST, properties);
+}
+
+GType
+purple_smiley_list_get_type(void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY(type == 0)) {
+		static const GTypeInfo info = {
+			.class_size = sizeof(PurpleSmileyListClass),
+			.class_init = (GClassInitFunc)purple_smiley_list_class_init,
+			.instance_size = sizeof(PurpleSmileyList),
+			.instance_init = purple_smiley_list_init,
+		};
+
+		type = g_type_register_static(G_TYPE_OBJECT,
+			"PurpleSmileyList", &info, 0);
+	}
+
+	return type;
+}
diff --git a/libpurple/smiley-list.h b/libpurple/smiley-list.h
new file mode 100644
--- /dev/null
+++ b/libpurple/smiley-list.h
@@ -0,0 +1,72 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#ifndef _PURPLE_SMILEY_LIST_H_
+#define _PURPLE_SMILEY_LIST_H_
+
+#include <glib-object.h>
+
+typedef struct _PurpleSmileyList PurpleSmileyList;
+typedef struct _PurpleSmileyListClass PurpleSmileyListClass;
+
+#define PURPLE_TYPE_SMILEY_LIST            (purple_smiley_list_get_type())
+#define PURPLE_SMILEY_LIST(smiley)         (G_TYPE_CHECK_INSTANCE_CAST((smiley), PURPLE_TYPE_SMILEY_LIST, PurpleSmileyList))
+#define PURPLE_SMILEY_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_SMILEY_LIST, PurpleSmileyListClass))
+#define PURPLE_IS_SMILEY_LIST(smiley)      (G_TYPE_CHECK_INSTANCE_TYPE((smiley), PURPLE_TYPE_SMILEY_LIST))
+#define PURPLE_IS_SMILEY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_SMILEY_LIST))
+#define PURPLE_SMILEY_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SMILEY_LIST, PurpleSmileyListClass))
+
+/**
+ * PurpleSmileyList:
+ *
+ * A list of smileys.
+ */
+struct _PurpleSmileyList
+{
+	/*< private >*/
+	GObject parent;
+};
+
+struct _PurpleSmileyListClass
+{
+	/*< private >*/
+	GObjectClass parent_class;
+
+	void (*purple_reserved1)(void);
+	void (*purple_reserved2)(void);
+	void (*purple_reserved3)(void);
+	void (*purple_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+/**
+ * purple_smiley_list_get_type:
+ *
+ * Returns: The #GType for a smiley list.
+ */
+GType
+purple_smiley_list_get_type(void);
+
+G_END_DECLS
+
+#endif /* _PURPLE_SMILEY_H_ */
+
diff --git a/libpurple/smiley.h b/libpurple/smiley.h
--- a/libpurple/smiley.h
+++ b/libpurple/smiley.h
@@ -33,15 +33,15 @@
 #include "imgstore.h"
 #include "util.h"
 
-typedef struct _PurpleSmiley        PurpleSmiley;
-typedef struct _PurpleSmileyClass   PurpleSmileyClass;
+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))
+#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))
 
 /**
  * PurpleSmiley:



More information about the Commits mailing list