From ae5543d95470154936edb9f777d0d6c1c74a226f Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 23 Aug 1999 06:19:24 +0000 Subject: [PATCH] Replace exit() with gtk_main_quit() 1999-08-23 Miguel de Icaza * bonobo-image-x-pdf.cc: Replace exit() with gtk_main_quit() --- pdf/xpdf/ChangeLog | 4 ++++ pdf/xpdf/bonobo-image-x-pdf.cc | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pdf/xpdf/ChangeLog b/pdf/xpdf/ChangeLog index 9f4772c7..ca4b0a4f 100644 --- a/pdf/xpdf/ChangeLog +++ b/pdf/xpdf/ChangeLog @@ -1,3 +1,7 @@ +1999-08-23 Miguel de Icaza + + * bonobo-image-x-pdf.cc: Replace exit() with gtk_main_quit() + 1999-08-22 Miguel de Icaza * bonobo-image-x-pdf.cc (main): Add error checking for factory diff --git a/pdf/xpdf/bonobo-image-x-pdf.cc b/pdf/xpdf/bonobo-image-x-pdf.cc index 8d49a335..04c90521 100644 --- a/pdf/xpdf/bonobo-image-x-pdf.cc +++ b/pdf/xpdf/bonobo-image-x-pdf.cc @@ -47,6 +47,19 @@ GBool printCommands = gFalse; CORBA_Environment ev; CORBA_ORB orb; +/* + * Number of servers running on the system + * when the count reaches zero, we unregister from the + * Name Server and we shut down. + */ +static int embeddable_servers = 0; + +/* + * Our embeddable factory + */ +static GnomeEmbeddableFactory *factory; + + /* * BonoboObject data */ @@ -276,6 +289,13 @@ extern "C" { gtk_object_unref (GTK_OBJECT (bed->stream)); bed->stream = NULL; g_free (bed); + + embeddable_servers--; + + if (embeddable_servers == 0){ + gnome_object_unref (GNOME_OBJECT (factory)); + gtk_main_quit (); + } } static void @@ -717,6 +737,8 @@ embeddable_factory (GnomeEmbeddableFactory *This, void *data) GTK_OBJECT (embeddable), "destroy", GTK_SIGNAL_FUNC (destroy_embed), bed); + embeddable_servers++; + /* Setup some verbs */ gnome_embeddable_add_verb (embeddable, "FirstPage", @@ -741,8 +763,6 @@ embeddable_factory (GnomeEmbeddableFactory *This, void *data) static gboolean init_bonobo_image_x_pdf_factory (void) { - GnomeEmbeddableFactory *factory; - factory = gnome_embeddable_factory_new ( "bonobo-object-factory:image-x-pdf", embeddable_factory, NULL); -- 2.43.5