Define signals for AtkText interface
authorPadraig O'Briain <padraigo@src.gnome.org>
Wed, 16 May 2001 12:36:17 +0000 (12:36 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Wed, 16 May 2001 12:36:17 +0000 (12:36 +0000)
atk/atktext.c

index f254ac0bf22083a1cffd511b17385c59abf1e1ae..b5b741af1019db58afbfa7152c189e1b3fad0301 100755 (executable)
@@ -32,11 +32,9 @@ struct _AtkTextIfaceClass
 
 typedef struct _AtkTextIfaceClass AtkTextIfaceClass;
 
-static void atk_text_interface_init (AtkTextIfaceClass *klass);
+static void atk_text_base_init (gpointer *g_class);
 
-static gpointer parent_class = NULL;
-
-static guint atk_text_signals[LAST_SIGNAL] = { 0, 0, 0};
+static guint atk_text_signals[LAST_SIGNAL] = { 0 };
 
 GType
 atk_text_get_type ()
@@ -48,7 +46,7 @@ atk_text_get_type ()
       static const GTypeInfo tinfo =
       {
         sizeof (AtkTextIface),
-        (GBaseInitFunc) NULL,
+        (GBaseInitFunc) atk_text_base_init,
         (GBaseFinalizeFunc) NULL,
         (GClassInitFunc) NULL /* atk_text_interface_init */ ,
         (GClassFinalizeFunc) NULL,
@@ -61,42 +59,39 @@ atk_text_get_type ()
   return type;
 }
 
-/*
- * Additional GObject properties exported by AtkText:
- *    "accessible_text" (accessible text has changed)
- *    "accessible_caret" (accessible text cursor position changed:
- *                         editable text only)
- */
-
 static void
-atk_text_interface_init (AtkTextIfaceClass *klass)
+atk_text_base_init (gpointer *g_class)
 {
-  parent_class = g_type_class_ref (G_TYPE_OBJECT);
+  static gboolean initialized = FALSE;
+
+  if (! initialized)
+    {
 
   /* 
    * Note that text_changed signal supports details "insert", "delete", 
    * possibly "replace". 
    */
 
-  atk_text_signals[TEXT_CHANGED] =
-    g_signal_newc ("text_changed",
-                   G_TYPE_FROM_CLASS (klass),
-                   G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-                   G_STRUCT_OFFSET (AtkTextIface, text_changed), 
-                   NULL,
-                   g_cclosure_marshal_VOID__VOID,
-                   G_TYPE_NONE,
-                   0, G_TYPE_NONE);
-
-  atk_text_signals[CARET_MOVED] =
-    g_signal_newc ("text_caret_moved",
-                   G_TYPE_FROM_CLASS (klass),
-                   G_SIGNAL_RUN_LAST,
-                   G_STRUCT_OFFSET (AtkTextIface, caret_changed),
-                   NULL,
-                   g_cclosure_marshal_VOID__INT,
-                   G_TYPE_NONE,
-                   1, G_TYPE_INT);
+    atk_text_signals[TEXT_CHANGED] =
+      g_signal_newc ("text_changed",
+                     ATK_TYPE_TEXT,
+                     G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+                     G_STRUCT_OFFSET (AtkTextIface, text_changed), 
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE,
+                     0, G_TYPE_NONE);
+
+    atk_text_signals[CARET_MOVED] =
+      g_signal_newc ("text_caret_moved",
+                     ATK_TYPE_TEXT,
+                     G_SIGNAL_RUN_LAST,
+                     G_STRUCT_OFFSET (AtkTextIface, caret_changed),
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__INT,
+                     G_TYPE_NONE,
+                     1, G_TYPE_INT);
+  }
 }
 
 gchar*