2 #include <gtk_math_view.h>
6 static BonoboObjectClass *gtk_math_view_persist_file_parent_class;
8 static void load_implementation(PortableServer_Servant servant,const CORBA_char *path,Corba_Environment *ev);
10 static void finalize(GObject *object)
12 GtkMathViewPersistFile *file = GTK_MATH_VIEW_PERSIST_FILE(object);
15 g_object_unref(file->html);
16 file->math_view = NULL;
19 G_OBJECT_CLASS(gtk_math_view_persist_file_parent_class)->finalize (object);
22 static Bonobo_Persist_ContentTypeList *
23 get_content_types(BonoboPersist *persist,CORBA_Environment *ev)
25 return bonobo_persist_generate_content_types();
29 gtk_math_view_persist_file_class_init(GtkMathViewFileClass *klass)
31 GObjectClass *object_class = G_OBJECT_CLASS(klass);
32 BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS(klass);
33 POA_Bonobo_PersistFile__epv *epv = &klass->epv;
35 gtk_math_view_persist_file_parent_class = g_type_class_peek_parent(klass);
37 epv->load = load_implementation;
38 epv->save = save_implementation;
40 object_class->finalize = finalize;
41 persist_class->get_content_types = get_content_types;
45 gtk_math_view_persist_file_get_type(void)
47 static GType type = 0;
50 sizeof(GtkMathViewPresistFileClass),
52 (GBaseFinalizeFunc) NULL,
53 (GClassInitFunc) gtk_math_view_persist_file_class_init,
54 NULL, /* class finalize */
55 NULL, /* class_data */
56 sizeof(GtkMathViewPresistFile),
58 (GInstanceInitFunc) NULL
61 type = bonobo_type_unique(
63 POA_Bonobo_PersistFile__init,POA_Bonobo_PersistFile__fini,
64 G_STRUCT_OFFSET(GtkMathViewPresistFileClass, epv),
65 &info,"GtkMathViewPresistFile");
71 gtk_math_view_persist_file_new(GtkMathView *math_view)
75 file = g_object_new(gtk_math_view_persist_file_get_type(),NULL);
76 bonobo_persist_construct(BONOBO_PRESIST(file), CONTROL_FACTORY_ID);
78 g_object_ref(math_view);
79 GTK_MATH_VIEW_PRESIST_FILE (file) = math_view;
85 load_implementation(PortableServer_Servant servant,const CORBA_char *path,CORBA_Environment *ev)
87 GtkMathViewPersistFile *file = GTK_MATH_VIEW_
91 gtk_math_view_bonobo_data_construct(Dom::Document *data_file)
94 BonoboPersistFile *file;
96 file = bonobo_persist_file_new(gtk_math_view_load_from_file,
97 gtk_math_view_save_to_file,
98 "OAFIID:GNOME_MATH_VIEW_FILE_Control",
103 bonobo_object_unref(BONOBO_OBJECT (data_file));
107 bonobo_object_add_interface(BONOBO_OBJECT(data_file),
108 BONOBO_OBJECT(file));
117 gtk_math_view_bonobo_load_from_file(BonoboPresistFile *pf,
118 const CORBA_char *filename,
119 CORBA_Environment *ev,
122 Bonobo_PersistStream ps = closure;
123 BonoboStream *stream;
125 g_return_val_if_fail (data != NULL, -1);
126 //FIXME: controllo del tipo di dato in input
128 stram = bonobo_stream_open(
130 filename,Bonobo_STORAGE_READ,
135 //FIXME:I have to extract content type from file
138 Bonobo_PersistStream_load(ps, type, ev);
140 return 1; //return 1 on success
144 gtk_math_view_bonobo_save_to_file(BonoboPresistFile *pf,
145 const CORBA_char *filename,
146 CORBA_Environment *ev,
149 return 1; //return 1 on success