2 * This file is a basic example of how a .gob file would be constructed,
3 * how to add data members, properties and methods
10 #include "my-person-private.h"
13 class My:Person from G:Object {
14 /* the name of the person */
15 private char *name = {g_strdup(_("Nobody"))}
19 blurb = _("Name of the person"),
20 default_value = _("Nobody"),
21 /* Export get/set functions for this property */
23 /* link to the data memeber 'name' */
26 /* date of birth as a time_t */
29 (nick = _("Date of birth"),
30 blurb = _("Date of birth of the person"),
35 /* We could use 'link' as above, but the code below
36 * shows how to do this without linking */
38 self->_priv->dob = g_value_get_long (VAL);
41 g_value_set_long (VAL, self->_priv->dob);
44 /* date of death as a time_t */
47 (nick = _("Date of death"),
48 blurb = _("Date of death of the person"),
55 /* number of rounds in our shotgun */
56 private int rounds_in_shotgun = 0;
58 /* when the person gets born, sends out a signal, the caller
59 of the signal should provide the date of birth */
60 signal last NONE (LONG)
62 birth (self, long dob)
64 g_object_set (G_OBJECT (self),
68 /* when the person dies, sends out a signal, the caller
69 of the signal should provide the date of death */
70 signal last NONE (LONG)
72 death (self, long dod)
74 g_object_set (G_OBJECT (self),
82 /* add a round to our shotgun */
83 self->_priv->rounds_in_shotgun++;
88 shoot_oneself_in_the_head (self)
90 if (self->_priv->rounds_in_shotgun == 0) {
91 g_warning (_("No rounds in the shotgun!"));
95 /* one round was fired */
96 self->_priv->rounds_in_shotgun--;
98 /* death is imminent if we shoot oneself in the head */
99 death (self, (long)time (NULL));
105 return (GObject *)GET_NEW;