]> matita.cs.unibo.it Git - helm.git/commitdiff
* added test View interface. It is basically empty but eventually it will host
authorLuca Padovani <luca.padovani@unito.it>
Thu, 4 Sep 2003 18:46:14 +0000 (18:46 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Thu, 4 Sep 2003 18:46:14 +0000 (18:46 +0000)
  any gtkmathview-specific method

13 files changed:
helm/gtkmathview-bonobo/Makefile.am
helm/gtkmathview-bonobo/configure.ac
helm/gtkmathview-bonobo/idl/.cvsignore [new file with mode: 0644]
helm/gtkmathview-bonobo/idl/GNOME_GtkMathView_View.idl [new file with mode: 0644]
helm/gtkmathview-bonobo/idl/Makefile.am [new file with mode: 0644]
helm/gtkmathview-bonobo/src/.cvsignore
helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in
helm/gtkmathview-bonobo/src/Makefile.am
helm/gtkmathview-bonobo/src/control-factory.c
helm/gtkmathview-bonobo/src/view.c [new file with mode: 0644]
helm/gtkmathview-bonobo/src/view.h [new file with mode: 0644]
helm/gtkmathview-bonobo/test/Makefile.am
helm/gtkmathview-bonobo/test/main.c

index 8524127c112a3c3c2900a7be3fda1d6fcc7fbc89..afa1ecdc2f8595579b9db3d280862752954080ff 100644 (file)
@@ -1,5 +1,5 @@
 EXTRA_DIST = config.h.in
-SUBDIRS = src test
+SUBDIRS = idl src test
 CLEANFILES = core *.log *.eps
 
 pkgconfigdir = $(libdir)/pkgconfig
index 06f35c6d08168355af67a2bf4b9bd988a53cdde3..d07109de5c3de7c0d9096ed8b5b156cd2c364525 100644 (file)
@@ -97,9 +97,16 @@ PKG_CHECK_MODULES(GNOMEUI, libgnomeui-2.0)
 AC_SUBST(GNOMEUI_CFLAGS)
 AC_SUBST(GNOMEUI_LIBS)
 
+ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
+AC_SUBST(ORBIT_IDL)
+
+BONOBO_IDL_INCLUDES="-I`$PKG_CONFIG --variable=idldir libbonobo-2.0` -I`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
+AC_SUBST(BONOBO_IDL_INCLUDES)
+
 AC_CONFIG_FILES([
  Makefile 
  gtkmathview-bonobo.pc
+ idl/Makefile
  src/Makefile
  src/GNOME_GtkMathView.server.in
  test/Makefile
diff --git a/helm/gtkmathview-bonobo/idl/.cvsignore b/helm/gtkmathview-bonobo/idl/.cvsignore
new file mode 100644 (file)
index 0000000..282522d
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/helm/gtkmathview-bonobo/idl/GNOME_GtkMathView_View.idl b/helm/gtkmathview-bonobo/idl/GNOME_GtkMathView_View.idl
new file mode 100644 (file)
index 0000000..4cbe0d6
--- /dev/null
@@ -0,0 +1,18 @@
+
+#include <Bonobo.idl>
+
+module GNOME {
+
+  module GtkMathView {
+
+    interface View : Bonobo::Unknown {
+      
+      void freeze ();
+      void thaw ();
+
+    };
+
+  };
+
+};
+
diff --git a/helm/gtkmathview-bonobo/idl/Makefile.am b/helm/gtkmathview-bonobo/idl/Makefile.am
new file mode 100644 (file)
index 0000000..1f58393
--- /dev/null
@@ -0,0 +1,5 @@
+
+idldir = $(datadir)/idl/bonobo-2.0
+idl_DATA = GNOME_GtkMathView_View.idl
+
+EXTRA_DIST = $(idl_DATA)
index f7ad5df6dc7cd3f6afef12a2fc4eb33f7b4a6aa9..d65d76132cd83873724313f06837f6ed662d5e4f 100644 (file)
@@ -6,4 +6,13 @@ Makefile
 Makefile.in
 libgtkmathview-bonobo.la
 control-factory.lo
+view.lo
 persist-file.lo
+persist-stream.lo
+GNOME_GtkMathView_View-common.c
+GNOME_GtkMathView_View-common.lo
+GNOME_GtkMathView_View-skels.c
+GNOME_GtkMathView_View-skels.lo
+GNOME_GtkMathView_View-stubs.c
+GNOME_GtkMathView_View-stubs.lo
+GNOME_GtkMathView_View.h
index 5d4919470f03da2695cb49c1cf9f05fc83852f48..957c40004c4aec176e9e9996475db677082150eb 100644 (file)
@@ -13,6 +13,7 @@
 <oaf_server iid="OAFIID:GNOME_GtkMathView:@GTKMATHVIEW_API_VERSION@" type="factory" location="OAFIID:GNOME_GtkMathView_Factory:@GTKMATHVIEW_API_VERSION@">
 
                <oaf_attribute name="repo_ids" type="stringv">
+                       <item value="IDL:GNOME/GtkMathView/View:1.0"/>
                        <item value="IDL:Bonobo/Control:1.0"/>
                        <item value="IDL:Bonobo/Unkown:1.0"/>
                        <item value="IDL:Bonobo/PersistFile:1.0"/>
index 3abccce7c306b7a5551bb232a82c89e915662ffe..9ae3d2cff45eeb91f960343519318bda17633650 100644 (file)
@@ -5,25 +5,51 @@ server_in_files = GNOME_GtkMathView.server.in.in
 
 CLEANFILES = $(server_in_files:.server.in.in=.server)
 
+IDL = $(top_srcdir)/idl/GNOME_GtkMathView_View.idl
+
+IDL_GENERATED_C = \
+  GNOME_GtkMathView_View-common.c \
+  GNOME_GtkMathView_View-skels.c \
+  GNOME_GtkMathView_View-stubs.c
+
+IDL_GENERATED_H = \
+  GNOME_GtkMathView_View.h
+
+IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H)
+
 lib_LTLIBRARIES = libgtkmathview-bonobo.la
 
-libgtkmathview_bonobo_la_LIBADD = $(GTKMATHVIEW_LIBS) $(BONOBOUI_LIBS) $(BONOBO_LIBS)
+libgtkmathview_bonobo_la_LIBADD = \
+  $(GTKMATHVIEW_LIBS) \
+  $(BONOBOUI_LIBS) \
+  $(BONOBO_LIBS)
+
 libgtkmathview_bonobo_la_LDFLAGS = -version-info @GTKMATHVIEW_CONTROL_VERSION_INFO@
 
 libgtkmathview_bonobo_la_SOURCES = \
+  $(IDL_GENERATED_C) \
   control-factory.c \
   persist-file.c \
-  persist-stream.c
+  persist-stream.c \
+  view.c
 
 pkginclude_HEADERS = \
   control-factory.h \
   persist-file.h    \
-  persist-stream.h
+  persist-stream.h \
+  view.h
 
 server_DATA = $(server_in_files:.server.in.in=.server)
 $(server_in_files:.server.in.in=.server): $(server_in_files:.server.in.in=.server.in) Makefile
        sed -e "s|\@GTKMATHVIEW_FACTORY_LOCATION\@|$(location)|g" $< >$@
 
+view.c : $(VIEW_CORBA_GENERATED)
+
+$(IDL_GENERATED): $(IDL)
+       $(ORBIT_IDL) $(BONOBO_IDL_INCLUDES) $<
+
+EXTRA_DIST = $(server_DATA)
+
 INCLUDES = \
   $(BONOBOUI_CFLAGS) \
   $(BONOBO_CFLAGS) \
index bfed0d5b82db85598c33990dfd1f4a433a9a08cd..8d4e9a12a1aefa6a74c3ed8e216e1aabf7639cc9 100644 (file)
@@ -1,7 +1,9 @@
+
 #include <bonobo.h>
 #include <bonobo/bonobo-shlib-factory.h>
 #include <gtkmathview.h>
 #include "control-factory.h"
+#include "view.h"
 
 typedef struct _GtkMathViewControlData
 {
@@ -235,7 +237,8 @@ gtk_math_view_control_init(BonoboControl *control,GtkWidget *scrolled_window)
   BonoboPropertyBag *prop_bag;
   BonoboObject *persist_file;
   BonoboObject *persist_stream;
-  
+  View* view;
+
   math_view = gtk_math_view_new(NULL,NULL);
   gtk_widget_show(math_view);
   
@@ -244,6 +247,9 @@ gtk_math_view_control_init(BonoboControl *control,GtkWidget *scrolled_window)
   
   gtk_container_add(GTK_CONTAINER (scrolled_window), GTK_WIDGET (control_data->math_view));
 
+  view = view_new();
+  bonobo_object_add_interface(BONOBO_OBJECT(control), BONOBO_OBJECT(view));
+
   persist_file = gtk_math_view_persist_file_new(GTK_MATH_VIEW(math_view));
   bonobo_object_add_interface(BONOBO_OBJECT(control), persist_file);
 
diff --git a/helm/gtkmathview-bonobo/src/view.c b/helm/gtkmathview-bonobo/src/view.c
new file mode 100644 (file)
index 0000000..dc8226e
--- /dev/null
@@ -0,0 +1,58 @@
+
+#include <config.h>
+
+#include "view.h"
+
+static GObjectClass* view_parent_class;
+
+static void
+view_object_finalize(GObject* object)
+{
+  View* view = VIEW(object);
+  /* free resources */
+  view_parent_class->finalize(object);
+}
+
+static void
+impl_view_freeze(PortableServer_Servant  servant,
+                CORBA_Environment *ev)
+{
+  View* view = VIEW (bonobo_object (servant));
+  printf("called freeze\n");
+}
+
+static void
+impl_view_thaw(PortableServer_Servant  servant,
+              CORBA_Environment *ev)
+{
+  View* view = VIEW (bonobo_object (servant));
+  printf("called thaw\n");
+}
+
+static void
+view_class_init(ViewClass* klass)
+{
+  GObjectClass* object_class = (GObjectClass *) klass;
+  POA_GNOME_GtkMathView_View__epv* epv = &klass->epv;
+  
+  view_parent_class = g_type_class_peek_parent (klass);
+  object_class->finalize = view_object_finalize;
+  
+  epv->freeze = impl_view_freeze;
+  epv->thaw = impl_view_thaw;
+}
+
+static void
+view_init(View* view)
+{
+  /* do some initialization */
+}
+
+BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view)
+
+View*
+view_new()
+{
+  View* view = g_object_new(VIEW_TYPE, NULL);
+  return view;
+}                     
diff --git a/helm/gtkmathview-bonobo/src/view.h b/helm/gtkmathview-bonobo/src/view.h
new file mode 100644 (file)
index 0000000..1d88c0c
--- /dev/null
@@ -0,0 +1,29 @@
+
+#ifndef __view_h__
+#define __view_h__
+
+#include <bonobo.h>
+
+#include "GNOME_GtkMathView_View.h"
+
+#define VIEW_TYPE        (view_get_type())
+#define VIEW(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), VIEW_TYPE, View))
+#define VIEW_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), VIEW_TYPE, ViewClass))
+#define VIEW_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), VIEW_TYPE))
+#define VIEW_IS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), VIEW_TYPE))
+#define VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), VIEW_TYPE, ViewClass))
+
+typedef struct {
+  BonoboObject parent;
+} View;
+
+typedef struct {
+  BonoboObjectClass parent_class;
+  POA_GNOME_GtkMathView_View__epv epv;
+} ViewClass;
+
+GType view_get_type(void);
+View* view_new(void);
+
+#endif /* __view_h__ */
+
index 7dd730e7ef8fca421f3f29372d0f6c3ea180302e..3336948ff0f5bf94498feb34a405c0a54a2f87c9 100644 (file)
@@ -1,7 +1,10 @@
 
 noinst_PROGRAMS = viewer
 
-viewer_SOURCES = main.c
+viewer_SOURCES = \
+  main.c \
+  $(top_srcdir)/src/GNOME_GtkMathView_View-common.c \
+  $(top_srcdir)/src/GNOME_GtkMathView_View-stubs.c
 
 viewer_LDADD = \
   $(BONOBOUI_LIBS) \
index dccb6e63a570e25b6948f5003e99adf64550fd81..84aa7cae1cd13f4e5c4a6d94b5e1158367abc3d1 100644 (file)
@@ -4,6 +4,7 @@
 #include <glib.h>
 
 #include "control-factory.h"
+#include "GNOME_GtkMathView_View.h"
 
 static GtkWidget *control;
 
@@ -91,15 +92,14 @@ file_selection_ok_cb (GtkWidget *widget,
   else         
     {
        const gchar *fname;
-       fname = gtk_file_selection_get_filename
-       (GTK_FILE_SELECTION (file_selection_info.widget));
+       fname = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection_info.widget));
        switch (file_selection_info.Operations) {
-           case LOAD_STREAM:
-            load_through_persist_stream (fname, interface);
-            break;
-           case LOAD_FILE:
-               load_through_persist_file (fname, interface);
-               break;
+       case LOAD_STREAM:
+        load_through_persist_stream (fname, interface);
+        break;
+       case LOAD_FILE:
+        load_through_persist_file (fname, interface);
+        break;
        }
     }
   
@@ -147,14 +147,44 @@ static void
 open_through_persist_file_cb (GtkWidget *widget,
                              gpointer data)
 {
-  open_dialog (BONOBO_WINDOW (data),LOAD_FILE);
+  open_dialog (BONOBO_WINDOW (data), LOAD_FILE);
 }
 
 static void 
 open_through_persist_stream_cb(GtkWidget *widget,
                                gpointer data)
 {
-    open_dialog(BONOBO_WINDOW(data),LOAD_STREAM);
+  open_dialog(BONOBO_WINDOW(data), LOAD_STREAM);
+}
+
+static void
+test_view(GtkWidget* widget, gpointer data)
+{
+  CORBA_Object interface;
+  CORBA_Environment ev;
+
+  CORBA_exception_init (&ev);
+  interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (bonobo_window_get_contents (BONOBO_WINDOW(data)))),
+                                            "IDL:GNOME/GtkMathView/View:1.0", &ev);
+  CORBA_exception_free (&ev);
+
+  if (interface == CORBA_OBJECT_NIL)
+    {
+      g_warning ("The Control does not seem to support `View'.");
+    }
+
+  CORBA_exception_init (&ev);
+  GNOME_GtkMathView_View_freeze(interface, &ev);
+  CORBA_exception_free (&ev);
+
+  CORBA_exception_init (&ev);
+  GNOME_GtkMathView_View_thaw(interface, &ev);
+  CORBA_exception_free (&ev);
+
+  CORBA_exception_init (&ev);
+  Bonobo_Unknown_unref (interface, &ev);
+  CORBA_Object_release (interface, &ev);
+  CORBA_exception_free (&ev);
 }
 
 static void
@@ -318,6 +348,7 @@ get_font_manager(GtkWidget *widget,
 static BonoboUIVerb verbs [] = {
   BONOBO_UI_UNSAFE_VERB ("OpenFile", open_through_persist_file_cb),
   BONOBO_UI_UNSAFE_VERB ("OpenStream", open_through_persist_stream_cb),
+  BONOBO_UI_UNSAFE_VERB ("TestView", test_view),
   BONOBO_UI_UNSAFE_VERB ("Size", get_size),
   BONOBO_UI_UNSAFE_VERB ("Top", get_top),
   BONOBO_UI_UNSAFE_VERB ("Font Size", get_font_size),
@@ -354,11 +385,12 @@ static char ui [] =
 "                       <menuitem name=\"ViewHTMLSource\" verb=\"\" _label=\"View HTML Source\" _tip=\"View the html source of the current document\"/>"
 "                       <menuitem name=\"ViewHTMLSourceHTML\" verb=\"\" _label=\"View HTML Output\" _tip=\"View the html source of the current document as html\"/>"
 "                       <menuitem name=\"ViewPlainSource\" verb=\"\" _label=\"View PLAIN Source\" _tip=\"View the plain text source of the current document\"/>"
+"                       <menuitem name=\"TestView\" verb=\"\" _label=\"Test View\" _tip=\"Test the View interface\"/>"
 "                      <separator/>"
 "                      <menuitem name=\"FileExit\" verb=\"\" _label=\"E_xit\"/>"
 "              </submenu>"
 "              <placeholder name=\"Component\"/>"
-"              <submenu name=\"PropertyBags\" _label=\"Property_Bags\">"
+"              <submenu name=\"PropertyBags\" _label=\"Property_Bag\">"
 "                      <menuitem name=\"Size\" verb=\"\" _label=\"Size(PropertyBag)\" _tip=\"Get size\""
 "                      pixtype=\"stock\" pixname=\"Get Size\"/>"