Εκτέλεση AtkObject

Τα AtkObject είναι GObjects, και όλα τα GObject απαιτούν τον ορισμό της συνάρτησης get_type(). Εδώ υπάρχει ένα παράδειγμα το οποίο ρυθμίζει μία κλάση και την αρχικοποίηση υποδείξεων. Αυτή η συνάρτηση get_type() επίσης ορίζει ότι το αντικείμενο εκτελεί το ATK_TEXT και καθορίζει ως γονικό αντικείμενο να είναι το MYATKIMP_MYPARENTTYPE.

Παράδειγμα 1-7Εκτέλεση της συνάρτηση get_type() ως παράδειγμα
GType 
myatkimp_mytype_get_type (void) 
{ 
   static GType type = 0; 

   if (!type) 
   { 
      static const GTypeInfo tinfo = 
      { 
         sizeof (GailLabelClass), 
         (GBaseInitFunc) NULL,                              /* base init */ 
         (GBaseFinalizeFunc) NULL,                          /* base finalize */
         (GClassInitFunc) myatkimp_mytype_class_init,       /* class init */          (GClassFinalizeFunc) NULL,                         /* class finalize */ 
         NULL,                                              /* class data */          sizeof (GailLabel),                                /* instance size */ 
         0,                                                 /* nb preallocs */ 
         (GInstanceInitFunc) myatkimp_mytype_instance_init, /* instance init */ 
         NULL                                               /* value table */ 
      }; 

      /* Set up atk_text_info structure used below */ 
      static const GInterfaceInfo atk_text_info = 
      { 
         (GInterfaceInitFunc) atk_text_interface_init, 
         (GInterfaceFinalizeFunc) NULL, 
         NULL 
      }; 

      /* Set up typename and specify parent type */ 
      type = g_type_register_static (MYATKIMP_MYPARENTTYPE, 
            "MyatkimpMytype", &tinfo, 0); 

      /* This class implements interface ATK_TYPE_TEXT */ 
      g_type_add_interface_static (type, ATK_TYPE_TEXT, 
                                   &atk_text_info); 
   } 
   return type; 
}