]> git.draconx.ca Git - gob-dx.git/blobdiff - examples/my-person2.gob
Release 2.0.0
[gob-dx.git] / examples / my-person2.gob
diff --git a/examples/my-person2.gob b/examples/my-person2.gob
deleted file mode 100644 (file)
index b7f23ed..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-requires 0.93.0
-
-/* this file requires 0.93.0 as it uses some of the new features to reduce
- * typing and generally make it easier to read I think.  Of course they're
- * optional to use so use the my-person.gob as an example of not using them.
- * These include data member initialization, automatic destructor calling
- * and automatic argument<->data member linking */
-
-%{
-#include <time.h>
-#include "my-person2.h"
-#include "my-person2-private.h"
-%}
-
-class My:Person2 from Gtk:Object {
-       /* the name of the person */
-       public char *name = {g_strdup("Nobody")}
-               destroywith g_free;
-       argument POINTER name stringlink;
-
-       /* date of birth as a time_t */
-       public long dob = 0;
-       argument LONG dob link;
-
-       /* date of death as a time_t */
-       public long dod = 0;
-       argument LONG dod link;
-
-       /* number of rounds in our shotgun */
-       private int rounds_in_shotgun = 0;
-
-       /* when the person gets born, sends out a signal, the caller
-          of the signal should provide the date of birth */
-       signal last NONE (LONG)
-       void
-       birth(self, long dob)
-       {
-               self->dob = dob;
-       }
-       
-       /* when the person dies, sends out a signal, the caller
-          of the signal should provide the date of death */
-       signal last NONE (LONG)
-       void
-       death(self, long dod)
-       {
-               self->dod = dod;
-       }
-
-       public
-       void
-       load_shotgun(self)
-       {
-               /* add a round to our shotgun */
-               self->_priv->rounds_in_shotgun++;
-       }
-
-       public
-       void
-       shoot_oneself_in_the_head(self)
-       {
-               if(self->_priv->rounds_in_shotgun==0) {
-                       g_warning("No rounds in the shotgun!");
-                       return;
-               }
-               
-               /* one round was fired */
-               self->_priv->rounds_in_shotgun--;
-
-               /* death is imminent if we shoot oneself in the head */
-               death(self, (long)time(NULL));
-       }
-
-       public GtkObject *
-       new(void)
-       {
-               return (GtkObject *)GET_NEW;
-       }
-}