/* * main.c: Startup code for the MyServer Bonobo Component. * Most of the code in this file will be 'cut-n-paste' into * your appliction, without serious modification. Its * pretty boring initialization code; there's not much * that can be modified here. * * Author: * Miguel de Icaza (miguel@helixcode.com) * Modifications by Linas Vepstas * * (c) 1999, 2000 Helix Code, Inc. http://www.helixcode.com * (c) 2001 Linas Vepstas */ #include #include "iface.h" #include "myserver.h" /* This is where we will dump our messages */ #define LOGFILE "/tmp/xxx" static BonoboObject * myserver_factory (BonoboGenericFactory *this_factory, void *data) { MyServer *myserver; FILE *fh = fopen (LOGFILE, "a"); fprintf (fh, "We are in the factory now\n"); myserver = myserver_new (); fprintf (fh, "Factory created %p\n", myserver); fclose (fh); if (myserver == NULL) return NULL; return BONOBO_OBJECT (myserver); } int main (int argc, char *argv []) { BonoboGenericFactory *factory; CORBA_ORB orb; FILE *fh = fopen (LOGFILE, "a"); gnome_init_with_popt_table ("myserver", "0.37", argc, argv, oaf_popt_options, 0, CORBA_OBJECT_NIL); orb = oaf_init (argc, argv); if (!bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { fprintf (fh, "Could not initialize Bonobo"); fclose (fh); exit (1); } factory = bonobo_generic_factory_new ( "OAFIID:Bonobo_Dasample_MyServer_Factory", myserver_factory, NULL); fprintf (fh, "just crteated a myserver factory at %p\n", factory); fclose (fh); bonobo_main (); return 0; }