soylent r197 - trunk/libsoylent
- From: svenp svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r197 - trunk/libsoylent
- Date: Wed, 9 Jul 2008 14:08:44 +0000 (UTC)
Author: svenp
Date: Wed Jul 9 14:08:44 2008
New Revision: 197
URL: http://svn.gnome.org/viewvc/soylent?rev=197&view=rev
Log:
SlPerson is now a GObject
Modified:
trunk/libsoylent/sl-person.c
trunk/libsoylent/sl-person.h
Modified: trunk/libsoylent/sl-person.c
==============================================================================
--- trunk/libsoylent/sl-person.c (original)
+++ trunk/libsoylent/sl-person.c Wed Jul 9 14:08:44 2008
@@ -1,11 +1,97 @@
-//
+/**/
#include "sl-person.h"
-gint
-sl_person_foo (const gchar *bar)
+/* private structs and fields */
+
+struct _SlPersonPriv
+{
+};
+
+static GObjectClass *parent_class = NULL;
+
+static void sl_person_class_init (gpointer g_class, gpointer class_data);
+static void sl_person_init (GTypeInstance *instance, gpointer g_class);
+static void sl_person_dispose (GObject *object);
+static void sl_person_get_property (GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec);
+static void sl_person_set_property (GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec);
+
+GType
+sl_person_get_type (void)
+{
+ static GType type = 0;
+ static const GTypeInfo info =
+ {
+ sizeof (SlPersonClass),
+ NULL,
+ NULL,
+ sl_person_class_init,
+ NULL,
+ NULL,
+ sizeof (SlPerson),
+ 0,
+ sl_person_init,
+ NULL
+ };
+
+ if (type == 0)
+ {
+ type = g_type_register_static (SL_ENTITY_TYPE, "SlPerson", &info, 0);
+ }
+ return type;
+}
+
+static void
+sl_person_class_init (gpointer g_class, gpointer class_data)
+{
+ parent_class = g_type_class_peek (g_type_parent (SL_PERSON_TYPE));
+ g_assert (parent_class != NULL);
+
+ GObjectClass *obj_class = G_OBJECT_CLASS (g_class);
+ obj_class->dispose = sl_person_dispose;
+ obj_class->get_property = sl_person_get_property;
+ obj_class->set_property = sl_person_set_property;
+}
+
+static void
+sl_person_init (GTypeInstance *instance, gpointer g_class)
+{
+ SlPerson *self = SL_PERSON (instance);
+ SlPersonPriv *priv = g_new (SlPersonPriv, 1);
+ self->priv = priv;
+ SL_ENTITY (self)->disposed = FALSE;
+}
+
+static void
+sl_person_dispose (GObject *object)
+{
+ SlPerson *self = SL_PERSON (object);
+ g_return_if_fail (!SL_ENTITY (self)->disposed);
+
+ g_free (self->priv);
+
+ parent_class->dispose (object);
+}
+
+static void
+sl_person_get_property (GObject *object, guint property_id, GValue *value,
+ GParamSpec *pspec)
+{
+ g_warning("%s not implemented", __FUNCTION__);
+}
+
+static void
+sl_person_set_property (GObject *object, guint property_id, const GValue *value,
+ GParamSpec *pspec)
+{
+ g_warning("%s not implemented", __FUNCTION__);
+}
+
+SlPerson *
+sl_person_new (void)
{
- g_return_val_if_fail (bar != NULL, -1);
-
- return g_str_hash (bar);
+ SlPerson *self = g_object_new (SL_PERSON_TYPE, NULL);
+ return self;
}
Modified: trunk/libsoylent/sl-person.h
==============================================================================
--- trunk/libsoylent/sl-person.h (original)
+++ trunk/libsoylent/sl-person.h Wed Jul 9 14:08:44 2008
@@ -1,11 +1,42 @@
-//
+/**/
#ifndef SL_PERSON_H
#define SL_PERSON_H
+#include "sl-entity.h"
+
#include <glib.h>
#include <glib-object.h>
-gint sl_person_foo (const gchar *bar);
+#define SL_PERSON_TYPE (sl_person_get_type ())
+#define SL_PERSON(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, \
+ SL_PERSON_TYPE, SlPerson))
+#define SL_PERSON_CLASS(cls) (G_TPYE_CHECK_CLASS_CAST (cls, \
+ SL_PERSON_TYPE, SlPersonClass))
+#define SL_IS_PERSON(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, \
+ SL_PERSON_TYPE))
+#define SL_IS_PERSON_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE (cls, \
+ SL_PERSON_TYPE))
+#define SL_PERSON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, \
+ SL_PERSON_TYPE))
+
+typedef struct _SlPerson SlPerson;
+typedef struct _SlPersonClass SlPersonClass;
+typedef struct _SlPersonPriv SlPersonPriv;
+
+struct _SlPerson
+{
+ SlEntity parent;
+ SlPersonPriv *priv;
+};
+
+struct _SlPersonClass
+{
+ SlEntityClass parent;
+};
+
+GType sl_person_get_type (void);
+
+SlPerson *sl_person_new (void);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]