]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/gtkmathview-bonobo/src/control-factory.c
* the container seems to work now
[helm.git] / helm / gtkmathview-bonobo / src / control-factory.c
index 9a722625974bc9211b10fbc1e326f1abd7950912..ba20733cf6f5e42db994d27564a1514ff9a52609 100644 (file)
@@ -1,16 +1,16 @@
 
 #include <bonobo.h>
+#include <bonobo/bonobo-shlib-factory.h>
 
-#if 1
 #include <gtkmathview.h>
-#endif
+
+#include "control-factory.h"
 
 enum {
   MATH_VIEW_WIDTH,
   MATH_VIEW_HEIGHT,
   MATH_VIEW_TOP_X,
   MATH_VIEW_TOP_Y,
-  MATH_VIEW_TOP,
   MATH_VIEW_FONT_SIZE,
   MATH_VIEW_ANTI_ALIASING,
   MATH_VIEW_TRANSPARENCY,
@@ -205,65 +205,49 @@ set_prop(BonoboPropertyBag        *bag,
     }
 }
 
-static BonoboControl*
-gtk_math_view_control_factory(void)
+static BonoboObject*
+gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, gpointer closure)
 {
   BonoboControl *control;
-  GtkWidget *math_view;
   BonoboPropertyBag *prop_bag;
+  GtkWidget *math_view;
        
   math_view = gtk_math_view_new(NULL,NULL);
-
   gtk_widget_show(math_view);
 
   control = bonobo_control_new(math_view);
 
-  prop_bag = bonobo_property_bag_new(get_prop, set_prop, math_view);
+  /*
+  persist_file = gtk_math_view_persist_file_new(GTK_MATH_VIEW(math_view));
+  bonobo_object_add_interface(BONOBO_OBJECT(control), persist_file);
+  */
 
-  bonobo_control_set_properties(control,BONOBO_OBJREF(prop_bag), NULL);
+  prop_bag = bonobo_property_bag_new(get_prop, set_prop, math_view);
+  bonobo_control_set_properties(control, BONOBO_OBJREF(prop_bag), NULL);
        
   bonobo_property_bag_add(prop_bag,"width",MATH_VIEW_WIDTH,BONOBO_ARG_INT,
                          NULL,"width",0);
-
   bonobo_property_bag_add(prop_bag,"height",MATH_VIEW_HEIGHT,BONOBO_ARG_INT,
                          NULL,"height",0);
-
   bonobo_property_bag_add(prop_bag,"top_x",MATH_VIEW_TOP_X,BONOBO_ARG_INT,
                          NULL,"top_x",0);
-
   bonobo_property_bag_add(prop_bag,"top_y",MATH_VIEW_TOP_Y,BONOBO_ARG_INT,
                          NULL,"top_y",0);
-       
   bonobo_property_bag_add(prop_bag,"font_size",MATH_VIEW_FONT_SIZE,BONOBO_ARG_INT,
                          NULL,"font_size",0);
-       
   bonobo_property_bag_add(prop_bag,"anti_aliasing",MATH_VIEW_ANTI_ALIASING,BONOBO_ARG_BOOLEAN,
                          NULL,"anti_aliasing",0);
-       
   bonobo_property_bag_add(prop_bag,"transparency",MATH_VIEW_TRANSPARENCY,BONOBO_ARG_BOOLEAN,
                          NULL,"transparency",0);
-       
   bonobo_property_bag_add(prop_bag,"verbosity",MATH_VIEW_VERBOSITY,BONOBO_ARG_INT,
                          NULL,"verbosity",0);
-       
   bonobo_property_bag_add(prop_bag,"font_manager",MATH_VIEW_FONT_MANAGER,BONOBO_ARG_NULL,
                          NULL,"font_manager",0);
-  return control;
-}
 
-static void 
-notify_property_bag(GtkMathView *math_view,gpointer data)
-{
-  BonoboPropertyBag *prop_bag;
-  BonoboArg    *arg;
+  bonobo_object_unref(BONOBO_OBJECT(prop_bag));
 
-  g_return_if_fail(BONOBO_IS_PROPERTY_BAG(data));
-  prop_bag = BONOBO_PROPERTY_BAG(data);
+  return BONOBO_OBJECT(control);
+}
 
-  //we use arg to notify the container that somthing has changed
-       
-  arg = bonobo_arg_new(BONOBO_ARG_INT);
-  BONOBO_ARG_SET_INT(arg,0);
+BONOBO_ACTIVATION_SHLIB_FACTORY (CONTROL_FACTORY_ID, "GtkMathView Factory", gtk_math_view_control_factory, NULL);
 
-  //bonobo_property_bag_notify_listeners(prop_bag,);
-}