Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

testbonobocontrol.c

Go to the documentation of this file.
00001 //#include <libgnome/libgnome.h> 00002 //#include <libgnomeui/libgnomeui.h> 00003 #include <libbonobo.h> 00004 #include <libbonoboui.h> 00005 #include <libgnomevfs/gnome-vfs-utils.h> 00006 #include "config.h" 00007 00012 CORBA_Environment ev; 00013 00014 static guint 00015 create_app (void) 00016 { 00017 GtkWidget *box, *control, *label, *button; 00018 BonoboWindow *bonobo_win; 00019 00020 BonoboUIContainer *uic; 00021 00022 gchar* uri; 00023 Bonobo_Unknown bu, bs; 00024 Bonobo_Storage storage; 00025 Bonobo_Stream stream; 00026 00027 /* 00028 * create a bonobo application (window) 00029 */ 00030 bonobo_win = (BonoboWindow *) bonobo_window_new ("bonobo-control-test", 00031 "a container for GtkChem3D BonoboControl test"); 00032 gtk_widget_set_size_request (GTK_WIDGET(bonobo_win), 320, 200); 00033 g_signal_connect(G_OBJECT(bonobo_win), "delete_event", (GtkSignalFunc)bonobo_main_quit, NULL); 00034 g_signal_connect(G_OBJECT(bonobo_win), "destroy", (GtkSignalFunc)bonobo_main_quit, NULL); 00035 00036 /* 00037 * connect a ui container to the application 00038 */ 00039 uic = bonobo_ui_container_new (); 00040 bonobo_window_construct (bonobo_win, uic, "bonobo-control-test", 00041 "a container for GtkChem3D BonoboControl test"); 00042 00043 /* 00044 * get a widget, containing the control 00045 */ 00046 control = bonobo_widget_new_control ("OAFIID:gchem3d_unstable_control", BONOBO_OBJREF (uic)); 00047 if (!control) 00048 g_error ("Can't create control\n"); 00049 bonobo_window_set_contents(bonobo_win,control); 00050 00051 gtk_widget_show_all (GTK_WIDGET(bonobo_win)); 00052 00053 /* 00054 *Loading data 00055 */ 00056 uri = "file://"SRCDIR"/tests"; 00057 bu = bonobo_widget_get_objref (BONOBO_WIDGET(control)); 00058 bs = Bonobo_Unknown_queryInterface(bu,"IDL:Bonobo/PersistStream:1.0",&ev); 00059 storage = bonobo_get_object (uri, "IDL:Bonobo/Storage:1.0", &ev); 00060 if (BONOBO_EX (&ev) || !storage) return TRUE; 00061 stream = Bonobo_Storage_openStream(storage, "methane.xyz", Bonobo_Storage_READ, &ev); 00062 if (BONOBO_EX (&ev) || !stream) return TRUE; 00063 Bonobo_PersistStream_load(bs, stream, "chemical/x-xyz" ,&ev); 00064 00065 return FALSE; 00066 } 00067 00068 int 00069 main (int argc, char** argv) 00070 { 00071 CORBA_ORB orb; 00072 00073 // GnomeProgram* prog; 00074 00075 CORBA_exception_init (&ev); 00076 /* prog = gnome_program_init ("bonobo-control-test", "0.0", LIBGNOMEUI_MODULE, argc, argv, 00077 GNOME_PARAM_POPT_TABLE, NULL, 00078 GNOME_PROGRAM_STANDARD_PROPERTIES, NULL);*/ 00079 gtk_init (&argc, &argv); 00080 /* 00081 * initialize CORBA, OAF and bonobo 00082 */ 00083 if (!bonobo_init (&argc, argv)) 00084 g_error ("could not initialize Bonobo"); 00085 00086 00087 /* 00088 * We can't make any CORBA calls unless we're in the main 00089 * loop. So we delay creating the container here. 00090 */ 00091 gtk_idle_add ((GtkFunction) create_app, NULL); 00092 bonobo_main (); 00093 00094 return 0; 00095 }

Generated on Tue Sep 21 14:59:35 2004 for The Gnome Chemistry Utils by doxygen 1.3.8