3 /* this file requires 0.93.0 as it uses some of the new features to reduce
4 * typing and generally make it easier to read I think. Of course they're
5 * optional to use so use the my-person.gob as an example of not using them.
6 * These include data member initialization, automatic destructor calling
7 * and automatic argument<->data member linking */
11 #include "my-person2.h"
12 #include "my-person2-private.h"
15 class My:Person2 from Gtk:Object {
16 /* the name of the person */
17 public char *name = {g_strdup("Nobody")}
19 argument POINTER name stringlink;
21 /* date of birth as a time_t */
23 argument LONG dob link;
25 /* date of death as a time_t */
27 argument LONG dod link;
29 /* number of rounds in our shotgun */
30 private int rounds_in_shotgun = 0;
32 /* when the person gets born, sends out a signal, the caller
33 of the signal should provide the date of birth */
34 signal last NONE (LONG)
41 /* when the person dies, sends out a signal, the caller
42 of the signal should provide the date of death */
43 signal last NONE (LONG)
54 /* add a round to our shotgun */
55 self->_priv->rounds_in_shotgun++;
60 shoot_oneself_in_the_head(self)
62 if(self->_priv->rounds_in_shotgun==0) {
63 g_warning("No rounds in the shotgun!");
67 /* one round was fired */
68 self->_priv->rounds_in_shotgun--;
70 /* death is imminent if we shoot oneself in the head */
71 death(self, (long)time(NULL));
77 return (GtkObject *)GET_NEW;