<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unkown:1.0"/>
- <item value="IDL:Bonobo/PersistStream:1.0"/>
<item value="IDL:Bonobo/PersistFile:1.0"/>
+ <item value="IDL:Bonobo/PersistStream:1.0"/>
<item value="IDL:Bonobo/Persist:1.0"/>
</oaf_attribute>
<oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
<oaf_attribute name="bonobo:supported_mime_types" type="stringv">
<item value="application/mathml+xml"/>
+ <item value="text/mathml"/>
</oaf_attribute>
</oaf_server>
libgtkmathview_bonobo_la_SOURCES = \
control-factory.c \
- persist-file.c \
+ persist-file.c \
persist-stream.c
pkginclude_HEADERS = \
static Bonobo_Persist_ContentTypeList *
get_content_types(BonoboPersist *persist,CORBA_Environment *ev)
{
- //FIXME: il tipo di dato non e` noto
- return bonobo_persist_generate_content_types(0);
+ return bonobo_persist_generate_content_types(3, "application/mathml+xml", "text/mathml", "text/plain");
}
BonoboObject *
gtk_math_view_persist_file_new(GtkMathView *math_view)
{
- BonoboObject *file;
+ BonoboObject *file;
- printf("persist file new\n");
- file = g_object_new(gtk_math_view_persist_file_get_type(),NULL);
- bonobo_persist_construct(BONOBO_PERSIST(file),CONTROL_FACTORY_ID);
+ printf("persist file new\n");
+ file = g_object_new(gtk_math_view_persist_file_get_type(),NULL);
+ bonobo_persist_construct(BONOBO_PERSIST(file),CONTROL_FACTORY_ID);
- g_object_ref(math_view);
- GTK_MATH_VIEW_PERSIST_FILE(file)->math_view = math_view;
+ g_object_ref(math_view);
+ GTK_MATH_VIEW_PERSIST_FILE(file)->math_view = math_view;
- return file;
+ printf("OK\n");
+
+ return file;
}
static void
load_implementation(PortableServer_Servant servant,const gchar *path,CORBA_Environment *ev)
{
- gboolean result;
- GtkMathViewPersistFile* file = GTK_MATH_VIEW_PERSIST_FILE(bonobo_object_from_servant(servant));
- //fd = open(path, O_RDONLY);
-
- result = gtk_math_view_load_uri(file->math_view,path);
- if(!result)
- {
- CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL);
- }
- bonobo_object_unref(BONOBO_OBJECT(file));
- return ;
+ gboolean result;
+ GtkMathViewPersistFile* file = GTK_MATH_VIEW_PERSIST_FILE(bonobo_object_from_servant(servant));
+ //fd = open(path, O_RDONLY);
+
+ printf("passing from here LOAD\n");
+
+ result = gtk_math_view_load_uri(file->math_view,path);
+ if(!result)
+ {
+ printf("exception here!\n");
+ CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL);
+ }
+ bonobo_object_unref(BONOBO_OBJECT(file));
+ return ;
}
static void
static Bonobo_Persist_ContentTypeList *
get_content_types(BonoboPersist *persist,CORBA_Environment *ev)
{
- //FIXME:il tipo di dato non e` noto
- return bonobo_persist_generate_content_types(0);
+ return bonobo_persist_generate_content_types(2, "application/mathml+xml", "text/mathml");
}
static void
FILE *tmpfile;
int fd;
- persist->tmp_path_name = g_strconcat(g_get_tmp_dir(), "/ggvXXXXXX", NULL);
+ persist->tmp_path_name = g_strconcat(g_get_tmp_dir(), "/gmvXXXXXX", NULL);
if((fd = mkstemp(persist->tmp_path_name)) < 0) {
g_free(persist->tmp_path_name),
persist->tmp_path_name = NULL;
return NULL;
}
+ printf("salvo nel file %s\n", persist->tmp_path_name);
tmpfile = fdopen(fd, "w");
if(!tmpfile) {
close(fd);
printf("persist stream loading\n");
#endif
+ printf("type = %s\n", type);
+
if (strcmp (type, "application/mathml+xml") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
do {
Bonobo_Stream_read (stream, 4096, &buffer, ev);
- if (ev->_major != CORBA_NO_EXCEPTION || buffer->_length <= 0) {
- CORBA_free (buffer);
- goto clean;
- }
+ if (ev->_major != CORBA_NO_EXCEPTION) {
+ printf("*** eccezione 1\n");
+ goto clean;
+ }
len_read = buffer->_length;
+ printf("letti %d bytes\n", len_read);
+
if (buffer->_buffer && len_read)
if(fwrite(buffer->_buffer, 1, len_read, tmpfile) != len_read) {
CORBA_free (buffer);
+ printf("*** eccezione 2\n");
goto clean;
}
CORBA_free (buffer);
- } while (1);
+ } while (len_read > 0);
fclose(tmpfile);
result = gtk_math_view_load_uri(persist->math_view,persist->tmp_path_name);
CORBA_Environment ev;
CORBA_exception_init (&ev);
+#if 0
+ stream = bonobo_stream_open ("fs", filename,
+ Bonobo_Storage_READ, 0);
+#endif
+
/*if (stream == NULL)
{
g_warning ("Couldn't load `%s'\n", filename);
} else*/ {
Bonobo_Stream corba_stream;
- //corba_stream = bonobo_object_corba_objref (stream);
- //Bonobo_Stream_truncate (corba_stream, 0, &ev);
- Bonobo_PersistStream_load (pstream, corba_stream,"",&ev);
+ corba_stream = bonobo_object_corba_objref (stream);
+ Bonobo_Stream_truncate (corba_stream, 0, &ev);
+ Bonobo_PersistStream_load (pstream, corba_stream, "application/mathml+xml", &ev);
}
Bonobo_Unknown_unref (pstream, &ev);
CORBA_Object_release (pstream, &ev);
(GTK_FILE_SELECTION (file_selection_info.widget));
switch (file_selection_info.Operations) {
case LOAD_STREAM:
- load_through_persist_stream (fname, interface);
- break;
+ load_through_persist_stream (fname, interface);
+ break;
case LOAD_FILE:
load_through_persist_file (fname, interface);
break;