4 #include "my-person-private.h"
7 class My:Person from Gtk:Object {
9 public long dob; /* date of birth as a time_t */
10 public long dod; /* date of death as a time_t */
12 private int rounds_in_shotgun; /* number of rounds in our shotgun */
17 ARG = g_strdup(self->name);
24 self->name = g_strdup(ARG);
29 argument LONG dob get { ARG = self->dob; } set { self->dob = ARG; };
30 argument LONG dod get { ARG = self->dod; } set { self->dod = ARG; };
34 person->name = g_strdup("Nobody");
38 /* initially we have no rounds in the shotgun */
39 person->_priv->rounds_in_shotgun = 0;
42 /* when the person gets born, sends out a signal, the caller
43 of the signal should provide the date of birth */
44 signal last NONE (LONG)
51 /* when the person dies, sends out a signal, the caller
52 of the signal should provide the date of death */
53 signal last NONE (LONG)
64 /* add a round to our shotgun */
65 self->_priv->rounds_in_shotgun++;
70 shoot_oneself_in_the_head(self)
72 if(self->_priv->rounds_in_shotgun==0) {
73 g_warning("No rounds in the shotgun!");
77 /* one round was fired */
78 self->_priv->rounds_in_shotgun--;
80 /* death is imminent if we shoot oneself in the head */
81 death(self,(long)time(NULL));