Hi guys,

        Since it's my weekend I thought I'd start getting some bonobo
embeddables into shape for my demo in January at LWE to show that Gnome
office is going to kick some butt :-)

        Anyhow, I put together this minor patch to get some things working
for me; and I'd like to commit it, how is approval / maintainership
working in Dia these days ?

        I'd like to have a free hand to continue doing some bonobo work as
and when neccessary, particularly linking with the printing stuff to get a
bonobo-printing component, and getting stream / file IO interfaces
implemented.

        Regards,

                Michael.

PS. as you can see I miraculously made myself respect 2 (two) stop tabs
and if (something) jam_something_on_the_same_line ;-)

? .README.swp
? jamesh
? lib/stbtbUbi
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/dia/ChangeLog,v
retrieving revision 1.496
diff -u -r1.496 ChangeLog
--- ChangeLog   2001/01/06 15:06:31     1.496
+++ ChangeLog   2001/01/06 18:56:46
@@ -1,3 +1,27 @@
+2001-01-06  Michael Meeks  <[EMAIL PROTECTED]>
+
+       * app/dia_embedd.c (main): add running context support.
+       (dia_embeddable_destroy): remove old running object counting.
+       (embeddable_factory): ditto.
+       (view_factory): comment out menu path hiding.
+
+       * lib/sheet.c (load_register_sheet): use free to free
+       stuff from libxml not g_free.
+
+       * acconfig.h: kill cover for USE_BONOBOX and USE_OAF
+
+       * configure.in: remove USE_OAF checks, check for a precice
+       Bonobo version >= 0.31, revamp bits.
+
+       * app/dia_embedd.c (init_server_factory): upd.
+       (init_dia_factory): remove OAF conditionals, everything uses
+       oaf now.
+
+       * app/GNOME_Dia.oafinfo: rename OAFIIDs
+
+       * app/Makefile.am: remove ancient gnorba code.
+       rename dia.oafinfo to GNOME_Dia.oafinfo
+
 2001-01-06  Hans Breuer <[EMAIL PROTECTED]>
 
        * objects/uml/actor.c
Index: acconfig.h
===================================================================
RCS file: /cvs/gnome/dia/acconfig.h,v
retrieving revision 1.12
diff -u -r1.12 acconfig.h
--- acconfig.h  2000/10/07 05:29:51     1.12
+++ acconfig.h  2001/01/06 18:56:46
@@ -57,12 +57,6 @@
 /* define to enable XIM support */
 #undef USE_XIM
 
-/* define if bonobo uses OAF */
-#undef USE_OAF
-
-/* define to enable bonobo support */
-#undef USE_BONOBOX
-
 
 /* Leave that blank line there!!  Autoheader needs it.
    If you're adding to this file, keep in mind:
Index: configure.in
===================================================================
RCS file: /cvs/gnome/dia/configure.in,v
retrieving revision 1.92
diff -u -r1.92 configure.in
--- configure.in        2000/10/08 05:05:48     1.92
+++ configure.in        2001/01/06 18:56:47
@@ -55,6 +55,7 @@
 GNOME_CFLAGS=""
 GNOME_LIBS=""
 BONOBO_LIBS=""
+bonobo_msg=no
 if test "$GNOME" = "yes"; then
   AC_DEFINE(GNOME)
   components="gnomeui"
@@ -64,36 +65,39 @@
     components="$components print"
   fi
   if test "$enable_bonobo" = "yes"; then
-    hcomponents="$hcomponents bonobo"
-    BONOBO_LIBS=`gnome-config bonobo $components --libs`
 
-    AC_MSG_CHECKING(if bonobo uses oaf)
-    using_oaf="no"
-    if ( gnome-config --libs bonobo | grep oaf ) > /dev/null 2>&1 ; then
-      using_oaf="yes"
-      AC_DEFINE(USE_OAF)
-    fi
-    AC_MSG_RESULT($using_oaf)
-    AM_CONDITIONAL(USING_OAF, test x"$using_oaf" = xyes)
+    AC_MSG_CHECKING(for Bonobo >= 0.31)
 
-    AC_MSG_CHECKING(if bonobo uses bonobox)
-    using_bonobox="no"
-    if ( gnome-config --libs bonobox ) > /dev/null 2>&1 ; then
-      using_bonobox="yes"
-      AC_DEFINE(USE_BONOBOX)
-      BONOBO_LIBS=`gnome-config bonobo bonobox $components --libs`
+    if gnome-config --libs bonobox > /dev/null 2>&1; then
+      vers=`gnome-config --modversion bonobo | sed -e "s/bonobo-//" | \
+       awk 'BEGIN { FS = "."; } { printf "%d", $1 * 1000 + $2;}'`
+      if test "$vers" -ge 31; then
+        bonobo_ok=true
+      else
+        bonobo_ok=false
+      fi
+    else
+      bonobo_ok=false
+    fi
+       
+    if $bonobo_ok; then
+      AC_MSG_RESULT([found ("$vers")])
+      have_bonobo=true
+      bonobo_msg=yes
+    else
+      AC_MSG_RESULT([not found])
     fi
-    AC_MSG_RESULT($using_bonobox)
-    AM_CONDITIONAL(USING_BONOBOX, test x"$using_bonobox" = xyes)
+
     hcomponents="$hcomponents bonobox"
+    BONOBO_LIBS=`gnome-config bonobox $components --libs`
   fi
   GNOME_CFLAGS=`gnome-config $hcomponents $components --cflags`
   GNOME_LIBS=`gnome-config $components --libs`
 fi
 AM_CONDITIONAL(HAVE_GNOME_PRINT,
        test "$GNOME" = "yes" && test "$enable_gnome_print" = "yes")
-AM_CONDITIONAL(HAVE_BONOBO, 
-       test "$GNOME" = "yes" && test "$enable_bonobo" = "yes")
+AM_CONDITIONAL(HAVE_BONOBO, $have_bonobo)
+
 AC_SUBST(GNOME_CFLAGS)
 AC_SUBST(GNOME_LIBS)
 AC_SUBST(BONOBO_LIBS)
@@ -291,7 +295,7 @@
        Libart (AA rendering, png export):      ${have_libart}
 
        Gnome support:                          ${GNOME}
-       Build bonobo component (not supported): ${enable_bonobo}
+       Build bonobo component (not supported): ${bonobo_msg}
         Gnome-print support (not recommended):  ${enable_gnome_print}
 
 Now type make to build dia."
Index: app/GNOME_Dia.oafinfo
===================================================================
RCS file: /cvs/gnome/dia/app/GNOME_Dia.oafinfo,v
retrieving revision 1.1
diff -u -r1.1 GNOME_Dia.oafinfo
--- app/GNOME_Dia.oafinfo       2000/08/09 08:07:57     1.1
+++ app/GNOME_Dia.oafinfo       2001/01/06 18:56:47
@@ -1,6 +1,6 @@
 <oaf_info>
     <oaf_server
-           iid="OAFIID:dia-diagram-factory:31cb6c0f-e1f5-4c54-8824-8f49fd7e50e7"
+           iid="OAFIID:GNOME_Dia_DiagramFactory"
            type="exe" location="dia-embedd">
        <oaf_attribute name="repo_ids" type="stringv">
            <item value="IDL:Bonobo/GenericFactory:1.0"/>
@@ -12,9 +12,9 @@
     </oaf_server>
 
     <oaf_server
-           iid="OAFIID:dia-diagram:10aac381-d349-460b-8a9f-e905de80acb9"
+           iid="OAFIID:GNOME_Dia_Diagram"
            type="factory"
-           location="OAFIID:dia-diagram-factory:31cb6c0f-e1f5-4c54-8824-8f49fd7e50e7">
+           location="OAFIID:GNOME_Dia_DiagramFactory">
        <oaf_attribute name="repo_ids" type="stringv">
            <item value="IDL:Bonobo/Unknown:1.0"/>
            <item value="IDL:Bonobo/Embeddable:1.0"/>
Index: app/Makefile.am
===================================================================
RCS file: /cvs/gnome/dia/app/Makefile.am,v
retrieving revision 1.63
diff -u -r1.63 Makefile.am
--- app/Makefile.am     2001/01/05 16:36:40     1.63
+++ app/Makefile.am     2001/01/06 18:56:48
@@ -29,18 +29,14 @@
 
 if HAVE_BONOBO
 dia_embedd = dia-embedd
-dia_gnorba = dia.gnorba
-dia_oafinfo = dia.oafinfo
+dia_oafinfo = GNOME_Dia.oafinfo
 else
 dia_embedd =
-dia_gnorba =
 dia_oafinfo =
 endif
 
 bin_PROGRAMS = dia $(dia_embedd)
 
-gnorbadir = $(sysconfdir)/CORBA/servers
-gnorba_DATA = $(dia_gnorba)
 oafinfodir = $(datadir)/oaf
 oafinfo_DATA = $(dia_oafinfo)
 
@@ -162,8 +158,7 @@
 LDFLAGS = -export-dynamic
 
 EXTRA_DIST = \
-       dia.gnorba \
-       dia.oafinfo \
+       GNOME_Dia.oafinfo \
        render_gnomeprint.c \
        render_gnomeprint.h \
        paginate_gnomeprint.c \
Index: app/dia_embedd.c
===================================================================
RCS file: /cvs/gnome/dia/app/dia_embedd.c,v
retrieving revision 1.6
diff -u -r1.6 dia_embedd.c
--- app/dia_embedd.c    2000/08/16 23:15:03     1.6
+++ app/dia_embedd.c    2001/01/06 18:56:49
@@ -22,17 +22,13 @@
 
 #include <gnome.h>
 #include <bonobo.h>
-#ifdef USE_OAF
-#  include <liboaf/liboaf.h>
-#else
-#  include <libgnorba/gnorba.h>
-#endif
-
+#include <liboaf/liboaf.h>
 
 #include "display.h"
 #include "menus.h"
 #include "disp_callbacks.h"
 #include "app_procs.h"
+#include "interface.h"
 
 typedef struct _EmbeddedDia EmbeddedDia;
 typedef struct _EmbeddedView EmbeddedView;
@@ -50,9 +46,7 @@
 };
 
 static BonoboGenericFactory *factory = NULL;
-static int running_objects = 0;
 
-
 static void
 dia_view_activate(BonoboView *view, gboolean activate,
                  EmbeddedView *view_data)
@@ -111,14 +105,6 @@
 
   diagram_destroy(embedded_dia->diagram);
   g_free(embedded_dia); 
-
-  running_objects--;
-  if (running_objects > 0)
-    return;
-  
-  /* When last object has gone unref the factory & quit. */
-  bonobo_object_unref(BONOBO_OBJECT(factory));
-  gtk_main_quit();
 }
 
 static void
@@ -142,7 +128,6 @@
 {
   EmbeddedView *view_data;
   BonoboView  *view;
-  GtkWidget *menuitem;
   
   /*
    * Create the private view data.
@@ -178,6 +163,7 @@
                      GTK_SIGNAL_FUNC (dia_view_destroy), view_data);
 
 
+#if 0
   menuitem = menus_get_item_from_path("<Display>/File/New diagram");
   gtk_widget_hide(menuitem);
   menuitem = menus_get_item_from_path("<Display>/File/Open...");
@@ -190,6 +176,7 @@
   gtk_widget_hide(menuitem);
   menuitem = menus_get_item_from_path("<Display>/View/New View");
   gtk_widget_hide(menuitem);
+#endif
   
   return view;
 }
@@ -215,7 +202,6 @@
     return NULL;
   }
        
-  running_objects++;
   embedded_dia->embeddable = embeddable;
 
   gtk_signal_connect(GTK_OBJECT(embeddable), "system_exception",
@@ -232,35 +218,19 @@
 static BonoboGenericFactory *
 init_dia_factory (void)
 {
-#ifdef USE_OAF
-  return bonobo_generic_factory_new 
("OAFIID:dia-diagram-factory:31cb6c0f-e1f5-4c54-8824-8f49fd7e50e7",
+  return bonobo_generic_factory_new ("OAFIID:GNOME_Dia_DiagramFactory",
                                     embeddable_factory, NULL);
-#else
-  return bonobo_generic_factory_new ("embeddable-factory:dia-diagram",
-                                    embeddable_factory, NULL);
-#endif
 }
 
 static void
 init_server_factory (int argc, char **argv)
 {
-  CORBA_Environment ev;
   CORBA_ORB orb;
   
-#ifdef USE_OAF  
-  gnome_init_with_popt_table("bonobo-dia-diagram", VERSION,
-                            argc, argv, oaf_popt_options, 0, NULL);
-  orb = oaf_init(argc, argv);
-#else
-  CORBA_exception_init (&ev);
+  gnome_init_with_popt_table ("dia-embedd", VERSION,
+                             argc, argv, oaf_popt_options, 0, NULL);
 
-  gnome_CORBA_init_with_popt_table ("bonobo-dia-diagram", VERSION,
-                                   &argc, argv, NULL, 0, NULL, 
GNORBA_INIT_SERVER_FUNC, &ev);
-  
-  CORBA_exception_free (&ev);
-  
-  orb = gnome_CORBA_ORB ();
-#endif
+  orb = oaf_init (argc, argv);
 
   if (bonobo_init (orb, NULL, NULL) == FALSE)
     g_error (_("Could not initialize Bonobo!"));
@@ -272,6 +242,14 @@
   return 1;
 }
 
+static void
+last_unref_cb (BonoboObject *bonobo_object,
+              gpointer      dummy)
+{
+  bonobo_object_unref (BONOBO_OBJECT (factory));
+  gtk_main_quit ();
+}
+
 int
 main (int argc, char **argv)
 {
@@ -300,6 +278,11 @@
   gtk_widget_hide(menuitem);
 #endif
   
+
+  gtk_signal_connect (GTK_OBJECT (bonobo_context_running_get ()),
+                     "last_unref",
+                     GTK_SIGNAL_FUNC (last_unref_cb),
+                     NULL);
   /*
    * Start processing.
    */
Index: lib/sheet.c
===================================================================
RCS file: /cvs/gnome/dia/lib/sheet.c,v
retrieving revision 1.14
diff -u -r1.14 sheet.c
--- lib/sheet.c 2000/10/21 14:13:08     1.14
+++ lib/sheet.c 2001/01/06 18:56:50
@@ -240,7 +240,7 @@
       tmp = xmlGetProp(node, "xml:lang");
       if (!tmp) tmp = xmlGetProp(node, "lang");
       score = intl_score_locale(tmp);
-      g_free(tmp);
+      if (tmp) free(tmp);
 
       if (descr_score < 0 || score < descr_score) {
         descr_score = score;
@@ -348,7 +348,7 @@
     set_line_break = FALSE;
 
     if ((otype = object_get_type(tmp)) == NULL) {
-      g_free(sheet_obj->description);
+      if (sheet_obj->description) free (sheet_obj->description);
       g_free(sheet_obj->pixmap_file);
       g_free(sheet_obj->object_type);
       g_free(sheet_obj);

-- 
 [EMAIL PROTECTED]  <><, Pseudo Engineer, itinerant idiot

Reply via email to