soylent r156 - trunk/libsoylent
- From: svenp svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r156 - trunk/libsoylent
- Date: Sun, 8 Jun 2008 11:42:14 +0000 (UTC)
Author: svenp
Date: Sun Jun 8 11:42:14 2008
New Revision: 156
URL: http://svn.gnome.org/viewvc/soylent?rev=156&view=rev
Log:
added SoylentEntity, basic GObject stuff is working
Added:
trunk/libsoylent/soylent-entity.c
trunk/libsoylent/soylent-entity.h
Modified:
trunk/libsoylent/Makefile.am
Modified: trunk/libsoylent/Makefile.am
==============================================================================
--- trunk/libsoylent/Makefile.am (original)
+++ trunk/libsoylent/Makefile.am Sun Jun 8 11:42:14 2008
@@ -5,7 +5,11 @@
lib_LTLIBRARIES = libsoylent.la
libsoylent_la_SOURCES = \
+ soylent.h \
+ soylent-entity.h \
soylent-person.h \
+ soylent.c \
+ soylent-entity.c \
soylent-person.c
libsoylent_la_CFLAGS = $(LIBSOYLENT_CFLAGS) $(WARN_CFLAGS)
Added: trunk/libsoylent/soylent-entity.c
==============================================================================
--- (empty file)
+++ trunk/libsoylent/soylent-entity.c Sun Jun 8 11:42:14 2008
@@ -0,0 +1,85 @@
+/**/
+
+#include "soylent-entity.h"
+
+/* private structs and fields */
+
+struct _SoylentEntityPriv {
+ gchar *foo;
+};
+
+static GObjectClass *parent_class = NULL;
+
+static void _soylent_entity_class_init(gpointer g_class, gpointer class_data);
+static void _soylent_entity_init(GTypeInstance *instance, gpointer g_class);
+static void _soylent_entity_dispose(GObject *object);
+static void _soylent_entity_finalize(GObject *object);
+static void _soylent_entity_set_property(GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec);
+static void _soylent_entity_get_property(GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec);
+
+GType soylent_entity_get_type(void) {
+ static GType type = 0;
+ static const GTypeInfo info = {
+ sizeof(SoylentEntityClass),
+ NULL,
+ NULL,
+ _soylent_entity_class_init,
+ NULL,
+ NULL,
+ sizeof(SoylentEntity),
+ 0,
+ _soylent_entity_init,
+ NULL
+ };
+
+ if (type == 0) {
+ type = g_type_register_static(G_TYPE_OBJECT, "SoylentEntity", &info, 0);
+ }
+ return type;
+}
+
+static void _soylent_entity_class_init(gpointer g_class, gpointer class_data) {
+ parent_class = g_type_class_peek(g_type_parent(SOYLENT_ENTITY_TYPE));
+ g_assert(parent_class != NULL);
+
+ parent_class->dispose = _soylent_entity_dispose;
+ parent_class->finalize = _soylent_entity_finalize;
+ parent_class->set_property = _soylent_entity_set_property;
+ parent_class->get_property = _soylent_entity_get_property;
+}
+
+static void _soylent_entity_init(GTypeInstance *instance, gpointer g_class) {
+ SoylentEntity *self = SOYLENT_ENTITY(instance);
+ SoylentEntityPriv *priv = g_new(SoylentEntityPriv, 1);
+ self->priv = priv;
+ self->priv->foo = "FOO";
+}
+
+static void _soylent_entity_dispose(GObject *object) {
+ g_warning("%s not implemented", __FUNCTION__);
+}
+
+static void _soylent_entity_finalize(GObject *object) {
+ g_warning("%s not implemented", __FUNCTION__);
+}
+
+static void _soylent_entity_set_property(GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec) {
+ g_warning("%s not implemented", __FUNCTION__);
+}
+
+static void _soylent_entity_get_property(GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec) {
+ g_warning("%s not implemented", __FUNCTION__);
+}
+
+SoylentEntity *soylent_entity_new(void) {
+ SoylentEntity *entity = g_object_new(SOYLENT_ENTITY_TYPE, NULL);
+ return entity;
+}
+
+gpointer soylent_entity_get(SoylentEntity *self, const gchar *attrname) {
+ return self->priv->foo;
+}
Added: trunk/libsoylent/soylent-entity.h
==============================================================================
--- (empty file)
+++ trunk/libsoylent/soylent-entity.h Sun Jun 8 11:42:14 2008
@@ -0,0 +1,39 @@
+/**/
+
+#ifndef SOYLENT_ENTITY_H
+#define SOYLENT_ENTITY_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#define SOYLENT_ENTITY_TYPE (soylent_entity_get_type())
+#define SOYLENT_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, \
+ SOYLENT_ENTITY_TYPE, SoylentEntity))
+#define SOYLENT_ENTITY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST(cls, \
+ SOYLENT_ENTITY_TYPE, SoylentEntityClass))
+#define SOYLENT_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, \
+ SOYLENT_ENTITY_TYPE))
+#define SOYLENT_IS_ENTITY_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE(cls, \
+ SOYLENT_ENTITY_TYPE))
+#define SOYLENT_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, \
+ SOYLENT_ENTITY_TYPE))
+
+typedef struct _SoylentEntity SoylentEntity;
+typedef struct _SoylentEntityClass SoylentEntityClass;
+typedef struct _SoylentEntityPriv SoylentEntityPriv;
+
+struct _SoylentEntity {
+ GObject parent;
+ SoylentEntityPriv *priv;
+};
+
+struct _SoylentEntityClass {
+ GObjectClass parent;
+};
+
+GType soylent_entity_get_type(void);
+
+SoylentEntity *soylent_entity_new(void);
+gpointer soylent_entity_get(SoylentEntity *self, const gchar *attrname);
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]