#include <gtkmathview.h>
#include "control-factory.h"
+typedef struct _GtkMathViewControlData
+{
+ GtkMathView *math_view;
+} GtkMathViewControlData;
+
enum {
MATH_VIEW_WIDTH,
MATH_VIEW_HEIGHT,
} math_args;
-/*static char *
-make_reg_id(const char *iid)
+static GtkMathViewControlData*
+gtk_math_view_control_data_new(GtkMathView *math_view)
{
- char *id;
- id = bonobo_activation_make_registration_id(iid,Display_String(gdk_display));
- return id;
-}*/
+ GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1);
+ cd->math_view = math_view;
+ return cd;
+}
+
+static void
+gtk_math_view_control_data_destroy(GtkMathViewControlData* cd)
+{
+ //gtk_object_unref(cd->math_view);
+ cd->math_view = NULL;
+
+ g_free(cd);
+}
static void
get_prop(BonoboPropertyBag *bag,
switch(arg_id)
{
- /*case MATH_VIEW_WIDTH:
- g_assert(arg->_type == BONOBO_ARG_INT);
-
- guint i = gtk_math_view_set_width(math_view);
- BONOBO_ARG_SET_INT(arg,i);
- break;
- case MATH_VIEW_HEIGHT:
- g_assert(arg->_type == BONOBO_ARG_INT);
-
- guint i = gtk_math_view_get_height(math_view);
- BONOBO_ARG_SET_INT(arg,i);
- break;*/
case MATH_VIEW_TOP_X:
{
guint old_top_y;
}
}
-static BonoboObject*
-gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, gpointer closure)
+static void
+control_destroy(BonoboObject *object,GtkMathViewControlData *cd)
{
- BonoboControl *control;
- BonoboPropertyBag *prop_bag;
+ gtk_math_view_control_data_destroy(cd);
+}
+
+static void
+set_frame(BonoboControl *control,gpointer data)
+{
+ Bonobo_UIContainer remote_ui_container;
+ BonoboUIComponent *ui_component;
+ GtkMathViewControlData *control_data;
+ GtkWidget *scrolled_window;
+ Bonobo_ControlFrame frame;
+
+ control_data = (GtkMathViewControlData *) data;
+}
+
+static void
+gtk_math_view_control_init(BonoboControl *control,GtkWidget *scrolled_window)
+{
+ GtkMathViewControlData *control_data;
GtkWidget *math_view;
+ Bonobo_UIContainer remote_ui_container;
+ BonoboUIComponent *ui_component;
+
+ BonoboPropertyBag *prop_bag;
BonoboObject *persist_file;
BonoboObject *persist_stream;
-
+
math_view = gtk_math_view_new(NULL,NULL);
gtk_widget_show(math_view);
-
- control = bonobo_control_new(math_view);
+
+ control_data = gtk_math_view_control_data_new((GtkMathView*)math_view);
+ g_signal_connect (control, "destroy", G_CALLBACK (control_destroy), control_data);
+
+ gtk_container_add(GTK_CONTAINER (scrolled_window), GTK_WIDGET (control_data->math_view));
persist_file = gtk_math_view_persist_file_new(GTK_MATH_VIEW(math_view));
bonobo_object_add_interface(BONOBO_OBJECT(control), persist_file);
NULL,"font_manager",0);
bonobo_object_unref(BONOBO_OBJECT(prop_bag));
- //bonobo_object_unref(BONOBO_OBJECT(persist_file));
- //bonobo_object_unref(BONOBO_OBJECT(persist_stream));
+
+ g_signal_connect(control,"set_frame",G_CALLBACK(set_frame),control_data);
+}
+
+static BonoboObject*
+gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, gpointer closure)
+{
+ BonoboControl *control;
+ GtkWidget *scrolled_window;
+
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_widget_show_all (scrolled_window);
+
+ control = bonobo_control_new(scrolled_window);
- return BONOBO_OBJECT(control);
+ if(control)
+ {
+ gtk_math_view_control_init(control,scrolled_window);
+ return BONOBO_OBJECT(control);
+ }
+ else
+ return NULL;
}
BONOBO_ACTIVATION_SHLIB_FACTORY (CONTROL_FACTORY_ID, "GtkMathView Factory", gtk_math_view_control_factory, NULL);
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
-
+
tmpfile = create_tmp_file(persist);
do {
Bonobo_Stream_read (stream, 4096, &buffer, ev);
-
if (ev->_major != CORBA_NO_EXCEPTION) {
- printf("*** eccezione 1\n");
- goto clean;
- }
-
+ printf("*** eccezione 1 %s\n",ev->_major);
+ goto clean;
+ }
+
len_read = buffer->_length;
- printf("letti %d bytes\n", len_read);
+ 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");
+ printf("*** eccezione 2\n");
goto clean;
- }
+ }
CORBA_free (buffer);
} while (len_read > 0);