[ekiga/ds-gtk-application] Engine: Moved PTLIB PProcess to the OPAL component.



commit 90ec32f8bc74902d67757d51a1a370d05503d057
Author: Damien Sandras <dsandras beip be>
Date:   Tue Feb 4 20:33:25 2014 +0100

    Engine: Moved PTLIB PProcess to the OPAL component.
    
    This is part of it and should not have been separated from the
    component. Especially since we rely on GApplication to handle the main
    Ekiga process.

 lib/Makefile.am                                    |    4 +++-
 lib/engine/components/opal/opal-main.cpp           |    9 ++++++++-
 lib/engine/components/opal/opal-main.h             |    3 +++
 .../engine/components/opal/opal-process.cpp        |   10 +---------
 .../engine/components/opal/opal-process.h          |   11 ++---------
 lib/engine/engine.cpp                              |    4 ++++
 src/Makefile.am                                    |    4 +---
 src/main.cpp                                       |    7 ++-----
 8 files changed, 24 insertions(+), 28 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d476aa0..1482701 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -457,7 +457,9 @@ libekiga_la_SOURCES += \
        engine/components/opal/opal-plugins-hook.h \
        engine/components/opal/opal-plugins-hook.cpp \
        engine/components/opal/opal-presentity.h \
-       engine/components/opal/opal-presentity.cpp
+       engine/components/opal/opal-presentity.cpp \
+       engine/components/opal/opal-process.h \
+       engine/components/opal/opal-process.cpp
 
 if HAVE_H323
 libekiga_la_SOURCES += \
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index e0b5e0d..d460228 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -38,6 +38,7 @@
 #include "config.h"
 
 #include "opal-main.h"
+#include "opal-process.h"
 
 #include "chat-core.h"
 #include "presence-core.h"
@@ -148,9 +149,15 @@ struct OPALSpark: public Ekiga::Spark
 };
 
 void
+opal_init_pprocess ()
+{
+  /* Ekiga PTLIB Process initialisation */
+  static GnomeMeeting instance;
+}
+
+void
 opal_init (Ekiga::KickStart& kickstart)
 {
   boost::shared_ptr<Ekiga::Spark> spark(new OPALSpark);
   kickstart.add_spark (spark);
 }
-
diff --git a/lib/engine/components/opal/opal-main.h b/lib/engine/components/opal/opal-main.h
index 69f9a2a..bbc575e 100644
--- a/lib/engine/components/opal/opal-main.h
+++ b/lib/engine/components/opal/opal-main.h
@@ -40,6 +40,9 @@
 
 #include "kickstart.h"
 
+void opal_init_pprocess ();
+
+// Must be called after opal_init_pprocess.
 void opal_init (Ekiga::KickStart& kickstart);
 
 #endif
diff --git a/src/ekiga.cpp b/lib/engine/components/opal/opal-process.cpp
similarity index 94%
rename from src/ekiga.cpp
rename to lib/engine/components/opal/opal-process.cpp
index fe102b1..dfc0e1b 100644
--- a/src/ekiga.cpp
+++ b/lib/engine/components/opal/opal-process.cpp
@@ -37,7 +37,7 @@
 
 #include "config.h"
 
-#include "ekiga.h"
+#include "opal-process.h"
 
 #include <gtk/gtk.h>
 
@@ -57,14 +57,6 @@ GnomeMeeting::GnomeMeeting ()
 }
 
 
-void
-GnomeMeeting::Exit ()
-{
-  while (gtk_events_pending ())
-    gtk_main_iteration ();
-}
-
-
 GnomeMeeting *
 GnomeMeeting::Process ()
 {
diff --git a/src/ekiga.h b/lib/engine/components/opal/opal-process.h
similarity index 91%
rename from src/ekiga.h
rename to lib/engine/components/opal/opal-process.h
index 778db43..231ed8f 100644
--- a/src/ekiga.h
+++ b/lib/engine/components/opal/opal-process.h
@@ -1,4 +1,5 @@
 
+
 /* Ekiga -- A VoIP and Video-Conferencing application
  * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
  *
@@ -59,17 +60,9 @@ class GnomeMeeting : public PProcess
    */
   GnomeMeeting ();
 
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Prepare the endpoint to exit by removing all
-   *                associated threads and components.
-   * PRE          :  /
-   */
-  void Exit ();
-
-
   /* Needed for PProcess */
   void Main();
+
   static GnomeMeeting *Process ();
 
  private:
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 3aebc26..c06e560 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -88,6 +88,10 @@ engine_init (Ekiga::ServiceCorePtr service_core,
             int argc,
              char *argv [])
 {
+  // AT THE VERY FIRST, create the PProcess
+
+  opal_init_pprocess ();
+
   // FIRST we add a few things by hand
   // (for speed and because that's less code)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 3a955bf..523c32a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,9 +40,7 @@ nodist_ekiga_SOURCES =
 
 # Endpoints
 ekiga_SOURCES +=                       \
-       main.cpp                        \
-       ekiga.h                         \
-       ekiga.cpp
+       main.cpp
 
 # resources
 if WIN32
diff --git a/src/main.cpp b/src/main.cpp
index 02a687a..0c6e95b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -41,6 +41,7 @@
 
 #include <glib/gi18n.h>
 
+#include <ptlib.h>
 #include <opal/buildopts.h> // only for OPAL_VERSION!
 
 
@@ -61,7 +62,6 @@
 #include "call-core.h"
 
 #include "ekiga-app.h"
-#include "ekiga.h"
 
 #ifdef WIN32
 // the linker must not find main
@@ -113,6 +113,7 @@ main (int argc,
   g_set_application_name (_("Ekiga Softphone"));
 #ifndef WIN32
   setenv ("PULSE_PROP_application.name", _("Ekiga Softphone"), true);
+  setenv ("PA_PROP_MEDIA_ROLE", "phone", true);
 #endif
 
   /* Arguments initialization */
@@ -164,9 +165,6 @@ main (int argc,
                        | PTrace::Blocks | PTrace::DateAndTime);
 #endif
 
-  /* Ekiga initialisation */
-  GnomeMeeting instance;
-
   Ekiga::Runtime::init ();
   engine_init (service_core, argc, argv);
 
@@ -214,7 +212,6 @@ main (int argc,
 //  gtk_main ();
 
   /* Exit Ekiga */
-  GnomeMeeting::Process ()->Exit ();
   service_core.reset ();
   Ekiga::Runtime::quit ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]