2001-12-10 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / registryd / registryd.c
index 5c92be2..c3f5509 100644 (file)
 #include "registry.h"
 
 int
-main (int argc,
-      char **argv)
+main (int argc, char **argv)
 {
-        SpiRegistry *registry;
-       GSource *keyevent_source;
-        char *obj_id;
+  int          ret;
+  char        *obj_id;
+  SpiRegistry *registry;
 
-        if (!bonobo_init (&argc, argv))
-          {
-            g_error ("Could not initialize oaf / Bonobo");
-          }
+  if (!bonobo_init (&argc, argv))
+    {
+      g_error ("Could not initialize oaf / Bonobo");
+    }
 
-        obj_id = "OAFIID:Accessibility_Registry:proto0.1";
+  obj_id = "OAFIID:Accessibility_Registry:proto0.1";
 
-        registry = spi_registry_new ();
+  registry = spi_registry_new ();
 
-        bonobo_activation_active_server_register (
-                obj_id,
-                bonobo_object_corba_objref (bonobo_object (registry)));
+  ret = bonobo_activation_active_server_register (
+         obj_id,
+         bonobo_object_corba_objref (bonobo_object (registry)));
 
+  if (ret != Bonobo_ACTIVATION_REG_SUCCESS)
+    {
 #ifdef AT_SPI_DEBUG
-        fprintf (stderr, "SpiRegistry Message: SpiRegistry daemon is running.\n");
+      fprintf (stderr, "SpiRegistry Message: SpiRegistry daemon was already running.\n");
 #endif
-  
-        gdk_init(&argc, &argv);
-        g_timeout_add_full (G_PRIORITY_HIGH_IDLE, 200, registry->kbd_event_hook, registry, NULL);
-/*     keyevent_source =
-               g_source_new (registry->kbd_event_hook, sizeof (GSourceFunc));
-               g_source_attach (keyevent_source, g_main_context_default());*/
-        bonobo_main ();
+    }
+  else
+    {
+#ifdef AT_SPI_DEBUG
+      fprintf (stderr, "SpiRegistry Message: SpiRegistry daemon is running.\n");
+#endif
+      g_timeout_add_full (G_PRIORITY_HIGH_IDLE, 200, registry->kbd_event_hook, registry, NULL);
+      bonobo_main ();
+    }
 
-        return 0;
+  return 0;
 }
 
-
-