/* header */

typedef struct _ExampleObject           ExampleObject;
typedef struct _ExampleObjectPrivate    ExampleObjectPrivate;
typedef struct _ExampleObjectClass      ExampleObjectClass;

struct _ExampleObject
{
  GObject parent_instance;

  ExampleObjectPrivate *priv;
};

struct _ExampleObjectClass
{
  GObjectClass parent_class;
};

GType example_object_get_type (void);

ExampleObject *example_object_new (void);

G_DEFINE_PROPERTY (ExampleObject, example_object, int, foo);

G_DEFINE_PROPERTY (ExampleObject, example_object, float, margin_top);
G_DEFINE_PROPERTY (ExampleObject, example_object, float, margin_bottom);
G_DEFINE_PROPERTY (ExampleObject, example_object, float, margin_left);
G_DEFINE_PROPERTY (ExampleObject, example_object, float, margin_right);

/* body */

struct _ExampleObjectPrivate
{
  int foo;

  float margin_top;
  float margin_right;
  float margin_bottom;
  float margin_left;
};

G_DEFINE_TYPE (ExampleObject, example_object, G_TYPE_OBJECT);

static void
example_object_class_init (ExampleObjectClass *klass)
{
  g_type_class_add_private (klass, sizeof (ExampleObjectPrivate));

  G_PROPERTY_WITH_CODE (ExampleObject, example_object,
                        int, foo,
                        _("Foo"),
                        _("The value of foo"),
                        G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB,
                        G_PROPERTY_RANGE (int, -1, G_MAXINT, 42));

  G_PROPERTY (ExampleObject, example_object,
              float, margin_top,
              _("Margin Top"),
              _("The margin from the top"),
              G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);

  G_PROPERTY (ExampleObject, example_object,
              float, margin_right,
              _("Margin Right"),
              _("The margin from the right"),
              G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);

  G_PROPERTY (ExampleObject, example_object,
              float, margin_bottom,
              _("Margin Bottom"),
              _("The margin from the bottom"),
              G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);

  G_PROPERTY (ExampleObject, example_object,
              float, margin_left,
              _("Margin Left"),
              _("The margin from the left"),
              G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);
}

static void
example_object_init (ExampleObject *self)
{
  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EXAMPLE_TYPE_OBJECT, ExampleObjectPrivate);

  self->priv->foo = 42;
}

G_DEFINE_PROPERTY_SYNTH (ExampleObject, example_object, int, foo, 42);
G_DEFINE_PROPERTY_SYNTH (ExampleObject, example_object, float, margin_top, 0.0f);
G_DEFINE_PROPERTY_SYNTH (ExampleObject, example_object, float, margin_right, 0.0f);
G_DEFINE_PROPERTY_SYNTH (ExampleObject, example_object, float, margin_bottom, 0.0f);
G_DEFINE_PROPERTY_SYNTH (ExampleObject, example_object, float, margin_left, 0.0f);
