ekiga r7804 - in trunk: lib/engine lib/engine/audioinput lib/engine/audiooutput lib/engine/components/common-videooutput lib/engine/components/dx-videooutput lib/engine/components/ldap lib/engine/components/mlogo-videoinput lib/engine/components/null-audioinput lib/engine/components/null-audiooutput lib/engine/components/opal lib/engine/components/ptlib lib/engine/components/x-videooutput lib/engine/framework lib/engine/videoinput src



Author: jpuydt
Date: Mon Mar 23 20:40:41 2009
New Revision: 7804
URL: http://svn.gnome.org/viewvc/ekiga?rev=7804&view=rev

Log:
Major rewrite of the runtime system -- preliminary fix for bug #557889

Removed:
   trunk/lib/engine/framework/runtime-glib.h
Modified:
   trunk/lib/engine/audioinput/audioinput-core.cpp
   trunk/lib/engine/audioinput/audioinput-core.h
   trunk/lib/engine/audiooutput/audiooutput-core.cpp
   trunk/lib/engine/audiooutput/audiooutput-core.h
   trunk/lib/engine/components/common-videooutput/videooutput-manager-common.cpp
   trunk/lib/engine/components/common-videooutput/videooutput-manager-common.h
   trunk/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp
   trunk/lib/engine/components/ldap/ldap-book.cpp
   trunk/lib/engine/components/ldap/ldap-main.cpp
   trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.cpp
   trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.h
   trunk/lib/engine/components/null-audioinput/audioinput-manager-null.cpp
   trunk/lib/engine/components/null-audioinput/audioinput-manager-null.h
   trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.cpp
   trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.h
   trunk/lib/engine/components/opal/h323-endpoint.cpp
   trunk/lib/engine/components/opal/h323-endpoint.h
   trunk/lib/engine/components/opal/opal-call-manager.cpp
   trunk/lib/engine/components/opal/opal-call-manager.h
   trunk/lib/engine/components/opal/opal-call.cpp
   trunk/lib/engine/components/opal/opal-call.h
   trunk/lib/engine/components/opal/sip-endpoint.cpp
   trunk/lib/engine/components/opal/sip-endpoint.h
   trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp
   trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.h
   trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.cpp
   trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.h
   trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
   trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.h
   trunk/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
   trunk/lib/engine/engine.cpp
   trunk/lib/engine/engine.h
   trunk/lib/engine/framework/Makefile.am
   trunk/lib/engine/framework/runtime-glib.cpp
   trunk/lib/engine/framework/runtime.h
   trunk/lib/engine/videoinput/videoinput-core.cpp
   trunk/lib/engine/videoinput/videoinput-core.h
   trunk/src/ekiga.cpp
   trunk/src/ekiga.h

Modified: trunk/lib/engine/audioinput/audioinput-core.cpp
==============================================================================
--- trunk/lib/engine/audioinput/audioinput-core.cpp	(original)
+++ trunk/lib/engine/audioinput/audioinput-core.cpp	Mon Mar 23 20:40:41 2009
@@ -108,9 +108,8 @@
   }*/
 }
 
-AudioInputCore::AudioInputCore (Ekiga::Runtime & _runtime, AudioOutputCore& _audio_output_core)
-:  runtime (_runtime),
-   preview_manager(*this, _audio_output_core)
+AudioInputCore::AudioInputCore (AudioOutputCore& _audio_output_core)
+:  preview_manager(*this, _audio_output_core)
 
 {
   PWaitAndSignal m_var(core_mutex);

Modified: trunk/lib/engine/audioinput/audioinput-core.h
==============================================================================
--- trunk/lib/engine/audioinput/audioinput-core.h	(original)
+++ trunk/lib/engine/audioinput/audioinput-core.h	Mon Mar 23 20:40:41 2009
@@ -95,10 +95,9 @@
   public:
 
       /** The constructor
-       * @param _runtime reference to Ekiga runtime.
        * @param _videooutput_core reference ot the audio output core.
        */
-      AudioInputCore (Ekiga::Runtime & _runtime, AudioOutputCore& _audio_output_core);
+      AudioInputCore (AudioOutputCore& _audio_output_core);
 
       /** The destructor
       */
@@ -325,7 +324,6 @@
 
   private:
 
-      Ekiga::Runtime & runtime;
       std::set<AudioInputManager *> managers;
 
       DeviceConfig preview_config;

Modified: trunk/lib/engine/audiooutput/audiooutput-core.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/audiooutput-core.cpp	(original)
+++ trunk/lib/engine/audiooutput/audiooutput-core.cpp	Mon Mar 23 20:40:41 2009
@@ -40,9 +40,8 @@
 
 using namespace Ekiga;
 
-AudioOutputCore::AudioOutputCore (Ekiga::Runtime & _runtime)
-:  runtime (_runtime),
-   audio_event_scheduler(*this)
+AudioOutputCore::AudioOutputCore ()
+:  audio_event_scheduler(*this)
 {
   PWaitAndSignal m_pri(core_mutex[primary]);
   PWaitAndSignal m_sec(core_mutex[secondary]);

Modified: trunk/lib/engine/audiooutput/audiooutput-core.h
==============================================================================
--- trunk/lib/engine/audiooutput/audiooutput-core.h	(original)
+++ trunk/lib/engine/audiooutput/audiooutput-core.h	Mon Mar 23 20:40:41 2009
@@ -88,9 +88,8 @@
   public:
 
       /** The constructor
-       * @param _runtime reference to Ekiga runtime.
        */
-      AudioOutputCore (Ekiga::Runtime & _runtime);
+      AudioOutputCore ();
 
       /** The destructor
       */
@@ -337,7 +336,6 @@
       void calculate_average_level (const short *buffer, unsigned size);
 
       std::set<AudioOutputManager *> managers;
-      Ekiga::Runtime & runtime;
 
       typedef struct DeviceConfig {
         bool active;

Modified: trunk/lib/engine/components/common-videooutput/videooutput-manager-common.cpp
==============================================================================
--- trunk/lib/engine/components/common-videooutput/videooutput-manager-common.cpp	(original)
+++ trunk/lib/engine/components/common-videooutput/videooutput-manager-common.cpp	Mon Mar 23 20:40:41 2009
@@ -50,14 +50,10 @@
   : PThread (1000, NoAutoDeleteThread, HighestPriority, "GMVideoOutputManager"),
     core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // take a reference on smart in the main thread
-  runtime = smart.get ();
 }
 
 GMVideoOutputManager::~GMVideoOutputManager ()
 {
-  runtime->unreference (); // leave a reference on smart in the main thread
 }
 
 void GMVideoOutputManager::open ()
@@ -254,8 +250,8 @@
 void GMVideoOutputManager::update_gui_device ()
 {
   last_frame.both_streams_active = current_frame.both_streams_active;
-  runtime->run_in_main (device_closed.make_slot ());
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+  Ekiga::Runtime::run_in_main (device_closed.make_slot ());
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
 
 }
 

Modified: trunk/lib/engine/components/common-videooutput/videooutput-manager-common.h
==============================================================================
--- trunk/lib/engine/components/common-videooutput/videooutput-manager-common.h	(original)
+++ trunk/lib/engine/components/common-videooutput/videooutput-manager-common.h	Mon Mar 23 20:40:41 2009
@@ -257,7 +257,6 @@
                               from various threads */
   
     Ekiga::ServiceCore & core;
-    Ekiga::Runtime* runtime;
   };
 
 /**

Modified: trunk/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp
==============================================================================
--- trunk/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp	(original)
+++ trunk/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp	Mon Mar 23 20:40:41 2009
@@ -76,21 +76,21 @@
     
   get_display_info(local_display_info);
 
-//  runtime->run_in_main (force_redraw.make_slot ()); //FIXME: check
+//  Ekiga::Runtime::run_in_main (force_redraw.make_slot ()); //FIXME: check
 
   switch (current_frame.mode) {
   case Ekiga::VO_MODE_LOCAL:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
     break;
   case Ekiga::VO_MODE_REMOTE:
   case Ekiga::VO_MODE_PIP:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
     break;
   case Ekiga::VO_MODE_FULLSCREEN:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
     break;
   case Ekiga::VO_MODE_PIP_WINDOW:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
     break;
   case Ekiga::VO_MODE_UNSET:
   default:
@@ -199,18 +199,18 @@
   if (video_disabled) {
     delete dxWindow;
     dxWindow = NULL;
-    runtime->run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
   }
   else {
     current_frame.accel = Ekiga::VO_ACCEL_ALL; 
-    runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
   }
 }
 
 void
 GMVideoOutputManager_dx::close_frame_display ()
 {
-  runtime->run_in_main (device_closed.make_slot ());
+  Ekiga::Runtime::run_in_main (device_closed.make_slot ());
 
   if (dxWindow) {
 
@@ -242,7 +242,7 @@
     dxWindow->ProcessEvents(); 
 
   if (current_frame.mode == Ekiga::VO_MODE_FULLSCREEN && dxWindow && !dxWindow->IsFullScreen ())
-    runtime->run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), Ekiga::VO_FS_OFF));
+    Ekiga::Runtime::run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), Ekiga::VO_FS_OFF));
 
   if (dxWindow) {
     if (update_required.remote || (!update_required.remote && !update_required.local)) {

Modified: trunk/lib/engine/components/ldap/ldap-book.cpp
==============================================================================
--- trunk/lib/engine/components/ldap/ldap-book.cpp	(original)
+++ trunk/lib/engine/components/ldap/ldap-book.cpp	Mon Mar 23 20:40:41 2009
@@ -760,18 +760,17 @@
 
   if (result <= 0) {
 
-    gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
     if (patience == 3) {
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 12);
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 12);
     } else if (patience == 2) {
 
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 21);
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 21);
     } else if (patience == 1) {
 
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 30);
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 30);
     } else { // patience == 0
 
       status = std::string (_("Could not connect to server"));
@@ -854,21 +853,20 @@
 
   if (result <= 0) {
 
-    gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
     if (patience == 3) {
 
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
 			    12);
     } else if (patience == 2) {
 
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
 			    21);
     } else if (patience == 1) {
 
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
 			    30);
     } else { // patience == 0
 

Modified: trunk/lib/engine/components/ldap/ldap-main.cpp
==============================================================================
--- trunk/lib/engine/components/ldap/ldap-main.cpp	(original)
+++ trunk/lib/engine/components/ldap/ldap-main.cpp	Mon Mar 23 20:40:41 2009
@@ -53,9 +53,8 @@
 			    char** /*argv*/[])
   {
     gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
-    gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
 
-    if (contact_core && runtime) {
+    if (contact_core) {
 
       gmref_ptr<OPENLDAP::Source> service (new OPENLDAP::Source (core));
       core.add (service);

Modified: trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.cpp
==============================================================================
--- trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.cpp	(original)
+++ trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.cpp	Mon Mar 23 20:40:41 2009
@@ -44,15 +44,11 @@
 GMVideoInputManager_mlogo::GMVideoInputManager_mlogo (Ekiga::ServiceCore & _core)
 : core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // keep a reference in the main thread
-  runtime = smart.get ();
   current_state.opened  = false;
 }
 
 GMVideoInputManager_mlogo::~GMVideoInputManager_mlogo ()
 {
-  runtime->unreference ();
 }
 
 void GMVideoInputManager_mlogo::get_devices(std::vector <Ekiga::VideoInputDevice> & devices)
@@ -110,7 +106,7 @@
   settings.colour = 127;
   settings.contrast = 127;
   settings.modifyable = false;
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
   
   return true;
 }
@@ -120,7 +116,7 @@
   PTRACE(4, "GMVideoInputManager_mlogo\tClosing Moving Logo");
   free (background_frame);
   current_state.opened  = false;
-  runtime->run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
 }
 
 bool GMVideoInputManager_mlogo::get_frame_data (char *data)

Modified: trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.h
==============================================================================
--- trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.h	(original)
+++ trunk/lib/engine/components/mlogo-videoinput/videoinput-manager-mlogo.h	Mon Mar 23 20:40:41 2009
@@ -87,7 +87,6 @@
       unsigned increment;
 
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
 
       PAdaptiveDelay adaptive_delay;
   };

Modified: trunk/lib/engine/components/null-audioinput/audioinput-manager-null.cpp
==============================================================================
--- trunk/lib/engine/components/null-audioinput/audioinput-manager-null.cpp	(original)
+++ trunk/lib/engine/components/null-audioinput/audioinput-manager-null.cpp	Mon Mar 23 20:40:41 2009
@@ -42,15 +42,11 @@
 GMAudioInputManager_null::GMAudioInputManager_null (Ekiga::ServiceCore & _core)
 :    core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // take a reference in the main thread
-  runtime = smart.get ();
   current_state.opened = false;
 }
 
 GMAudioInputManager_null::~GMAudioInputManager_null ()
 {
-  runtime->unreference (); // leave a reference in the main thread
 }
 
 void GMAudioInputManager_null::get_devices(std::vector <Ekiga::AudioInputDevice> & devices)
@@ -90,7 +86,7 @@
   Ekiga::AudioInputSettings settings;
   settings.volume = 0;
   settings.modifyable = false;
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
 
   return true;
 }
@@ -98,7 +94,7 @@
 void GMAudioInputManager_null::close()
 {
   current_state.opened = false;
-  runtime->run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
 }
 
 

Modified: trunk/lib/engine/components/null-audioinput/audioinput-manager-null.h
==============================================================================
--- trunk/lib/engine/components/null-audioinput/audioinput-manager-null.h	(original)
+++ trunk/lib/engine/components/null-audioinput/audioinput-manager-null.h	Mon Mar 23 20:40:41 2009
@@ -75,7 +75,6 @@
 
   protected:
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
 
       PAdaptiveDelay adaptive_delay;
   };

Modified: trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.cpp
==============================================================================
--- trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.cpp	(original)
+++ trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.cpp	Mon Mar 23 20:40:41 2009
@@ -41,16 +41,12 @@
 GMAudioOutputManager_null::GMAudioOutputManager_null (Ekiga::ServiceCore & _core)
 : core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // take a reference in the main thread
-  runtime = smart.get ();
   current_state[Ekiga::primary].opened = false;
   current_state[Ekiga::secondary].opened = false;
 }
 
 GMAudioOutputManager_null::~GMAudioOutputManager_null ()
 {
-  runtime->unreference (); // leave a reference in the main thread
 }
 
 void GMAudioOutputManager_null::get_devices(std::vector <Ekiga::AudioOutputDevice> & devices)
@@ -91,7 +87,7 @@
   Ekiga::AudioOutputSettings settings;
   settings.volume = 0;
   settings.modifyable = false;
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
 
   return true;
 }
@@ -99,7 +95,7 @@
 void GMAudioOutputManager_null::close(Ekiga::AudioOutputPS ps)
 {
   current_state[ps].opened = false;
-  runtime->run_in_main (sigc::bind (device_closed.make_slot (), ps, current_state[ps].device));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), ps, current_state[ps].device));
 }
 
 

Modified: trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.h
==============================================================================
--- trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.h	(original)
+++ trunk/lib/engine/components/null-audiooutput/audiooutput-manager-null.h	Mon Mar 23 20:40:41 2009
@@ -74,7 +74,6 @@
 
     protected:
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
 
       PAdaptiveDelay adaptive_delay[2];
   };

Modified: trunk/lib/engine/components/opal/h323-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/h323-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/h323-endpoint.cpp	Mon Mar 23 20:40:41 2009
@@ -93,12 +93,6 @@
   uri_prefix = "h323:";
   listen_port = (_listen_port > 0 ? _listen_port : 1720);
 
-  {
-    gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-    smart->reference (); // take a reference in the main thread
-    runtime = smart.get ();
-  }
-
   /* Initial requested bandwidth */
   SetInitialBandwidth (40000);
 
@@ -112,7 +106,6 @@
 
 Opal::H323::EndPoint::~EndPoint ()
 {
-  runtime->unreference ();
 }
 
 bool Opal::H323::EndPoint::populate_menu (gmref_ptr<Ekiga::Contact> contact,
@@ -332,14 +325,14 @@
         info = _("Failed");
 
       /* Signal */
-      runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+      Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
 					account.registration_event.make_slot (),
 					Ekiga::AccountCore::RegistrationFailed,
 					info));
     }
     else {
 
-      runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+      Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
 					account.registration_event.make_slot (),
 					Ekiga::AccountCore::Registered,
 					std::string ()));
@@ -351,7 +344,7 @@
     RemoveAliasName (account.get_username ());
 
     /* Signal */
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
 				      account.registration_event.make_slot (),
 				      Ekiga::AccountCore::Unregistered,
 				      std::string ()));

Modified: trunk/lib/engine/components/opal/h323-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/h323-endpoint.h	(original)
+++ trunk/lib/engine/components/opal/h323-endpoint.h	Mon Mar 23 20:40:41 2009
@@ -126,7 +126,6 @@
 
       CallManager & manager;
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
 
       PMutex gk_name_mutex;
       PString gk_name;

Modified: trunk/lib/engine/components/opal/opal-call-manager.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-call-manager.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-call-manager.cpp	Mon Mar 23 20:40:41 2009
@@ -141,11 +141,6 @@
   SetMediaFormatMask (PStringArray ());
 
   call_core = core.get ("call-core");
-  {
-    gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-    smart->reference (); // take a reference in the main thread
-    runtime = smart.get ();
-  }
 
   // used to communicate with the StunDetector
 #if GLIB_CHECK_VERSION(2,16,0)
@@ -163,7 +158,6 @@
   ClearAllCalls (OpalConnection::EndedByLocalUser, true);
 
   g_async_queue_unref (queue);
-  runtime->unreference ();
 }
 
 
@@ -174,7 +168,7 @@
     // Ready
     new StunDetector (stun_server, *this, queue);
     patience = 20;
-    runtime->run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult), 1);
+    Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult), 1);
   } else
     ready.emit ();
 }
@@ -651,7 +645,7 @@
 {
   Ekiga::Call *call = dynamic_cast<Ekiga::Call *> (_call);
 
-  runtime->emit_signal_in_main(call->removed);
+  Ekiga::Runtime::emit_signal_in_main(call->removed);
 }
 
 
@@ -746,8 +740,8 @@
   else {
 
       patience--;
-      runtime->run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult),
-			    1);
+      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult),
+				   1);
   }
 }
 
@@ -757,8 +751,8 @@
   // notice we're in for an infinite loop if nobody ever reports to the user!
   if ( !call_core->errors.handle_request (error)) {
 
-    runtime->run_in_main (sigc::bind (sigc::mem_fun (this, &CallManager::ReportSTUNError),
-				      error),
-			  10);
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &CallManager::ReportSTUNError),
+					     error),
+				 10);
   }
 }

Modified: trunk/lib/engine/components/opal/opal-call-manager.h
==============================================================================
--- trunk/lib/engine/components/opal/opal-call-manager.h	(original)
+++ trunk/lib/engine/components/opal/opal-call-manager.h	Mon Mar 23 20:40:41 2009
@@ -177,7 +177,6 @@
        variables */
     PMutex manager_access_mutex;
 
-    Ekiga::Runtime *runtime;
     Ekiga::ServiceCore & core;
     Ekiga::CodecList codecs; 
     gmref_ptr<Ekiga::CallCore> call_core; // FIXME: is it threaded in there?

Modified: trunk/lib/engine/components/opal/opal-call.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-call.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-call.cpp	Mon Mar 23 20:40:41 2009
@@ -77,11 +77,6 @@
   : OpalCall (_manager), Ekiga::Call (), core (_core),
     call_setup(false),outgoing(true),jitter(0)
 {
-  {
-    gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-    smart->reference (); // take a reference in the main thread
-    runtime = smart.get ();
-  }
   re_a_bytes = tr_a_bytes = re_v_bytes = tr_v_bytes = 0.0;
   last_v_tick = last_a_tick = PTime ();
   total_a =
@@ -101,7 +96,6 @@
 
 Opal::Call::~Call ()
 {
-  runtime->unreference (); // leave a reference in the main thead
 }
 
 
@@ -208,9 +202,9 @@
       stream->SetPaused (!paused);
 
       if (paused)
-        runtime->run_in_main (sigc::bind (stream_resumed, stream_name, type));
+	Ekiga::Runtime::run_in_main (sigc::bind (stream_resumed, stream_name, type));
       else
-        runtime->run_in_main (sigc::bind (stream_paused, stream_name, type));
+	Ekiga::Runtime::run_in_main (sigc::bind (stream_paused, stream_name, type));
     }
   }
 }
@@ -376,7 +370,7 @@
   if (!PIsDescendant(&connection, OpalPCSSConnection)) {
 
     parse_info (connection);
-    runtime->emit_signal_in_main (established);
+    Ekiga::Runtime::emit_signal_in_main (established);
   }
 
   if (PIsDescendant(&connection, OpalRTPConnection)) {
@@ -434,7 +428,7 @@
       && !is_outgoing ()
       && GetCallEndReason () != OpalConnection::EndedByAnswerDenied) {
 
-    runtime->emit_signal_in_main (missed);
+    Ekiga::Runtime::emit_signal_in_main (missed);
   }
   else {
 
@@ -516,7 +510,7 @@
       reason = _("Call completed");
     }
 
-    runtime->emit_signal_in_main (cleared, reason);
+    Ekiga::Runtime::emit_signal_in_main (cleared, reason);
   }
 }
 
@@ -538,7 +532,7 @@
 {
   parse_info (connection);
 
-  runtime->emit_signal_in_main (setup);
+  Ekiga::Runtime::emit_signal_in_main (setup);
   call_setup = true;
 
   cleared.connect (sigc::mem_fun (this, &Opal::Call::on_cleared_call));
@@ -554,7 +548,7 @@
 Opal::Call::OnAlerting (OpalConnection & connection)
 {
   if (!PIsDescendant(&connection, OpalPCSSConnection))
-    runtime->emit_signal_in_main (ringing);
+    Ekiga::Runtime::emit_signal_in_main (ringing);
 
   return OpalCall::OnAlerting (connection);
 }
@@ -566,9 +560,9 @@
                     bool on_hold)
 {
   if (on_hold)
-    runtime->emit_signal_in_main (held);
+    Ekiga::Runtime::emit_signal_in_main (held);
   else
-    runtime->emit_signal_in_main (retrieved);
+    Ekiga::Runtime::emit_signal_in_main (retrieved);
 }
 
 
@@ -583,7 +577,7 @@
   std::transform (stream_name.begin (), stream_name.end (), stream_name.begin (), (int (*) (int)) toupper);
   is_transmitting = !stream.IsSource ();
 
-  runtime->run_in_main (sigc::bind (stream_opened, stream_name, type, is_transmitting));
+  Ekiga::Runtime::run_in_main (sigc::bind (stream_opened, stream_name, type, is_transmitting));
 }
 
 
@@ -598,7 +592,7 @@
   std::transform (stream_name.begin (), stream_name.end (), stream_name.begin (), (int (*) (int)) toupper);
   is_transmitting = !stream.IsSource ();
 
-  runtime->run_in_main (sigc::bind (stream_closed, stream_name, type, is_transmitting));
+  Ekiga::Runtime::run_in_main (sigc::bind (stream_closed, stream_name, type, is_transmitting));
 }
 
 

Modified: trunk/lib/engine/components/opal/opal-call.h
==============================================================================
--- trunk/lib/engine/components/opal/opal-call.h	(original)
+++ trunk/lib/engine/components/opal/opal-call.h	Mon Mar 23 20:40:41 2009
@@ -205,7 +205,6 @@
      * Variables
      */
     Ekiga::ServiceCore & core;
-    Ekiga::Runtime* runtime;
 
 
     bool call_setup;

Modified: trunk/lib/engine/components/opal/sip-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.cpp	Mon Mar 23 20:40:41 2009
@@ -132,11 +132,6 @@
   gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
 
   {
-    gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-    smart->reference (); // take a reference in the main thread
-    runtime = smart.get ();
-  }
-  {
     gmref_ptr<Opal::Bank> smart = core.get ("opal-account-store");
     smart->reference (); // take a reference in the main thread
     bank = smart.get ();
@@ -176,7 +171,6 @@
 
 Opal::Sip::EndPoint::~EndPoint ()
 {
-  runtime->unreference (); // leave a reference in the main thread
   bank->unreference (); // leave a reference in the main thread
   dialect->unreference (); // leave a reference in the main thread
 }
@@ -684,7 +678,7 @@
   /* Signal */
   Opal::Account *account = bank->find_account (strm.str ());
   if (account)
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
 				      account->registration_event.make_slot (),
 				      was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
 				      std::string ()));
@@ -918,7 +912,7 @@
   /* Signal */
   Opal::Account *account = bank->find_account (strm.str ());
   if (account)
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
 				      account->registration_event.make_slot (),
 				      wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
 				      info));
@@ -935,7 +929,7 @@
   /* Signal */
   Opal::Account *account = bank->find_account (party);
   if (account)
-    runtime->run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
+    Ekiga::Runtime::run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
 }
 
 
@@ -1000,7 +994,7 @@
     std::string message_uri = (const char *) uri.AsString ();
     std::string _message = (const char *) pdu.GetEntityBody ();
 
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun (push_message_in_main), dialect, message_uri, display_name, _message));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun (push_message_in_main), dialect, message_uri, display_name, _message));
   }
 
   return SIPEndPoint::OnReceivedMESSAGE (transport, pdu);
@@ -1015,7 +1009,7 @@
   std::string uri = (const char *) to.AsString ();
   std::string display_name = (const char *) to.GetDisplayName ();
 
-  runtime->run_in_main (sigc::bind (sigc::ptr_fun (push_notice_in_main),
+  Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun (push_notice_in_main),
 				    dialect, uri, display_name,
 				    _("Could not send message")));
 }
@@ -1112,7 +1106,7 @@
   if (presence != "unknown" && (old_presence != presence || old_status != status)) {
     presence_infos[_uri].presence = presence;
     presence_infos[_uri].status = status;
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, _uri, presence_infos[_uri].presence, presence_infos[_uri].status));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, _uri, presence_infos[_uri].presence, presence_infos[_uri].status));
   }
 }
 
@@ -1155,9 +1149,9 @@
   dialog_infos[uri].status = status;
 
   if (_status)
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, uri, dialog_infos[uri].presence, dialog_infos[uri].status));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, uri, dialog_infos[uri].presence, dialog_infos[uri].status));
   else
-    runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, uri, presence_infos[uri].presence, presence_infos[uri].status));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, uri, presence_infos[uri].presence, presence_infos[uri].status));
 }
 
 

Modified: trunk/lib/engine/components/opal/sip-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.h	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.h	Mon Mar 23 20:40:41 2009
@@ -194,7 +194,6 @@
       std::list<std::string> subscribed_uris;    // List of subscribed uris
       std::list<std::string> aors;               // List of registered aor
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
       Opal::Bank* bank;
 
       Ekiga::CallProtocolManager::Interface listen_iface;

Modified: trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp	(original)
+++ trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp	Mon Mar 23 20:40:41 2009
@@ -44,9 +44,6 @@
 GMAudioInputManager_ptlib::GMAudioInputManager_ptlib (Ekiga::ServiceCore & _core)
 : core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // take a reference in the main thread
-  runtime = smart.get ();
   current_state.opened = false;
   input_device = NULL;
   expectedFrameSize = 0;
@@ -54,7 +51,6 @@
 
 GMAudioInputManager_ptlib::~GMAudioInputManager_ptlib ()
 {
-  runtime->unreference (); // leave a reference in the main thread
 }
 
 void GMAudioInputManager_ptlib::get_devices(std::vector <Ekiga::AudioInputDevice> & devices)
@@ -122,7 +118,7 @@
 
   if (error_code != Ekiga::AI_ERROR_NONE) {
     PTRACE(1, "GMAudioInputManager_ptlib\tEncountered error " << error_code << " while opening device ");
-    runtime->run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
     return false;
   }
 
@@ -133,7 +129,7 @@
   Ekiga::AudioInputSettings settings;
   settings.volume = volume;
   settings.modifyable = true;
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
 
   return true;
 }
@@ -146,7 +142,7 @@
      input_device = NULL;
   }
   current_state.opened = false;
-  runtime->run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
 }
 
 void GMAudioInputManager_ptlib::set_buffer_size (unsigned buffer_size, unsigned num_buffers)
@@ -177,7 +173,7 @@
     }
     if (bytes_read != size) {
       PTRACE(1, "GMAudioInputManager_ptlib\tEncountered error while trying to read data");
-      runtime->run_in_main (sigc::bind (device_error.make_slot (), current_state.device, Ekiga::AI_ERROR_READ));
+      Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), current_state.device, Ekiga::AI_ERROR_READ));
     }
   }
 

Modified: trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.h	(original)
+++ trunk/lib/engine/components/ptlib/audioinput-manager-ptlib.h	Mon Mar 23 20:40:41 2009
@@ -78,7 +78,6 @@
 
   protected:
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
       unsigned expectedFrameSize;
 
       PSoundChannel *input_device;

Modified: trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.cpp	(original)
+++ trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.cpp	Mon Mar 23 20:40:41 2009
@@ -43,9 +43,6 @@
 GMAudioOutputManager_ptlib::GMAudioOutputManager_ptlib (Ekiga::ServiceCore & _core)
 : core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // take a reference in the main thread
-  runtime = smart.get ();
   current_state[Ekiga::primary].opened = false;
   current_state[Ekiga::secondary].opened = false;
   output_device[Ekiga::primary] = NULL;
@@ -54,7 +51,6 @@
 
 GMAudioOutputManager_ptlib::~GMAudioOutputManager_ptlib ()
 {
-  runtime->unreference (); // leave a reference in the main thread
 }
 
 void GMAudioOutputManager_ptlib::get_devices(std::vector <Ekiga::AudioOutputDevice> & devices)
@@ -122,7 +118,7 @@
 
   if (error_code != Ekiga::AO_ERROR_NONE) {
     PTRACE(1, "GMAudioOutputManager_ptlib\tEncountered error " << error_code << " while opening device[" << ps << "]");
-    runtime->run_in_main (sigc::bind (device_error.make_slot (), ps, current_state[ps].device, error_code));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), ps, current_state[ps].device, error_code));
     return false;
   }
 
@@ -133,7 +129,7 @@
   Ekiga::AudioOutputSettings settings;
   settings.volume = volume;
   settings.modifyable = true;
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
 
   return true;
 }
@@ -146,7 +142,7 @@
      output_device[ps] = NULL;
   }
   current_state[ps].opened = false;
-  runtime->run_in_main (sigc::bind (device_closed.make_slot (), ps, current_state[ps].device));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), ps, current_state[ps].device));
 }
 
 void GMAudioOutputManager_ptlib::set_buffer_size (Ekiga::AudioOutputPS ps, unsigned buffer_size, unsigned num_buffers)
@@ -179,7 +175,7 @@
     }
     if (bytes_written != size) {
       PTRACE(1, "GMAudioOutputManager_ptlib\tEncountered error while trying to write data");
-      runtime->run_in_main (sigc::bind (device_error.make_slot (), ps, current_state[ps].device, Ekiga::AO_ERROR_WRITE));
+      Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), ps, current_state[ps].device, Ekiga::AO_ERROR_WRITE));
     }
   }
 

Modified: trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.h	(original)
+++ trunk/lib/engine/components/ptlib/audiooutput-manager-ptlib.h	Mon Mar 23 20:40:41 2009
@@ -79,7 +79,6 @@
 
     protected:
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
 
       PSoundChannel *output_device[2];
   };

Modified: trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp	(original)
+++ trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp	Mon Mar 23 20:40:41 2009
@@ -43,9 +43,6 @@
 GMVideoInputManager_ptlib::GMVideoInputManager_ptlib (Ekiga::ServiceCore & _core)
 : core (_core)
 {
-  gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
-  smart->reference (); // take a reference in the main thread
-  runtime = smart.get ();
   current_state.opened = false;
   input_device = NULL;
   expectedFrameSize = 0;
@@ -53,7 +50,6 @@
 
 GMVideoInputManager_ptlib::~GMVideoInputManager_ptlib ()
 {
-  runtime->unreference (); // leave a reference in the main thread
 }
 
 void GMVideoInputManager_ptlib::get_devices(std::vector <Ekiga::VideoInputDevice> & devices)
@@ -136,7 +132,7 @@
 
   if (error_code != Ekiga::VI_ERROR_NONE) {
     PTRACE(1, "GMVideoInputManager_ptlib\tEncountered error " << error_code << " while opening device ");
-    runtime->run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
     return false;
   }
 
@@ -151,7 +147,7 @@
   settings.contrast = contrast >> 8;
   settings.modifyable = true;
 
-  runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
 
   return true;
 }
@@ -164,7 +160,7 @@
     input_device = NULL;
   }
   current_state.opened = false;
-  runtime->run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
 }
 
 bool GMVideoInputManager_ptlib::get_frame_data (char *data)

Modified: trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.h	(original)
+++ trunk/lib/engine/components/ptlib/videoinput-manager-ptlib.h	Mon Mar 23 20:40:41 2009
@@ -77,7 +77,6 @@
 
   protected:
       Ekiga::ServiceCore & core;
-      Ekiga::Runtime* runtime;
       unsigned expectedFrameSize;
 
       PVideoInputDevice *input_device;

Modified: trunk/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
==============================================================================
--- trunk/lib/engine/components/x-videooutput/videooutput-manager-x.cpp	(original)
+++ trunk/lib/engine/components/x-videooutput/videooutput-manager-x.cpp	Mon Mar 23 20:40:41 2009
@@ -114,17 +114,17 @@
 
   switch (current_frame.mode) {
   case Ekiga::VO_MODE_LOCAL:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
     break;
   case Ekiga::VO_MODE_REMOTE:
   case Ekiga::VO_MODE_PIP:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
     break;
   case Ekiga::VO_MODE_FULLSCREEN:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
     break;
   case Ekiga::VO_MODE_PIP_WINDOW:
-    runtime->run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
+    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
     break;
   case Ekiga::VO_MODE_UNSET:
   default:
@@ -421,17 +421,17 @@
   last_frame.both_streams_active = current_frame.both_streams_active;
 
   if (video_disabled) {
-    runtime->run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
   }
   else {
-    runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+    Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
   }
 }
 
 void
 GMVideoOutputManager_x::close_frame_display ()
 {
-  runtime->run_in_main (device_closed.make_slot ());
+  Ekiga::Runtime::run_in_main (device_closed.make_slot ());
 
   if (rxWindow) 
     rxWindow->RegisterSlave (NULL);
@@ -482,7 +482,7 @@
     lxWindow->ProcessEvents();
 
   if (current_frame.mode == Ekiga::VO_MODE_FULLSCREEN && rxWindow && !rxWindow->IsFullScreen ())
-    runtime->run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), Ekiga::VO_FS_OFF));
+    Ekiga::Runtime::run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), Ekiga::VO_FS_OFF));
 
   if (rxWindow && (update_required.remote || (!update_required.remote && !update_required.local)))
     rxWindow->PutFrame ((uint8_t *) remote_frame, rf_width, rf_height);

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Mon Mar 23 20:40:41 2009
@@ -130,8 +130,7 @@
 
 void
 engine_init (int argc,
-             char *argv [],
-             Ekiga::Runtime* runtime)
+             char *argv [])
 {
   service_core = new Ekiga::ServiceCore;
   Ekiga::KickStart kickstart;
@@ -147,20 +146,16 @@
   gmref_ptr<Ekiga::CallCore> call_core (new Ekiga::CallCore);
   gmref_ptr<Ekiga::ChatCore> chat_core (new Ekiga::ChatCore);
   gmref_ptr<Ekiga::VideoOutputCore> videooutput_core (new Ekiga::VideoOutputCore);
-  gmref_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore(*runtime, *videooutput_core));
-  gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core (new Ekiga::AudioOutputCore(*runtime));
-  gmref_ptr<Ekiga::AudioInputCore> audioinput_core (new Ekiga::AudioInputCore(*runtime, *audiooutput_core));
+  gmref_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore(*videooutput_core));
+  gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core (new Ekiga::AudioOutputCore);
+  gmref_ptr<Ekiga::AudioInputCore> audioinput_core (new Ekiga::AudioInputCore(*audiooutput_core));
   gmref_ptr<Ekiga::HalCore> hal_core (new Ekiga::HalCore);
 
 
   /* The last item in the following list will be destroyed first.   *
    * - VideoInputCore must be destroyed before VideoOutputCore since its  *
-   *   PreviewManager may call functions of VideoOutputCore.            *
-   * - The runtime should be destroyed last since other core        *
-   *   components may still call runtime functions until destroyed  *
-   *   (e.g. VideoOutputCore).                                          */
+   *   PreviewManager may call functions of VideoOutputCore.            */
 
-  service_core->add (gmref_ptr<Ekiga::Runtime>(runtime));
   service_core->add (account_core);
   service_core->add (contact_core);
   service_core->add (chat_core);

Modified: trunk/lib/engine/engine.h
==============================================================================
--- trunk/lib/engine/engine.h	(original)
+++ trunk/lib/engine/engine.h	Mon Mar 23 20:40:41 2009
@@ -46,8 +46,7 @@
  */
 
 void engine_init (int argc,
-		  char *argv[],
-		  Ekiga::Runtime *runtime);
+		  char *argv[]);
 
 Ekiga::ServiceCore* engine_get_service_core ();
 

Modified: trunk/lib/engine/framework/Makefile.am
==============================================================================
--- trunk/lib/engine/framework/Makefile.am	(original)
+++ trunk/lib/engine/framework/Makefile.am	Mon Mar 23 20:40:41 2009
@@ -36,7 +36,6 @@
 	$(framework_dir)/form-builder.cpp \
 	$(framework_dir)/form-dumper.cpp \
 	$(framework_dir)/form-request-simple.cpp \
-	$(framework_dir)/runtime-glib.h \
 	$(framework_dir)/runtime-glib.cpp \
 	$(framework_dir)/services.cpp \
 	$(framework_dir)/trigger.h \

Modified: trunk/lib/engine/framework/runtime-glib.cpp
==============================================================================
--- trunk/lib/engine/framework/runtime-glib.cpp	(original)
+++ trunk/lib/engine/framework/runtime-glib.cpp	Mon Mar 23 20:40:41 2009
@@ -33,7 +33,11 @@
  *
  */
 
-#include "runtime-glib.h"
+#include "runtime.h"
+
+#include <glib.h>
+
+static GAsyncQueue* queue;
 
 /* implementation of the helper functions
  *
@@ -126,39 +130,33 @@
   NULL
 };
 
-Ekiga::GlibRuntime::GlibRuntime ()
+void
+Ekiga::Runtime::init ()
 {
-  struct source *source  = NULL;
+  queue = g_async_queue_new (); // here we get a ref to the queue
 
-  queue = g_async_queue_new (); // this object owns a ref on it
-
-  source = (struct source *)g_source_new (&source_funcs,
+  struct source* source = (struct source *)g_source_new (&source_funcs,
 					  sizeof (struct source));
   source->queue = queue;
-  g_async_queue_ref (source->queue); // the source owns another ref on it
-
+  g_async_queue_ref (queue); // give a ref to the source
   g_source_attach ((GSource *)source, g_main_context_default ());
 }
 
-Ekiga::GlibRuntime::~GlibRuntime ()
-{
-  quit ();
-  g_async_queue_unref (queue);
-}
-
 void
-Ekiga::GlibRuntime::run ()
+Ekiga::Runtime::run ()
 {
 }
 
 void
-Ekiga::GlibRuntime::quit ()
+Ekiga::Runtime::quit ()
 {
+  g_async_queue_unref (queue);
+  queue = NULL;
 }
 
 void
-Ekiga::GlibRuntime::run_in_main (sigc::slot0<void> action,
-				 unsigned int seconds)
+Ekiga::Runtime::run_in_main (sigc::slot0<void> action,
+			     unsigned int seconds)
 {
   g_async_queue_push (queue, (gpointer)(new struct message (action, seconds)));
 }

Modified: trunk/lib/engine/framework/runtime.h
==============================================================================
--- trunk/lib/engine/framework/runtime.h	(original)
+++ trunk/lib/engine/framework/runtime.h	Mon Mar 23 20:40:41 2009
@@ -57,52 +57,38 @@
 namespace Ekiga
 {
 
-/**
- * @addtogroup services
- * @{
- */
+  /**
+   * @addtogroup services
+   * @{
+   */
 
-  class Runtime
-    : public Service
+  namespace Runtime
   {
-  public:
+    void init (); // depends on the implementation
 
-    Runtime ()
-      {}
+    void run (); // depends on the implementation
 
-    virtual ~Runtime ()
-      {}
+    void quit (); // depends on the implementation
 
-    const std::string get_name () const
-      { return "runtime"; }
+    void run_in_main (sigc::slot0<void> action,
+		      unsigned int seconds = 0); // depends on the implementation
 
-    const std::string get_description () const
-      { return "\tObject bringing in the runtime"; }
-
-    virtual void run () = 0;
-
-    virtual void quit () = 0;
-
-    virtual void run_in_main (sigc::slot0<void> action,
-			      unsigned int seconds = 0) = 0;
-    
-
-    void emit_signal_in_main (sigc::signal0<void> sign)
-      {
-        run_in_main (sigc::bind (sigc::ptr_fun (emit_signal_in_main_helper), sign));
-      }
+    inline void emit_signal_in_main (sigc::signal0<void> sign)
+    {
+      run_in_main (sigc::bind (sigc::ptr_fun (emit_signal_in_main_helper), sign));
+    }
 
     template<typename data_type>
     void emit_signal_in_main (sigc::signal1<void, data_type> sign,
                               data_type data)
-      {
-        run_in_main (sigc::bind (sigc::ptr_fun (emit_signal_in_main_helper1<data_type>), sign, data));
-      }
+    {
+      run_in_main (sigc::bind (sigc::ptr_fun (emit_signal_in_main_helper1<data_type>), sign, data));
+    }
   };
 
-/**
- * @}
- */
+  /**
+   * @}
+   */
 
 };
 

Modified: trunk/lib/engine/videoinput/videoinput-core.cpp
==============================================================================
--- trunk/lib/engine/videoinput/videoinput-core.cpp	(original)
+++ trunk/lib/engine/videoinput/videoinput-core.cpp	Mon Mar 23 20:40:41 2009
@@ -121,9 +121,8 @@
   }
 }
 
-VideoInputCore::VideoInputCore (Ekiga::Runtime & _runtime, VideoOutputCore& _videooutput_core)
-:  runtime (_runtime),
-   preview_manager(*this, _videooutput_core)
+VideoInputCore::VideoInputCore (VideoOutputCore& _videooutput_core)
+:  preview_manager(*this, _videooutput_core)
 {
   PWaitAndSignal m_var(core_mutex);
   PWaitAndSignal m_set(settings_mutex);

Modified: trunk/lib/engine/videoinput/videoinput-core.h
==============================================================================
--- trunk/lib/engine/videoinput/videoinput-core.h	(original)
+++ trunk/lib/engine/videoinput/videoinput-core.h	Mon Mar 23 20:40:41 2009
@@ -104,7 +104,7 @@
        * @param _runtime reference to Ekiga runtime.
        * @param _videooutput_core reference ot the video output core.
        */
-      VideoInputCore (Ekiga::Runtime & _runtime, VideoOutputCore& _videooutput_core);
+      VideoInputCore (VideoOutputCore& _videooutput_core);
 
       /** The destructor
        */
@@ -419,8 +419,6 @@
 private:
       std::set<VideoInputManager *> managers;
 
-      Ekiga::Runtime & runtime;
-
       VideoDeviceConfig       preview_config;
       VideoDeviceConfig       stream_config;
 

Modified: trunk/src/ekiga.cpp
==============================================================================
--- trunk/src/ekiga.cpp	(original)
+++ trunk/src/ekiga.cpp	Mon Mar 23 20:40:41 2009
@@ -235,8 +235,9 @@
 {
   PWaitAndSignal m(ep_var_mutex);
 
-  Ekiga::Runtime *runtime = new Ekiga::GlibRuntime;
-  engine_init (argc, argv, runtime);
+  Ekiga::Runtime::init ();
+
+  engine_init (argc, argv);
 }
 
 void
@@ -245,4 +246,6 @@
   PWaitAndSignal m(ep_var_mutex);
 
   engine_stop ();
+
+  Ekiga::Runtime::quit ();
 }

Modified: trunk/src/ekiga.h
==============================================================================
--- trunk/src/ekiga.h	(original)
+++ trunk/src/ekiga.h	Mon Mar 23 20:40:41 2009
@@ -44,7 +44,7 @@
 #include "common.h"
 
 #include "services.h"
-#include "runtime-glib.h"
+#include "runtime.h"
 
 #include "statusicon.h"
 



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