#include <clutter/clutter.h>
#include <glib.h>
+G_DEFINE_TYPE (ChamplainLayer, champlain_layer, CLUTTER_TYPE_GROUP)
+
+#define GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_LAYER, ChamplainLayerPrivate))
+
+enum
+{
+ PROP_0
+};
+
+typedef struct _ChamplainLayerPrivate ChamplainLayerPrivate;
+
+struct _ChamplainLayerPrivate {
+ gpointer spacer;
+};
+
+static void layer_add_cb (ClutterGroup *layer, ClutterActor *marker,
+ gpointer data);
+
+static void
+champlain_layer_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ChamplainLayer *self = CHAMPLAIN_LAYER (object);
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+champlain_layer_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ChamplainLayer *self = CHAMPLAIN_LAYER (object);
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+champlain_layer_dispose (GObject *object)
+{
+ ChamplainLayerPrivate *priv = GET_PRIVATE (object);
+
+ G_OBJECT_CLASS (champlain_layer_parent_class)->dispose (object);
+}
+
+static void
+champlain_layer_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (champlain_layer_parent_class)->finalize (object);
+}
+
+static void
+champlain_layer_class_init (ChamplainLayerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ChamplainLayerPrivate));
+
+ object_class->get_property = champlain_layer_get_property;
+ object_class->set_property = champlain_layer_set_property;
+ object_class->dispose = champlain_layer_dispose;
+ object_class->finalize = champlain_layer_finalize;
+}
+
+static void
+champlain_layer_init (ChamplainLayer *self)
+{
+ g_signal_connect_after(G_OBJECT(self), "actor-added", G_CALLBACK(layer_add_cb), NULL);
+}
+
/* This callback serves to keep the markers ordered by their latitude.
* Markers that are up north on the map should be lowered in the list so that
* they are drawn the first. This is to make the illusion of a semi-3d plane
ChamplainLayer *
champlain_layer_new ()
{
- ClutterActor *layer;
-
- layer = clutter_group_new();
- g_signal_connect_after(G_OBJECT(layer), "actor-added", G_CALLBACK(layer_add_cb), NULL);
-
- return layer;
+ return g_object_new (CHAMPLAIN_TYPE_LAYER, NULL);
}
#include <glib-object.h>
#include <clutter/clutter.h>
-typedef ClutterActor ChamplainLayer;
+G_BEGIN_DECLS
-ChamplainLayer *champlain_layer_new ();
+#define CHAMPLAIN_TYPE_LAYER champlain_layer_get_type()
+
+#define CHAMPLAIN_LAYER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_LAYER, ChamplainLayer))
+
+#define CHAMPLAIN_LAYER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_LAYER, ChamplainLayerClass))
+
+#define CHAMPLAIN_IS_LAYER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_LAYER))
+
+#define CHAMPLAIN_IS_LAYER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_LAYER))
+
+#define CHAMPLAIN_LAYER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_LAYER, ChamplainLayerClass))
+
+typedef struct {
+ ClutterGroup parent;
+} ChamplainLayer;
+
+typedef struct {
+ ClutterGroupClass parent_class;
+} ChamplainLayerClass;
+
+GType champlain_layer_get_type (void);
+
+ChamplainLayer* champlain_layer_new (void);
+
+G_END_DECLS
#endif