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(const gchar *path,CORBA_Environment *ev)
88 g_assert(GTK_IS_MATH_VIEW(ev));
89 result = gtk_math_view_load_uri((GtkMathView *) ev);
91 CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL);
98 save_implementation(const gchar *path,CORBA_Environment *ev)
100 bonobo_exception_set(ev,"save_exception");
101 bonobo_exception_add_handler_str("save_exception",
102 "Save option is not valid");