ekiga r7226 - in trunk: lib/engine lib/engine/account/skel lib/engine/addressbook/call-history lib/engine/addressbook/evolution lib/engine/addressbook/ldap lib/engine/addressbook/skel lib/engine/audioinput/null lib/engine/audioinput/ptlib lib/engine/audioinput/skel lib/engine/audiooutput/null lib/engine/audiooutput/ptlib lib/engine/audiooutput/skel lib/engine/chat/echo lib/engine/chat/skel lib/engine/components/avahi-publisher lib/engine/components/gmconf-personal-details lib/engine/components/gstreamer lib/engine/framework lib/engine/gui/gtk-core lib/engine/gui/gtk-frontend lib/engine/hal/dbus lib/engine/hal/skel lib/engine/presence/avahi lib/engine/presence/local-roster lib/engine/presence/skel lib/engine/protocol/skel lib/engine/videoinput/mlogo lib/engine/videoinput/ptlib lib/engine/videoinput/skel lib/engine/videooutput lib/engine/videooutput/common lib/engine/videooutput/dx lib/engine/videooutput/skel lib/engine/videooutput/x src/components src/devices src/endp oints src/gui
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7226 - in trunk: lib/engine lib/engine/account/skel lib/engine/addressbook/call-history lib/engine/addressbook/evolution lib/engine/addressbook/ldap lib/engine/addressbook/skel lib/engine/audioinput/null lib/engine/audioinput/ptlib lib/engine/audioinput/skel lib/engine/audiooutput/null lib/engine/audiooutput/ptlib lib/engine/audiooutput/skel lib/engine/chat/echo lib/engine/chat/skel lib/engine/components/avahi-publisher lib/engine/components/gmconf-personal-details lib/engine/components/gstreamer lib/engine/framework lib/engine/gui/gtk-core lib/engine/gui/gtk-frontend lib/engine/hal/dbus lib/engine/hal/skel lib/engine/presence/avahi lib/engine/presence/local-roster lib/engine/presence/skel lib/engine/protocol/skel lib/engine/videoinput/mlogo lib/engine/videoinput/ptlib lib/engine/videoinput/skel lib/engine/videooutput lib/engine/videooutput/common lib/engine/videooutput/dx lib/engine/videooutput/skel lib/engine/videooutput/x src/components src/devices src/endp oints src/gui
- Date: Wed, 15 Oct 2008 12:53:55 +0000 (UTC)
Author: jpuydt
Date: Wed Oct 15 12:53:55 2008
New Revision: 7226
URL: http://svn.gnome.org/viewvc/ekiga?rev=7226&view=rev
Log:
Use gmref_ptr to store the services
Modified:
trunk/lib/engine/Makefile.am
trunk/lib/engine/account/skel/Makefile.am
trunk/lib/engine/account/skel/bank-impl.h
trunk/lib/engine/addressbook/call-history/Makefile.am
trunk/lib/engine/addressbook/call-history/history-book.cpp
trunk/lib/engine/addressbook/call-history/history-contact.cpp
trunk/lib/engine/addressbook/call-history/history-contact.h
trunk/lib/engine/addressbook/call-history/history-main.cpp
trunk/lib/engine/addressbook/evolution/Makefile.am
trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
trunk/lib/engine/addressbook/evolution/evolution-main.cpp
trunk/lib/engine/addressbook/evolution/evolution-source.h
trunk/lib/engine/addressbook/ldap/Makefile.am
trunk/lib/engine/addressbook/ldap/ldap-book.cpp
trunk/lib/engine/addressbook/ldap/ldap-book.h
trunk/lib/engine/addressbook/ldap/ldap-contact.cpp
trunk/lib/engine/addressbook/ldap/ldap-main.cpp
trunk/lib/engine/addressbook/skel/Makefile.am
trunk/lib/engine/audioinput/null/Makefile.am
trunk/lib/engine/audioinput/null/audioinput-main-null.cpp
trunk/lib/engine/audioinput/null/audioinput-manager-null.cpp
trunk/lib/engine/audioinput/null/audioinput-manager-null.h
trunk/lib/engine/audioinput/ptlib/Makefile.am
trunk/lib/engine/audioinput/ptlib/audioinput-main-ptlib.cpp
trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.cpp
trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.h
trunk/lib/engine/audioinput/skel/Makefile.am
trunk/lib/engine/audiooutput/null/Makefile.am
trunk/lib/engine/audiooutput/null/audiooutput-main-null.cpp
trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp
trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h
trunk/lib/engine/audiooutput/ptlib/Makefile.am
trunk/lib/engine/audiooutput/ptlib/audiooutput-main-ptlib.cpp
trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp
trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h
trunk/lib/engine/audiooutput/skel/Makefile.am
trunk/lib/engine/chat/echo/Makefile.am
trunk/lib/engine/chat/echo/echo-dialect.h
trunk/lib/engine/chat/echo/echo-main.cpp
trunk/lib/engine/chat/skel/Makefile.am
trunk/lib/engine/components/avahi-publisher/Makefile.am
trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.cpp
trunk/lib/engine/components/gmconf-personal-details/Makefile.am
trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details-main.cpp
trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details.h
trunk/lib/engine/components/gstreamer/Makefile.am
trunk/lib/engine/components/gstreamer/gst-main.cpp
trunk/lib/engine/engine.cpp
trunk/lib/engine/framework/Makefile.am
trunk/lib/engine/framework/menu-xml.cpp
trunk/lib/engine/framework/personal-details.h
trunk/lib/engine/framework/services.cpp
trunk/lib/engine/framework/services.h
trunk/lib/engine/gui/gtk-core/Makefile.am
trunk/lib/engine/gui/gtk-core/gtk-core-main.cpp
trunk/lib/engine/gui/gtk-frontend/Makefile.am
trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
trunk/lib/engine/hal/dbus/Makefile.am
trunk/lib/engine/hal/dbus/hal-main-dbus.cpp
trunk/lib/engine/hal/dbus/hal-manager-dbus.cpp
trunk/lib/engine/hal/dbus/hal-manager-dbus.h
trunk/lib/engine/hal/skel/Makefile.am
trunk/lib/engine/presence/avahi/Makefile.am
trunk/lib/engine/presence/avahi/avahi-cluster.cpp
trunk/lib/engine/presence/avahi/avahi-cluster.h
trunk/lib/engine/presence/avahi/avahi-main.cpp
trunk/lib/engine/presence/local-roster/Makefile.am
trunk/lib/engine/presence/local-roster/local-cluster.cpp
trunk/lib/engine/presence/local-roster/local-cluster.h
trunk/lib/engine/presence/local-roster/local-heap.cpp
trunk/lib/engine/presence/local-roster/local-heap.h
trunk/lib/engine/presence/local-roster/local-presentity.cpp
trunk/lib/engine/presence/local-roster/local-presentity.h
trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
trunk/lib/engine/presence/local-roster/local-roster-main.cpp
trunk/lib/engine/presence/skel/Makefile.am
trunk/lib/engine/presence/skel/presence-core.cpp
trunk/lib/engine/presence/skel/presence-core.h
trunk/lib/engine/presence/skel/uri-presentity.cpp
trunk/lib/engine/presence/skel/uri-presentity.h
trunk/lib/engine/protocol/skel/Makefile.am
trunk/lib/engine/videoinput/mlogo/Makefile.am
trunk/lib/engine/videoinput/mlogo/videoinput-main-mlogo.cpp
trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp
trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h
trunk/lib/engine/videoinput/ptlib/Makefile.am
trunk/lib/engine/videoinput/ptlib/videoinput-main-ptlib.cpp
trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp
trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h
trunk/lib/engine/videoinput/skel/Makefile.am
trunk/lib/engine/videooutput/Makefile.am
trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp
trunk/lib/engine/videooutput/common/videooutput-manager-common.h
trunk/lib/engine/videooutput/dx/Makefile.am
trunk/lib/engine/videooutput/dx/videooutput-main-dx.cpp
trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp
trunk/lib/engine/videooutput/skel/Makefile.am
trunk/lib/engine/videooutput/x/Makefile.am
trunk/lib/engine/videooutput/x/videooutput-main-x.cpp
trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp
trunk/src/components/dbus.cpp
trunk/src/devices/audiodev.cpp
trunk/src/devices/audiodev.h
trunk/src/devices/videoinput.cpp
trunk/src/devices/videoinput.h
trunk/src/devices/videooutput.cpp
trunk/src/devices/videooutput.h
trunk/src/endpoints/h323-endpoint.cpp
trunk/src/endpoints/h323-endpoint.h
trunk/src/endpoints/manager.cpp
trunk/src/endpoints/manager.h
trunk/src/endpoints/opal-account.cpp
trunk/src/endpoints/opal-call.cpp
trunk/src/endpoints/opal-call.h
trunk/src/endpoints/opal-main.cpp
trunk/src/endpoints/pcss.cpp
trunk/src/endpoints/pcss.h
trunk/src/endpoints/sip-chat-simple.cpp
trunk/src/endpoints/sip-endpoint.cpp
trunk/src/endpoints/sip-endpoint.h
trunk/src/gui/accounts.cpp
trunk/src/gui/assistant.cpp
trunk/src/gui/main.cpp
trunk/src/gui/preferences.cpp
trunk/src/gui/statusicon.cpp
Modified: trunk/lib/engine/Makefile.am
==============================================================================
--- trunk/lib/engine/Makefile.am (original)
+++ trunk/lib/engine/Makefile.am Wed Oct 15 12:53:55 2008
@@ -4,6 +4,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf/ \
+ -I$(top_srcdir)/lib/gmref/ \
-I$(top_srcdir)/lib/engine/ \
-I$(top_srcdir)/lib/engine/gui/gtk-core \
-I$(top_srcdir)/lib/engine/gui/gtk-frontend \
Modified: trunk/lib/engine/account/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/account/skel/Makefile.am (original)
+++ trunk/lib/engine/account/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework
Modified: trunk/lib/engine/account/skel/bank-impl.h
==============================================================================
--- trunk/lib/engine/account/skel/bank-impl.h (original)
+++ trunk/lib/engine/account/skel/bank-impl.h Wed Oct 15 12:53:55 2008
@@ -153,7 +153,6 @@
protected:
ServiceCore & core;
- AccountCore *account_core;
private:
void on_registration_event (Ekiga::AccountCore::RegistrationState, std::string info, Ekiga::Account *account);
@@ -172,9 +171,6 @@
template<typename T>
Ekiga::BankImpl<T>::BankImpl (Ekiga::ServiceCore & _core) : core (_core)
{
- /* Account Core */
- account_core = dynamic_cast<Ekiga::AccountCore*> (core.get ("account-core"));
-
/* this is signal forwarding */
Lister<T>::object_added.connect (account_added.make_slot ());
Lister<T>::object_removed.connect (account_removed.make_slot ());
@@ -199,7 +195,6 @@
template<typename T>
Ekiga::BankImpl<T>::~BankImpl ()
{
- account_core->remove_bank (*this);
}
Modified: trunk/lib/engine/addressbook/call-history/Makefile.am
==============================================================================
--- trunk/lib/engine/addressbook/call-history/Makefile.am (original)
+++ trunk/lib/engine/addressbook/call-history/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,8 +5,9 @@
AM_CPPFLAGS = $(XML_CFLAGS) $(SIGC_CFLAGS) $(GLIB_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
+ -I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/addressbook/skel \
-I$(top_srcdir)/lib/engine/protocol/skel
Modified: trunk/lib/engine/addressbook/call-history/history-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-book.cpp (original)
+++ trunk/lib/engine/addressbook/call-history/history-book.cpp Wed Oct 15 12:53:55 2008
@@ -84,8 +84,7 @@
xmlDocSetRootElement (doc, root);
}
- Ekiga::CallCore *call_core
- = dynamic_cast<Ekiga::CallCore*>(core.get ("call-core"));
+ gmref_ptr<Ekiga::CallCore> call_core = core.get ("call-core");
call_core->missed_call.connect (sigc::mem_fun (this, &History::Book::on_missed_call));
call_core->cleared_call.connect (sigc::mem_fun (this, &History::Book::on_cleared_call));
Modified: trunk/lib/engine/addressbook/call-history/history-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.cpp (original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.cpp Wed Oct 15 12:53:55 2008
@@ -47,10 +47,8 @@
xmlNodePtr _node):
core(_core), node(_node)
{
- xmlChar *xml_str;
-
- contact_core
- = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
+ xmlChar* xml_str = NULL;
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
xml_str = xmlGetProp (node, (const xmlChar *)"type");
if (xml_str != NULL) {
@@ -109,10 +107,9 @@
call_type c_t):
core(_core), name(_name), uri(_uri), call_start(_call_start), call_duration(_call_duration), m_type(c_t)
{
- gchar *tmp = NULL;
+ gchar* tmp = NULL;
std::string callp;
- contact_core
- = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
node = xmlNewNode (NULL, BAD_CAST "entry");
@@ -171,6 +168,7 @@
bool
History::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
return contact_core->populate_contact_menu (*this, uri, builder);
}
Modified: trunk/lib/engine/addressbook/call-history/history-contact.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.h (original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.h Wed Oct 15 12:53:55 2008
@@ -96,7 +96,6 @@
private:
Ekiga::ServiceCore &core;
- Ekiga::ContactCore *contact_core;
xmlNodePtr node;
std::string name;
Modified: trunk/lib/engine/addressbook/call-history/history-main.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-main.cpp (original)
+++ trunk/lib/engine/addressbook/call-history/history-main.cpp Wed Oct 15 12:53:55 2008
@@ -46,20 +46,13 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::ContactCore *contact_core = NULL;
- Ekiga::CallCore *call_core = NULL;
- History::Source *source = NULL;
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
+ gmref_ptr<Ekiga::CallCore> call_core = core.get ("call-core");
- contact_core
- = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
+ if (contact_core && call_core) {
- call_core
- = dynamic_cast<Ekiga::CallCore*>(core.get ("call-core"));
-
- if (contact_core != NULL && call_core != NULL) {
-
- source = new History::Source (core);
- core.add (*source);
+ gmref_ptr<History::Source> source = new History::Source (core);
+ core.add (source);
contact_core->add_source (*source);
result = true;
}
Modified: trunk/lib/engine/addressbook/evolution/Makefile.am
==============================================================================
--- trunk/lib/engine/addressbook/evolution/Makefile.am (original)
+++ trunk/lib/engine/addressbook/evolution/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,7 +5,7 @@
AM_CXXFLAGS = $(SIGC_CFLAGS) $(EDS_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/addressbook/skel
Modified: trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-contact.cpp (original)
+++ trunk/lib/engine/addressbook/evolution/evolution-contact.cpp Wed Oct 15 12:53:55 2008
@@ -205,11 +205,11 @@
bool
Evolution::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
- Ekiga::ContactCore *core = dynamic_cast<Ekiga::ContactCore *>(services.get ("contact-core"));
+ gmref_ptr<Ekiga::ContactCore> core = services.get ("contact-core");
bool populated = false;
std::map<std::string, std::string> uris;
- if (core != NULL) {
+ if (core) {
Ekiga::TemporaryMenuBuilder tmp_builder;
Modified: trunk/lib/engine/addressbook/evolution/evolution-main.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-main.cpp (original)
+++ trunk/lib/engine/addressbook/evolution/evolution-main.cpp Wed Oct 15 12:53:55 2008
@@ -39,47 +39,18 @@
#include "contact-core.h"
#include "evolution-source.h"
-namespace Evolution
-{
- class Service: public Ekiga::Service
- {
- public:
-
- Service (Evolution::Source *_source): source(_source)
- {}
-
- ~Service ()
- { delete source; }
-
- const std::string get_name () const
- { return "evolution-source"; }
-
- const std::string get_description () const
- { return "\tComponent bringing in gnome addressbooks"; }
-
- private:
-
- Evolution::Source *source;
- };
-};
-
bool
evolution_init (Ekiga::ServiceCore &services,
int */*argc*/,
char **/*argv*/[])
{
bool result = false;
- Ekiga::ContactCore *core = NULL;
- Evolution::Source *source = NULL;
- Evolution::Service *service = NULL;
-
- core = dynamic_cast<Ekiga::ContactCore*>(services.get ("contact-core"));
+ gmref_ptr<Ekiga::ContactCore> core = services.get ("contact-core");
- if (core != NULL) {
+ if (core) {
- source = new Evolution::Source (services);
- service = new Evolution::Service (source);
- services.add (*service);
+ gmref_ptr<Evolution::Source> source = new Evolution::Source (services);
+ services.add (source);
core->add_source (*source);
result = true;
}
Modified: trunk/lib/engine/addressbook/evolution/evolution-source.h
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-source.h (original)
+++ trunk/lib/engine/addressbook/evolution/evolution-source.h Wed Oct 15 12:53:55 2008
@@ -54,7 +54,9 @@
* @{
*/
- class Source: public Ekiga::SourceImpl<Book>
+ class Source:
+ public Ekiga::Service,
+ public Ekiga::SourceImpl<Book>
{
public:
@@ -64,6 +66,13 @@
bool populate_menu (Ekiga::MenuBuilder &builder);
+ /* this object is an Ekiga::Service too */
+ const std::string get_name () const
+ { return "evolution-source"; }
+
+ const std::string get_description () const
+ { return "\tComponent bringing in gnome addressbooks"; }
+
/* those should be private, but need to be called from C */
void add_group (ESourceGroup *group);
Modified: trunk/lib/engine/addressbook/ldap/Makefile.am
==============================================================================
--- trunk/lib/engine/addressbook/ldap/Makefile.am (original)
+++ trunk/lib/engine/addressbook/ldap/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/addressbook/skel
Modified: trunk/lib/engine/addressbook/ldap/ldap-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.cpp (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.cpp Wed Oct 15 12:53:55 2008
@@ -170,8 +170,7 @@
xmlNodePtr _node):
saslform(NULL), core(_core), node(_node),
name_node(NULL), uri_node(NULL), authcID_node(NULL), password_node(NULL),
- ldap_context(NULL), patience(0),
- runtime (*(dynamic_cast<Ekiga::Runtime *>(core.get ("runtime"))))
+ ldap_context(NULL), patience(0)
{
xmlChar *xml_str;
bool upgrade_config = false;
@@ -181,8 +180,6 @@
xmlNodePtr hostname_node = NULL, port_node = NULL, base_node = NULL,
scope_node = NULL, call_attribute_node = NULL;
- contact_core = dynamic_cast<Ekiga::ContactCore *>(core.get ("contact-core"));
-
bookinfo.name = "";
bookinfo.uri = "";
bookinfo.authcID = "";
@@ -341,11 +338,8 @@
OPENLDAP::BookInfo _bookinfo):
saslform(NULL), core(_core), name_node(NULL),
uri_node(NULL), authcID_node(NULL), password_node(NULL),
- ldap_context(NULL), patience(0),
- runtime (*(dynamic_cast<Ekiga::Runtime *>(core.get ("runtime"))))
+ ldap_context(NULL), patience(0)
{
- contact_core = dynamic_cast<Ekiga::ContactCore *>(core.get ("contact-core"));
-
node = xmlNewNode (NULL, BAD_CAST "server");
bookinfo = _bookinfo;
@@ -733,7 +727,7 @@
updated.emit ();
patience = 3;
- runtime.run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_bound), 0);
+ refresh_bound ();
}
void
@@ -755,17 +749,21 @@
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);
+ 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);
+ 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);
+ runtime->run_in_main (sigc::mem_fun (this,
+ &OPENLDAP::Book::refresh_bound), 30);
} else { // patience == 0
status = std::string (_("Could not connect to server"));
@@ -829,8 +827,7 @@
}
patience = 3;
- runtime.run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result), 0);
-
+ refresh_result ();
}
void
@@ -850,18 +847,25 @@
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), 12);
+ 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), 21);
+ 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), 30);
+ runtime->run_in_main (sigc::mem_fun (this,
+ &OPENLDAP::Book::refresh_result),
+ 30);
} else { // patience == 0
status = std::string (_("Could not search"));
Modified: trunk/lib/engine/addressbook/ldap/ldap-book.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.h (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.h Wed Oct 15 12:53:55 2008
@@ -130,7 +130,6 @@
void on_edit_form_submitted (Ekiga::Form &);
Ekiga::ServiceCore &core;
- Ekiga::ContactCore *contact_core;
xmlNodePtr node;
xmlNodePtr name_node;
@@ -145,8 +144,6 @@
std::string status;
std::string search_filter;
-
- Ekiga::Runtime & runtime;
};
/**
Modified: trunk/lib/engine/addressbook/ldap/ldap-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-contact.cpp (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-contact.cpp Wed Oct 15 12:53:55 2008
@@ -68,8 +68,7 @@
bool
OPENLDAP::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
- Ekiga::ContactCore *contact_core
- = dynamic_cast<Ekiga::ContactCore *>(core.get ("contact-core"));
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
/* FIXME: add here the specific actions we want to allow
* (before or after the uri-specific actions)
*/
Modified: trunk/lib/engine/addressbook/ldap/ldap-main.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-main.cpp (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-main.cpp Wed Oct 15 12:53:55 2008
@@ -48,17 +48,15 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::ContactCore *contact_core = NULL;
- OPENLDAP::Source *service = NULL;
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
+ gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
- contact_core = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
+ if (contact_core && runtime) {
- if (contact_core != NULL) {
-
- service = new OPENLDAP::Source (core);
- core.add (*service);
+ gmref_ptr<OPENLDAP::Source> service = new OPENLDAP::Source (core);
+ core.add (service);
contact_core->add_source (*service);
- sasl_client_init (NULL);
+ sasl_client_init (NULL); // FIXME: shouldn't it be done by the source!?
result = true;
}
Modified: trunk/lib/engine/addressbook/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/addressbook/skel/Makefile.am (original)
+++ trunk/lib/engine/addressbook/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,7 +5,7 @@
AM_CXXFLAGS = $(SIGC_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework
libgmaddressbook_la_SOURCES = \
Modified: trunk/lib/engine/audioinput/null/Makefile.am
==============================================================================
--- trunk/lib/engine/audioinput/null/Makefile.am (original)
+++ trunk/lib/engine/audioinput/null/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/audiooutput/skel \
Modified: trunk/lib/engine/audioinput/null/audioinput-main-null.cpp
==============================================================================
--- trunk/lib/engine/audioinput/null/audioinput-main-null.cpp (original)
+++ trunk/lib/engine/audioinput/null/audioinput-main-null.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::AudioInputCore *audioinput_core = NULL;
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core.get ("audioinput-core");
- audioinput_core
- = dynamic_cast<Ekiga::AudioInputCore*>(core.get ("audioinput-core"));
-
- if (audioinput_core != NULL) {
+ if (audioinput_core) {
GMAudioInputManager_null *audioinput_manager = new GMAudioInputManager_null(core);
Modified: trunk/lib/engine/audioinput/null/audioinput-manager-null.cpp
==============================================================================
--- trunk/lib/engine/audioinput/null/audioinput-manager-null.cpp (original)
+++ trunk/lib/engine/audioinput/null/audioinput-manager-null.cpp Wed Oct 15 12:53:55 2008
@@ -40,11 +40,19 @@
GMAudioInputManager_null::GMAudioInputManager_null (Ekiga::ServiceCore & _core)
-: core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
current_state.opened = false;
}
+GMAudioInputManager_null::~GMAudioInputManager_null ()
+{
+ gmref_dec (runtime); // leave a reference in the main thread
+}
+
void GMAudioInputManager_null::get_devices(std::vector <Ekiga::AudioInputDevice> & devices)
{
Ekiga::AudioInputDevice device;
@@ -82,7 +90,7 @@
Ekiga::AudioInputSettings settings;
settings.volume = 0;
settings.modifyable = false;
- runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+ runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
return true;
}
@@ -90,7 +98,7 @@
void GMAudioInputManager_null::close()
{
current_state.opened = false;
- runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+ runtime->run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
}
Modified: trunk/lib/engine/audioinput/null/audioinput-manager-null.h
==============================================================================
--- trunk/lib/engine/audioinput/null/audioinput-manager-null.h (original)
+++ trunk/lib/engine/audioinput/null/audioinput-manager-null.h Wed Oct 15 12:53:55 2008
@@ -56,8 +56,7 @@
GMAudioInputManager_null (Ekiga::ServiceCore & core);
- virtual ~GMAudioInputManager_null () {}
-
+ ~GMAudioInputManager_null ();
virtual bool set_device (const Ekiga::AudioInputDevice & device);
@@ -76,7 +75,7 @@
protected:
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
PAdaptiveDelay adaptive_delay;
};
Modified: trunk/lib/engine/audioinput/ptlib/Makefile.am
==============================================================================
--- trunk/lib/engine/audioinput/ptlib/Makefile.am (original)
+++ trunk/lib/engine/audioinput/ptlib/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/audiooutput/skel \
Modified: trunk/lib/engine/audioinput/ptlib/audioinput-main-ptlib.cpp
==============================================================================
--- trunk/lib/engine/audioinput/ptlib/audioinput-main-ptlib.cpp (original)
+++ trunk/lib/engine/audioinput/ptlib/audioinput-main-ptlib.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::AudioInputCore *audioinput_core = NULL;
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core.get ("audioinput-core");
- audioinput_core
- = dynamic_cast<Ekiga::AudioInputCore*>(core.get ("audioinput-core"));
-
- if (audioinput_core != NULL) {
+ if (audioinput_core) {
GMAudioInputManager_ptlib *audioinput_manager = new GMAudioInputManager_ptlib(core);
Modified: trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.cpp (original)
+++ trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.cpp Wed Oct 15 12:53:55 2008
@@ -42,14 +42,21 @@
GMAudioInputManager_ptlib::GMAudioInputManager_ptlib (Ekiga::ServiceCore & _core)
-: core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
current_state.opened = false;
input_device = NULL;
expectedFrameSize = 0;
}
+GMAudioInputManager_ptlib::~GMAudioInputManager_ptlib ()
+{
+ gmref_dec (runtime); // leave a reference in the main thread
+}
+
void GMAudioInputManager_ptlib::get_devices(std::vector <Ekiga::AudioInputDevice> & devices)
{
PStringArray audio_sources;
@@ -115,7 +122,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));
+ runtime->run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
return false;
}
@@ -126,7 +133,7 @@
Ekiga::AudioInputSettings settings;
settings.volume = volume;
settings.modifyable = true;
- runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+ runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
return true;
}
@@ -139,7 +146,7 @@
input_device = NULL;
}
current_state.opened = false;
- runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+ 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)
@@ -170,7 +177,7 @@
}
else {
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));
+ runtime->run_in_main (sigc::bind (device_error.make_slot (), current_state.device, Ekiga::AI_ERROR_READ));
}
}
return ret;
Modified: trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.h (original)
+++ trunk/lib/engine/audioinput/ptlib/audioinput-manager-ptlib.h Wed Oct 15 12:53:55 2008
@@ -56,8 +56,7 @@
GMAudioInputManager_ptlib (Ekiga::ServiceCore & core);
- virtual ~GMAudioInputManager_ptlib () {}
-
+ ~GMAudioInputManager_ptlib ();
virtual bool set_device (const Ekiga::AudioInputDevice & device);
@@ -79,7 +78,7 @@
protected:
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
unsigned expectedFrameSize;
PSoundChannel *input_device;
Modified: trunk/lib/engine/audioinput/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/audioinput/skel/Makefile.am (original)
+++ trunk/lib/engine/audioinput/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/audiooutput/skel \
Modified: trunk/lib/engine/audiooutput/null/Makefile.am
==============================================================================
--- trunk/lib/engine/audiooutput/null/Makefile.am (original)
+++ trunk/lib/engine/audiooutput/null/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/audiooutput/skel \
Modified: trunk/lib/engine/audiooutput/null/audiooutput-main-null.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/null/audiooutput-main-null.cpp (original)
+++ trunk/lib/engine/audiooutput/null/audiooutput-main-null.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::AudioOutputCore *audiooutput_core = NULL;
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core.get ("audiooutput-core");
- audiooutput_core
- = dynamic_cast<Ekiga::AudioOutputCore*>(core.get ("audiooutput-core"));
-
- if (audiooutput_core != NULL) {
+ if (audiooutput_core) {
GMAudioOutputManager_null *audiooutput_manager = new GMAudioOutputManager_null(core);
Modified: trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp (original)
+++ trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp Wed Oct 15 12:53:55 2008
@@ -39,13 +39,20 @@
#define DEVICE_NAME "SILENT"
GMAudioOutputManager_null::GMAudioOutputManager_null (Ekiga::ServiceCore & _core)
-: core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
current_state[Ekiga::primary].opened = false;
current_state[Ekiga::secondary].opened = false;
}
+GMAudioOutputManager_null::~GMAudioOutputManager_null ()
+{
+ gmref_dec (runtime); // leave a reference in the main thread
+}
+
void GMAudioOutputManager_null::get_devices(std::vector <Ekiga::AudioOutputDevice> & devices)
{
Ekiga::AudioOutputDevice device;
@@ -84,7 +91,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));
+ runtime->run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
return true;
}
@@ -92,7 +99,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));
+ runtime->run_in_main (sigc::bind (device_closed.make_slot (), ps, current_state[ps].device));
}
Modified: trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h
==============================================================================
--- trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h (original)
+++ trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h Wed Oct 15 12:53:55 2008
@@ -55,7 +55,7 @@
GMAudioOutputManager_null (Ekiga::ServiceCore & core);
- virtual ~GMAudioOutputManager_null () {}
+ ~GMAudioOutputManager_null ();
virtual void get_devices (std::vector <Ekiga::AudioOutputDevice> & devices);
@@ -74,7 +74,7 @@
protected:
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
PAdaptiveDelay adaptive_delay[2];
};
Modified: trunk/lib/engine/audiooutput/ptlib/Makefile.am
==============================================================================
--- trunk/lib/engine/audiooutput/ptlib/Makefile.am (original)
+++ trunk/lib/engine/audiooutput/ptlib/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/audiooutput/skel \
Modified: trunk/lib/engine/audiooutput/ptlib/audiooutput-main-ptlib.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/ptlib/audiooutput-main-ptlib.cpp (original)
+++ trunk/lib/engine/audiooutput/ptlib/audiooutput-main-ptlib.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::AudioOutputCore *audiooutput_core = NULL;
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core.get ("audiooutput-core");
- audiooutput_core
- = dynamic_cast<Ekiga::AudioOutputCore*>(core.get ("audiooutput-core"));
-
- if (audiooutput_core != NULL) {
+ if (audiooutput_core) {
GMAudioOutputManager_ptlib *audiooutput_manager = new GMAudioOutputManager_ptlib(core);
Modified: trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp (original)
+++ trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp Wed Oct 15 12:53:55 2008
@@ -41,15 +41,22 @@
#define DEVICE_TYPE "PTLIB"
GMAudioOutputManager_ptlib::GMAudioOutputManager_ptlib (Ekiga::ServiceCore & _core)
-: core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
current_state[Ekiga::primary].opened = false;
current_state[Ekiga::secondary].opened = false;
output_device[Ekiga::primary] = NULL;
output_device[Ekiga::secondary] = NULL;
}
+GMAudioOutputManager_ptlib::~GMAudioOutputManager_ptlib ()
+{
+ gmref_dec (runtime); // leave a reference in the main thread
+}
+
void GMAudioOutputManager_ptlib::get_devices(std::vector <Ekiga::AudioOutputDevice> & devices)
{
PStringArray audio_sources;
@@ -115,7 +122,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));
+ runtime->run_in_main (sigc::bind (device_error.make_slot (), ps, current_state[ps].device, error_code));
return false;
}
@@ -126,7 +133,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));
+ runtime->run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
return true;
}
@@ -139,7 +146,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));
+ 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)
@@ -171,7 +178,7 @@
}
else {
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));
+ runtime->run_in_main (sigc::bind (device_error.make_slot (), ps, current_state[ps].device, Ekiga::AO_ERROR_WRITE));
}
}
Modified: trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h (original)
+++ trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h Wed Oct 15 12:53:55 2008
@@ -56,8 +56,7 @@
GMAudioOutputManager_ptlib (Ekiga::ServiceCore & core);
- virtual ~GMAudioOutputManager_ptlib () {}
-
+ ~GMAudioOutputManager_ptlib ();
virtual void get_devices (std::vector <Ekiga::AudioOutputDevice> & devices);
@@ -80,7 +79,7 @@
protected:
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
PSoundChannel *output_device[2];
};
Modified: trunk/lib/engine/audiooutput/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/audiooutput/skel/Makefile.am (original)
+++ trunk/lib/engine/audiooutput/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/audiooutput/skel \
Modified: trunk/lib/engine/chat/echo/Makefile.am
==============================================================================
--- trunk/lib/engine/chat/echo/Makefile.am (original)
+++ trunk/lib/engine/chat/echo/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,7 +5,7 @@
AM_CXXFLAGS = $(SIGC_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/presence/skel \
-I$(top_srcdir)/lib/engine/chat/skel
Modified: trunk/lib/engine/chat/echo/echo-dialect.h
==============================================================================
--- trunk/lib/engine/chat/echo/echo-dialect.h (original)
+++ trunk/lib/engine/chat/echo/echo-dialect.h Wed Oct 15 12:53:55 2008
@@ -36,12 +36,15 @@
#ifndef __ECHO_DIALECT_H__
#define __ECHO_DIALECT_H__
+#include "services.h"
#include "dialect-impl.h"
#include "echo-simple.h"
namespace Echo
{
- class Dialect: public Ekiga::DialectImpl<SimpleChat>
+ class Dialect:
+ public Ekiga::Service,
+ public Ekiga::DialectImpl<SimpleChat>
{
public:
@@ -51,6 +54,12 @@
bool populate_menu (Ekiga::MenuBuilder &builder);
+ const std::string get_name () const
+ { return "echo-dialect"; }
+
+ const std::string get_description () const
+ { return "\tProvides an echo chat for testing purposes"; }
+
private:
void new_chat ();
Modified: trunk/lib/engine/chat/echo/echo-main.cpp
==============================================================================
--- trunk/lib/engine/chat/echo/echo-main.cpp (original)
+++ trunk/lib/engine/chat/echo/echo-main.cpp Wed Oct 15 12:53:55 2008
@@ -39,47 +39,18 @@
#include "chat-core.h"
#include "echo-dialect.h"
-namespace Echo
-{
- class Service: public Ekiga::Service
- {
- public:
-
- Service (Dialect *dialect_): dialect(dialect_)
- {}
-
- ~Service ()
- { delete dialect; }
-
- const std::string get_name () const
- { return "echo-dialect"; }
-
- const std::string get_description () const
- { return "\tProvides an echo chat for testing purposes"; }
-
- private:
-
- Dialect *dialect;
- };
-};
-
bool
echo_init (Ekiga::ServiceCore &core,
int */*argc*/,
char **/*argv*/[])
{
bool result = false;
- Ekiga::ChatCore *chat_core = NULL;
- Echo::Service *service = NULL;
-
- chat_core
- = dynamic_cast<Ekiga::ChatCore*>(core.get ("chat-core"));
+ gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
- if (chat_core != NULL) {
+ if (chat_core) {
- Echo::Dialect* dialect = new Echo::Dialect;
- service = new Echo::Service (dialect);
- core.add (*service);
+ gmref_ptr<Echo::Dialect> dialect = new Echo::Dialect;
+ core.add (dialect);
chat_core->add_dialect (*dialect);
result = true;
}
Modified: trunk/lib/engine/chat/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/chat/skel/Makefile.am (original)
+++ trunk/lib/engine/chat/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,8 +5,8 @@
AM_CPPFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
- -I$(top_srcdir)/lib/engine/framework \
+ -I$(top_srcdir)/lib/gmref \
+ -I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/presence/skel
libgmchat_la_SOURCES = \
Modified: trunk/lib/engine/components/avahi-publisher/Makefile.am
==============================================================================
--- trunk/lib/engine/components/avahi-publisher/Makefile.am (original)
+++ trunk/lib/engine/components/avahi-publisher/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/protocol/skel \
Modified: trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.cpp
==============================================================================
--- trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.cpp (original)
+++ trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.cpp Wed Oct 15 12:53:55 2008
@@ -74,26 +74,17 @@
char* */*argv*/[])
{
bool result = false;
- Ekiga::PresenceCore* presence_core = NULL;
- Ekiga::CallCore* call_core = NULL;
- Ekiga::PersonalDetails* details = NULL;
+ gmref_ptr<Ekiga::PresenceCore> presence_core
+ = core.get ("presence-core");
+ gmref_ptr<Ekiga::CallCore> call_core = core.get ("call-core");
+ gmref_ptr<Ekiga::PersonalDetails> details = core.get ("personal-details");
- presence_core
- = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
- call_core
- = dynamic_cast<Ekiga::CallCore*>(core.get ("call-core"));
- details
- = dynamic_cast<Ekiga::PersonalDetails*>(core.get ("personal-details"));
-
- if (presence_core != NULL
- && call_core != NULL
- && details != NULL) {
+ if (presence_core && call_core && details) {
Avahi::PresencePublisher* publisher = NULL;
- Service* service = NULL;
publisher = new Avahi::PresencePublisher (core, *details, *call_core);
- service = new Service (*presence_core, publisher);
- core.add (*service);
+ gmref_ptr<Service> service = new Service (*presence_core, publisher);
+ core.add (service);
result = true;
}
Modified: trunk/lib/engine/components/gmconf-personal-details/Makefile.am
==============================================================================
--- trunk/lib/engine/components/gmconf-personal-details/Makefile.am (original)
+++ trunk/lib/engine/components/gmconf-personal-details/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework
Modified: trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details-main.cpp
==============================================================================
--- trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details-main.cpp (original)
+++ trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details-main.cpp Wed Oct 15 12:53:55 2008
@@ -45,16 +45,14 @@
char ** /*argv*/[])
{
bool result = false;
- Ekiga::PersonalDetails* personal_details = NULL;
- Gmconf::PersonalDetails* gmconf_details = NULL;
+ gmref_ptr<Ekiga::PersonalDetails> personal_details
+ = core.get ("personal-details");
- personal_details
- = dynamic_cast<Ekiga::PersonalDetails*>(core.get ("personal-details"));
+ if ( !personal_details) {
- if (personal_details == NULL) {
-
- gmconf_details = new Gmconf::PersonalDetails ();
- core.add (*gmconf_details);
+ Gmconf::PersonalDetails* gmconf_details
+ = new Gmconf::PersonalDetails ();
+ core.add (gmconf_details);
result = true;
}
Modified: trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details.h
==============================================================================
--- trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details.h (original)
+++ trunk/lib/engine/components/gmconf-personal-details/gmconf-personal-details.h Wed Oct 15 12:53:55 2008
@@ -41,8 +41,7 @@
namespace Gmconf
{
- class PersonalDetails: public Ekiga::Service,
- public Ekiga::PersonalDetails
+ class PersonalDetails: public Ekiga::PersonalDetails
{
public:
Modified: trunk/lib/engine/components/gstreamer/Makefile.am
==============================================================================
--- trunk/lib/engine/components/gstreamer/Makefile.am (original)
+++ trunk/lib/engine/components/gstreamer/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videoinput/skel \
-I$(top_srcdir)/lib/engine/videooutput/skel \
Modified: trunk/lib/engine/components/gstreamer/gst-main.cpp
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-main.cpp (original)
+++ trunk/lib/engine/components/gstreamer/gst-main.cpp Wed Oct 15 12:53:55 2008
@@ -52,22 +52,14 @@
char** argv[])
{
bool result = false;
- Ekiga::AudioInputCore* audioinput_core = NULL;
- Ekiga::AudioOutputCore* audiooutput_core = NULL;
- Ekiga::VideoInputCore* videoinput_core = NULL;
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core.get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core.get ("audiooutput-core");
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core.get ("videoinput-core");
- audioinput_core
- = dynamic_cast<Ekiga::AudioInputCore*>(core.get ("audioinput-core"));
-
- audiooutput_core
- = dynamic_cast<Ekiga::AudioOutputCore*>(core.get ("audiooutput-core"));
-
- videoinput_core
- = dynamic_cast<Ekiga::VideoInputCore*>(core.get ("videoinput-core"));
-
- if (audioinput_core != NULL
- && audiooutput_core != NULL
- && videoinput_core != NULL) {
+ if (audioinput_core && audiooutput_core && videoinput_core) {
GST::VideoInputManager* video = new GST::VideoInputManager ();
GST::AudioInputManager* audioin = new GST::AudioInputManager ();
Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp (original)
+++ trunk/lib/engine/engine.cpp Wed Oct 15 12:53:55 2008
@@ -121,16 +121,19 @@
/* VideoInputCore depends on VideoOutputCore and must this *
* be constructed thereafter */
- Ekiga::AccountCore *account_core = new Ekiga::AccountCore;
- Ekiga::PresenceCore *presence_core = NULL;
- Ekiga::ContactCore *contact_core = new Ekiga::ContactCore;
- Ekiga::CallCore *call_core = new Ekiga::CallCore;
- Ekiga::ChatCore *chat_core = new Ekiga::ChatCore;
- Ekiga::VideoOutputCore *videooutput_core = new Ekiga::VideoOutputCore;
- Ekiga::VideoInputCore *videoinput_core = new Ekiga::VideoInputCore(*runtime, *videooutput_core);
- Ekiga::AudioOutputCore *audiooutput_core = new Ekiga::AudioOutputCore(*runtime);
- Ekiga::AudioInputCore *audioinput_core = new Ekiga::AudioInputCore(*runtime, *audiooutput_core);
- Ekiga::HalCore *hal_core = new Ekiga::HalCore;
+ gmref_ptr<Ekiga::AccountCore> account_core = new Ekiga::AccountCore;
+ gmref_ptr<Ekiga::ContactCore> contact_core = new Ekiga::ContactCore;
+ 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::HalCore> hal_core = new Ekiga::HalCore;
/* The last item in the following list will be destroyed first. *
@@ -140,24 +143,25 @@
* components may still call runtime functions until destroyed *
* (e.g. VideoOutputCore). */
- core->add (*runtime);
- core->add (*account_core);
- core->add (*contact_core);
- core->add (*chat_core);
- core->add (*videooutput_core);
- core->add (*videoinput_core);
- core->add (*audiooutput_core);
- core->add (*audioinput_core);
- core->add (*hal_core);
- core->add (*call_core);
+ core->add (runtime);
+ core->add (account_core);
+ core->add (contact_core);
+ core->add (chat_core);
+ core->add (videooutput_core);
+ core->add (videoinput_core);
+ core->add (audiooutput_core);
+ core->add (audioinput_core);
+ core->add (hal_core);
+ core->add (call_core);
if (!gmconf_personal_details_init (*core, &argc, &argv)) {
delete core;
return;
}
- presence_core = new Ekiga::PresenceCore (*core);
- core->add (*presence_core);
+ gmref_ptr<Ekiga::PresenceCore> presence_core
+ = new Ekiga::PresenceCore (*core);
+ core->add (presence_core);
#ifndef WIN32
if (!videooutput_x_init (*core, &argc, &argv)) {
@@ -293,12 +297,12 @@
audioinput_core->setup_conf_bridge();
sigc::connection conn;
- conn = hal_core->videoinput_device_added.connect (sigc::mem_fun (videoinput_core, &Ekiga::VideoInputCore::add_device));
- conn = hal_core->videoinput_device_removed.connect (sigc::mem_fun (videoinput_core, &Ekiga::VideoInputCore::remove_device));
- conn = hal_core->audiooutput_device_added.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::add_device));
- conn = hal_core->audiooutput_device_removed.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::remove_device));
- conn = hal_core->audioinput_device_added.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::add_device));
- conn = hal_core->audioinput_device_removed.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::remove_device));
+ conn = hal_core->videoinput_device_added.connect (sigc::mem_fun (*videoinput_core, &Ekiga::VideoInputCore::add_device));
+ conn = hal_core->videoinput_device_removed.connect (sigc::mem_fun (*videoinput_core, &Ekiga::VideoInputCore::remove_device));
+ conn = hal_core->audiooutput_device_added.connect (sigc::mem_fun (*audiooutput_core, &Ekiga::AudioOutputCore::add_device));
+ conn = hal_core->audiooutput_device_removed.connect (sigc::mem_fun (*audiooutput_core, &Ekiga::AudioOutputCore::remove_device));
+ conn = hal_core->audioinput_device_added.connect (sigc::mem_fun (*audioinput_core, &Ekiga::AudioInputCore::add_device));
+ conn = hal_core->audioinput_device_removed.connect (sigc::mem_fun (*audioinput_core, &Ekiga::AudioInputCore::remove_device));
// std::vector<sigc::connection> connections;
//connections.push_back (conn);
}
Modified: trunk/lib/engine/framework/Makefile.am
==============================================================================
--- trunk/lib/engine/framework/Makefile.am (original)
+++ trunk/lib/engine/framework/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework
Modified: trunk/lib/engine/framework/menu-xml.cpp
==============================================================================
--- trunk/lib/engine/framework/menu-xml.cpp (original)
+++ trunk/lib/engine/framework/menu-xml.cpp Wed Oct 15 12:53:55 2008
@@ -52,7 +52,7 @@
g_spawn_command_line_async (command.c_str (), NULL);
}
-static void pull_trigger (Ekiga::Trigger *trigger)
+static void pull_trigger (gmref_ptr<Ekiga::Trigger> trigger)
{
trigger->pull ();
}
@@ -175,9 +175,8 @@
command));
} else {
- Ekiga::Trigger *trigger =
- dynamic_cast<Ekiga::Trigger *>(core.get (command));
- if (trigger != NULL)
+ gmref_ptr<Ekiga::Trigger> trigger = core.get (command);
+ if (trigger)
builder.add_action (icon, label,
sigc::bind (sigc::ptr_fun (pull_trigger),
trigger));
Modified: trunk/lib/engine/framework/personal-details.h
==============================================================================
--- trunk/lib/engine/framework/personal-details.h (original)
+++ trunk/lib/engine/framework/personal-details.h Wed Oct 15 12:53:55 2008
@@ -43,7 +43,7 @@
namespace Ekiga
{
- class PersonalDetails
+ class PersonalDetails: public Service
{
public:
PersonalDetails () {}
Modified: trunk/lib/engine/framework/services.cpp
==============================================================================
--- trunk/lib/engine/framework/services.cpp (original)
+++ trunk/lib/engine/framework/services.cpp Wed Oct 15 12:53:55 2008
@@ -39,20 +39,17 @@
Ekiga::ServiceCore::~ServiceCore ()
{
- for (std::list<Service *>::iterator iter = services.begin ();
- iter != services.end ();
- iter++)
- delete *iter;
+ services.clear(); // frees the memory, if we're the only to hold references
}
bool
-Ekiga::ServiceCore::add (Service &service)
+Ekiga::ServiceCore::add (gmref_ptr<Service> service)
{
bool result = false;
- if (get (service.get_name ()) == NULL) {
+ if ( !get (service->get_name ())) {
- services.push_front (&service);
+ services.push_front (service);
service_added (service);
result = true;
} else {
@@ -63,19 +60,17 @@
return result;
}
-Ekiga::Service *
+gmref_ptr<Ekiga::Service>
Ekiga::ServiceCore::get (const std::string name)
{
- Service *result = NULL;
- bool found = false;
+ gmref_ptr<Service> result;
- for (std::list<Service *>::iterator iter = services.begin ();
- iter != services.end () && !found;
+ for (std::list<gmref_ptr<Service> >::iterator iter = services.begin ();
+ iter != services.end () && !result;
iter++)
if (name == (*iter)->get_name ()) {
result = *iter;
- found = true;
}
return result;
}
@@ -83,7 +78,7 @@
void
Ekiga::ServiceCore::dump (std::ostream &stream) const
{
- for (std::list<Service *>::const_reverse_iterator iter
+ for (std::list<gmref_ptr<Service> >::const_reverse_iterator iter
= services.rbegin ();
iter != services.rend ();
iter++)
Modified: trunk/lib/engine/framework/services.h
==============================================================================
--- trunk/lib/engine/framework/services.h (original)
+++ trunk/lib/engine/framework/services.h Wed Oct 15 12:53:55 2008
@@ -36,13 +36,12 @@
#ifndef __SERVICES_H__
#define __SERVICES_H__
-/* Ok, the principle is simple : we want to do "foo = new Foo (whatever)"
- * somewhere, and hook it somewhere for the whole program life ; so we give
- * the pointer to a ServiceCore object, which will end it cleanly.
- * Why not use smart pointers? Because it would be nice for debugging purposes
- * to be able to describe what exactly is enabled.
+/* We want to register some named services to a central location : this is
+ * it!
*/
+#include "gmref.h"
+
#include <list>
#include <string>
#include <sigc++/sigc++.h>
@@ -55,7 +54,7 @@
* @{
*/
- struct Service
+ struct Service: public GmRefCounted
{
virtual ~Service () {}
@@ -73,17 +72,17 @@
~ServiceCore ();
- bool add (Service &service);
+ bool add (gmref_ptr<Service> service);
- Service *get (const std::string name);
+ gmref_ptr<Service> get (const std::string name);
void dump (std::ostream &stream) const;
- sigc::signal<void, Service &> service_added;
+ sigc::signal<void, gmref_ptr<Service> > service_added;
private:
- std::list<Service *> services;
+ std::list<gmref_ptr<Service> > services;
};
Modified: trunk/lib/engine/gui/gtk-core/Makefile.am
==============================================================================
--- trunk/lib/engine/gui/gtk-core/Makefile.am (original)
+++ trunk/lib/engine/gui/gtk-core/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,6 +5,7 @@
AM_CPPFLAGS = $(SIGC_CFLAGS) $(GTK_CFLAGS)
INCLUDES = \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/toolbox \
-I$(top_srcdir)/lib/gui \
-I$(top_srcdir)/lib/engine \
Modified: trunk/lib/engine/gui/gtk-core/gtk-core-main.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-core/gtk-core-main.cpp (original)
+++ trunk/lib/engine/gui/gtk-core/gtk-core-main.cpp Wed Oct 15 12:53:55 2008
@@ -48,9 +48,9 @@
{
if (gtk_init_check (argc, argv)) {
- Gtk::Core *gtk = new Gtk::Core ();
+ gmref_ptr<Gtk::Core> gtk = new Gtk::Core ();
- core.add (*gtk);
+ core.add (gtk);
return true;
Modified: trunk/lib/engine/gui/gtk-frontend/Makefile.am
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/Makefile.am (original)
+++ trunk/lib/engine/gui/gtk-frontend/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,8 +6,9 @@
INCLUDES = \
-I$(top_srcdir)/lib/ \
- -I$(top_srcdir)/lib/gui \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
+ -I$(top_srcdir)/lib/gui \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/chat/skel \
-I$(top_srcdir)/lib/engine/presence/skel \
Modified: trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp Wed Oct 15 12:53:55 2008
@@ -56,21 +56,36 @@
#include "gmwindow.h"
+bool
+gtk_frontend_init (Ekiga::ServiceCore &core,
+ int * /*argc*/,
+ char ** /*argv*/[])
+{
+ bool result = false;
+
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
+ gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
+ gmref_ptr<History::Source> history_source = core.get ("call-history-store");
+
+ if (presence_core && contact_core && chat_core && history_source) {
+
+ gmref_ptr<GtkFrontend> gtk_frontend = new GtkFrontend (core);
+ core.add (gtk_frontend);
+ result = true;
+ }
+ return result;
+}
+
GtkFrontend::GtkFrontend (Ekiga::ServiceCore &core)
{
- sigc::connection conn;
-
- Ekiga::PresenceCore *presence_core = NULL;
- Ekiga::ContactCore *contact_core = NULL;
- Ekiga::ChatCore *chat_core = NULL;
- History::Source *history_source = NULL;
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
+ gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
+ gmref_ptr<History::Source> history_source = core.get ("call-history-store");
History::Book *history_book = NULL;
- contact_core = dynamic_cast<Ekiga::ContactCore *>(core.get ("contact-core"));
- presence_core = dynamic_cast<Ekiga::PresenceCore *>(core.get ("presence-core"));
- chat_core = dynamic_cast<Ekiga::ChatCore *>(core.get ("chat-core"));
- history_source = dynamic_cast<History::Source*>(core.get ("call-history-store"));
history_book = history_source->get_book ();
roster_view = roster_view_gtk_new (*presence_core);
@@ -125,15 +140,3 @@
{
return call_history_view;
}
-
-
-bool
-gtk_frontend_init (Ekiga::ServiceCore &core,
- int * /*argc*/,
- char ** /*argv*/[])
-{
- GtkFrontend *gtk_frontend = new GtkFrontend (core);
- core.add (*gtk_frontend);
-
- return true;
-}
Modified: trunk/lib/engine/hal/dbus/Makefile.am
==============================================================================
--- trunk/lib/engine/hal/dbus/Makefile.am (original)
+++ trunk/lib/engine/hal/dbus/Makefile.am Wed Oct 15 12:53:55 2008
@@ -7,7 +7,7 @@
AM_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/hal/skel \
-I$(top_srcdir)/lib/engine/hal/dbus
Modified: trunk/lib/engine/hal/dbus/hal-main-dbus.cpp
==============================================================================
--- trunk/lib/engine/hal/dbus/hal-main-dbus.cpp (original)
+++ trunk/lib/engine/hal/dbus/hal-main-dbus.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,9 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::HalCore *hal_core = NULL;
+ gmref_ptr<Ekiga::HalCore> hal_core = core.get ("hal-core");
- hal_core
- = dynamic_cast<Ekiga::HalCore*>(core.get ("hal-core"));
-
- if (hal_core != NULL) {
+ if (hal_core) {
HalManager_dbus *hal_manager = new HalManager_dbus(core);
Modified: trunk/lib/engine/hal/dbus/hal-manager-dbus.cpp
==============================================================================
--- trunk/lib/engine/hal/dbus/hal-manager-dbus.cpp (original)
+++ trunk/lib/engine/hal/dbus/hal-manager-dbus.cpp Wed Oct 15 12:53:55 2008
@@ -52,7 +52,7 @@
#include "ptlib.h"
HalManager_dbus::HalManager_dbus (Ekiga::ServiceCore & _core)
-: core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
PTRACE(4, "HalManager_dbus\tInitialising HAL Manager");
Modified: trunk/lib/engine/hal/dbus/hal-manager-dbus.h
==============================================================================
--- trunk/lib/engine/hal/dbus/hal-manager-dbus.h (original)
+++ trunk/lib/engine/hal/dbus/hal-manager-dbus.h Wed Oct 15 12:53:55 2008
@@ -114,7 +114,6 @@
void get_string_property (DBusGProxy *proxy, const char * property, std::string & value);
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
DBusGConnection * bus;
DBusGProxy * hal_proxy;
Modified: trunk/lib/engine/hal/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/hal/skel/Makefile.am (original)
+++ trunk/lib/engine/hal/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,7 +5,7 @@
AM_CXXFLAGS = $(SIGC_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/hal/skel
Modified: trunk/lib/engine/presence/avahi/Makefile.am
==============================================================================
--- trunk/lib/engine/presence/avahi/Makefile.am (original)
+++ trunk/lib/engine/presence/avahi/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,6 +5,7 @@
AM_CPPFLAGS = $(SIGC_CFLAGS) $(AVAHI_CFLAGS)
INCLUDES = \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/account/skel \
-I$(top_srcdir)/lib/engine/presence/skel
Modified: trunk/lib/engine/presence/avahi/avahi-cluster.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.cpp (original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.cpp Wed Oct 15 12:53:55 2008
@@ -39,15 +39,13 @@
Avahi::Cluster::Cluster (Ekiga::ServiceCore &_core): core(_core)
{
- Ekiga::PresenceCore* presence_core = NULL;
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
heap = new Heap (core);
add_heap (*heap);
- presence_core
- = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
- /* don't check the dynamic cast: it has been checked already by avahi-main!*/
+ /* don't check the cast: it has been checked already by avahi-main!*/
presence_core->add_presence_fetcher (*heap);
}
Modified: trunk/lib/engine/presence/avahi/avahi-cluster.h
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.h (original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.h Wed Oct 15 12:53:55 2008
@@ -51,6 +51,7 @@
*/
class Cluster:
+ public Ekiga::Service,
public Ekiga::ClusterImpl<Heap>
{
public:
@@ -63,6 +64,14 @@
bool populate_menu (Ekiga::MenuBuilder &builder);
+ /* this is a service */
+ const std::string get_name () const
+ { return "avahi-core"; }
+
+ const std::string get_description () const
+ { return "\tObject getting presence from the network neighbourhood"; }
+
+
private:
Ekiga::ServiceCore &core;
Modified: trunk/lib/engine/presence/avahi/avahi-main.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-main.cpp (original)
+++ trunk/lib/engine/presence/avahi/avahi-main.cpp Wed Oct 15 12:53:55 2008
@@ -39,48 +39,18 @@
#include "presence-core.h"
#include "avahi-cluster.h"
-namespace Avahi
-{
- class Service: public Ekiga::Service
- {
- public:
-
- Service (Avahi::Cluster *_cluster): cluster(_cluster)
- {}
-
- ~Service ()
- { delete cluster; }
-
- const std::string get_name () const
- { return "avahi-core"; }
-
- const std::string get_description () const
- { return "\tObject getting presence from the network neighbourhood"; }
-
- private:
-
- Avahi::Cluster *cluster;
- };
-};
-
bool
avahi_init (Ekiga::ServiceCore &core,
int */*argc*/,
char **/*argv*/[])
{
bool result = false;
- Ekiga::PresenceCore *presence_core = NULL;
- Avahi::Cluster *cluster = NULL;
- Avahi::Service *service = NULL;
-
- presence_core
- = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
- if (presence_core != NULL) {
+ if (presence_core) {
- cluster = new Avahi::Cluster (core);
- service = new Avahi::Service (cluster);
- core.add (*service);
+ gmref_ptr<Avahi::Cluster> cluster = new Avahi::Cluster (core);
+ core.add (cluster);
presence_core->add_cluster (*cluster);
result = true;
}
Modified: trunk/lib/engine/presence/local-roster/Makefile.am
==============================================================================
--- trunk/lib/engine/presence/local-roster/Makefile.am (original)
+++ trunk/lib/engine/presence/local-roster/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/addressbook/skel \
-I$(top_srcdir)/lib/engine/account/skel \
Modified: trunk/lib/engine/presence/local-roster/local-cluster.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-cluster.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-cluster.cpp Wed Oct 15 12:53:55 2008
@@ -41,8 +41,7 @@
Local::Cluster::Cluster (Ekiga::ServiceCore &_core): core(_core)
{
- presence_core
- = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
heap = new Local::Heap (core);
@@ -59,6 +58,8 @@
bool
Local::Cluster::is_supported_uri (const std::string uri) const
{
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
+
return presence_core->is_supported_uri (uri);
}
Modified: trunk/lib/engine/presence/local-roster/local-cluster.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-cluster.h (original)
+++ trunk/lib/engine/presence/local-roster/local-cluster.h Wed Oct 15 12:53:55 2008
@@ -78,7 +78,6 @@
private:
Ekiga::ServiceCore &core;
- Ekiga::PresenceCore *presence_core;
Heap *heap;
void on_presence_received (std::string uri,
Modified: trunk/lib/engine/presence/local-roster/local-heap.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-heap.cpp Wed Oct 15 12:53:55 2008
@@ -52,9 +52,6 @@
Local::Heap::Heap (Ekiga::ServiceCore &_core): core (_core), doc (NULL)
{
xmlNodePtr root;
-
- presence_core = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
-
gchar *c_raw = gm_conf_get_string (KEY);
// Build the XML document representing the contacts list from the configuration
@@ -175,6 +172,7 @@
{
if (!has_presentity_with_uri (uri)) {
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
Ekiga::FormRequestSimple request;
std::set<std::string> groups = existing_groups ();
@@ -248,6 +246,8 @@
void
Local::Heap::common_add (Presentity &presentity)
{
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
+
// Add the presentity to this Heap
add_presentity (presentity);
@@ -278,6 +278,7 @@
{
try {
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
const std::string name = result.text ("name");
const std::string good_uri = result.hidden ("good-uri");
std::string uri;
Modified: trunk/lib/engine/presence/local-roster/local-heap.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.h (original)
+++ trunk/lib/engine/presence/local-roster/local-heap.h Wed Oct 15 12:53:55 2008
@@ -190,7 +190,6 @@
Ekiga::Form& result);
Ekiga::ServiceCore &core;
- Ekiga::PresenceCore *presence_core;
xmlDocPtr doc;
};
Modified: trunk/lib/engine/presence/local-roster/local-presentity.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-presentity.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-presentity.cpp Wed Oct 15 12:53:55 2008
@@ -54,8 +54,6 @@
{
xmlChar *xml_str = NULL;
- presence_core = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
-
xml_str = xmlGetProp (node, (const xmlChar *)"uri");
if (xml_str != NULL) {
@@ -106,8 +104,6 @@
core(_core), name_node(NULL), name(_name), uri(_uri),
presence("unknown"), groups(_groups)
{
- presence_core = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
-
node = xmlNewNode (NULL, BAD_CAST "entry");
xmlSetProp (node, BAD_CAST "uri", BAD_CAST uri.c_str ());
name_node = xmlNewChild (node, NULL,
@@ -190,6 +186,7 @@
Local::Presentity::populate_menu (Ekiga::MenuBuilder &builder)
{
bool populated = false;
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
populated = presence_core->populate_presentity_menu (*this, uri, builder);
@@ -215,7 +212,7 @@
void
Local::Presentity::edit_presentity ()
{
- Cluster *cluster = dynamic_cast<Cluster*>(core.get ("local-cluster"));
+ gmref_ptr<Cluster> cluster = core.get ("local-cluster");
Ekiga::FormRequestSimple request;
std::set<std::string> all_groups = cluster->existing_groups ();
@@ -257,6 +254,7 @@
name = new_name;
if (uri != new_uri) {
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
presence_core->unfetch_presence (uri);
uri = new_uri;
presence = "unknown";
@@ -351,6 +349,7 @@
void
Local::Presentity::remove ()
{
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
presence_core->unfetch_presence (uri);
xmlUnlinkNode (node);
Modified: trunk/lib/engine/presence/local-roster/local-presentity.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-presentity.h (original)
+++ trunk/lib/engine/presence/local-roster/local-presentity.h Wed Oct 15 12:53:55 2008
@@ -171,7 +171,6 @@
Ekiga::ServiceCore &core;
- Ekiga::PresenceCore *presence_core;
xmlNodePtr node;
xmlNodePtr name_node;
Modified: trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp Wed Oct 15 12:53:55 2008
@@ -110,20 +110,14 @@
char ** /*argv*/[])
{
bool result = false;
- Ekiga::ContactCore *contact_core = NULL;
- Local::Cluster *cluster = NULL;
- Local::ContactDecorator *decorator = NULL;
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
+ gmref_ptr<Local::Cluster> cluster = core.get ("local-cluster");
- contact_core
- = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
+ if (cluster && contact_core) {
- cluster
- = dynamic_cast<Local::Cluster*>(core.get ("local-cluster"));
-
- if (cluster != NULL && contact_core != NULL) {
-
- decorator = new Local::ContactDecorator (*cluster);
- core.add (*decorator);
+ gmref_ptr<Local::ContactDecorator> decorator
+ = new Local::ContactDecorator (*cluster);
+ core.add (decorator);
contact_core->add_contact_decorator (*decorator);
result = true;
}
Modified: trunk/lib/engine/presence/local-roster/local-roster-main.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-roster-main.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-roster-main.cpp Wed Oct 15 12:53:55 2008
@@ -45,16 +45,12 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::PresenceCore *presence_core = NULL;
- Local::Cluster *cluster = NULL;
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
- presence_core
- = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
+ if (presence_core) {
- if (presence_core != NULL) {
-
- cluster = new Local::Cluster (core);
- core.add (*cluster);
+ gmref_ptr<Local::Cluster> cluster = new Local::Cluster (core);
+ core.add (cluster);
presence_core->add_cluster (*cluster);
result = true;
}
Modified: trunk/lib/engine/presence/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/presence/skel/Makefile.am (original)
+++ trunk/lib/engine/presence/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,7 +5,7 @@
AM_CXXFLAGS = $(SIGC_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/presence/skel \
-I$(top_srcdir)/lib/engine/account/skel
Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp (original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp Wed Oct 15 12:53:55 2008
@@ -42,8 +42,8 @@
Ekiga::PresenceCore::PresenceCore (Ekiga::ServiceCore& core)
{
- Ekiga::AccountCore *account_core = dynamic_cast <Ekiga::AccountCore *> (core.get ("account-core"));
- Ekiga::PersonalDetails *details = dynamic_cast <Ekiga::PersonalDetails *> (core.get ("personal-details"));
+ gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
+ gmref_ptr<Ekiga::PersonalDetails> details = core.get ("personal-details");
if (details)
details->updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::PresenceCore::publish), details));
@@ -114,8 +114,8 @@
void
Ekiga::PresenceCore::on_presentity_added (Heap &heap,
- Presentity &presentity,
- Cluster *cluster)
+ Presentity &presentity,
+ Cluster *cluster)
{
presentity_added.emit (*cluster, heap, presentity);
}
@@ -250,7 +250,7 @@
presence_publishers.remove (&publisher);
}
-void Ekiga::PresenceCore::publish (const PersonalDetails* details)
+void Ekiga::PresenceCore::publish (gmref_ptr<PersonalDetails> details)
{
for (std::list<PresencePublisher*>::iterator iter
= presence_publishers.begin ();
@@ -283,7 +283,7 @@
Ekiga::PresenceCore::on_registration_event (const Ekiga::Account& /*account*/,
Ekiga::AccountCore::RegistrationState state,
std::string /*info*/,
- Ekiga::PersonalDetails *details)
+ gmref_ptr<Ekiga::PersonalDetails> details)
{
if (state == Ekiga::AccountCore::Registered)
publish (details);
Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h (original)
+++ trunk/lib/engine/presence/skel/presence-core.h Wed Oct 15 12:53:55 2008
@@ -135,7 +135,8 @@
* special registering magic?
*/
class PresenceCore:
- public Service
+ public Service,
+ public sigc::trackable
{
public:
@@ -296,12 +297,12 @@
private:
std::list<PresencePublisher*> presence_publishers;
- void publish (const PersonalDetails* details);
+ void publish (gmref_ptr<PersonalDetails> details);
void on_personal_details_updated (PersonalDetails &details);
void on_registration_event (const Ekiga::Account & account,
Ekiga::AccountCore::RegistrationState state,
std::string info,
- Ekiga::PersonalDetails *details);
+ gmref_ptr<Ekiga::PersonalDetails> details);
/*** API to control which uri are supported by runtime ***/
public:
Modified: trunk/lib/engine/presence/skel/uri-presentity.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/uri-presentity.cpp (original)
+++ trunk/lib/engine/presence/skel/uri-presentity.cpp Wed Oct 15 12:53:55 2008
@@ -41,7 +41,7 @@
std::set<std::string> groups_)
: core(_core), name(name_), uri(uri_), presence("unknown"), groups(groups_)
{
- presence_core = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
presence_core->presence_received.connect (sigc::mem_fun (this, &Ekiga::URIPresentity::on_presence_received));
presence_core->status_received.connect (sigc::mem_fun (this, &Ekiga::URIPresentity::on_status_received));
presence_core->fetch_presence (uri);
@@ -49,6 +49,7 @@
Ekiga::URIPresentity::~URIPresentity ()
{
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
presence_core->unfetch_presence (uri);
}
@@ -91,6 +92,7 @@
bool
Ekiga::URIPresentity::populate_menu (Ekiga::MenuBuilder &builder)
{
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
return presence_core->populate_presentity_menu (*this, uri, builder);
}
Modified: trunk/lib/engine/presence/skel/uri-presentity.h
==============================================================================
--- trunk/lib/engine/presence/skel/uri-presentity.h (original)
+++ trunk/lib/engine/presence/skel/uri-presentity.h Wed Oct 15 12:53:55 2008
@@ -98,7 +98,6 @@
private:
Ekiga::ServiceCore &core;
- Ekiga::PresenceCore *presence_core;
std::string name;
std::string uri;
Modified: trunk/lib/engine/protocol/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/protocol/skel/Makefile.am (original)
+++ trunk/lib/engine/protocol/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,7 +5,7 @@
AM_CPPFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework
libgmprotocol_la_SOURCES = \
Modified: trunk/lib/engine/videoinput/mlogo/Makefile.am
==============================================================================
--- trunk/lib/engine/videoinput/mlogo/Makefile.am (original)
+++ trunk/lib/engine/videoinput/mlogo/Makefile.am Wed Oct 15 12:53:55 2008
@@ -5,8 +5,9 @@
AM_CXXFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS) $(PTLIB_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/gmconf \
-I$(top_srcdir)/pixmaps \
+ -I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videooutput/skel \
Modified: trunk/lib/engine/videoinput/mlogo/videoinput-main-mlogo.cpp
==============================================================================
--- trunk/lib/engine/videoinput/mlogo/videoinput-main-mlogo.cpp (original)
+++ trunk/lib/engine/videoinput/mlogo/videoinput-main-mlogo.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::VideoInputCore *videoinput_core = NULL;
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core.get ("videoinput-core");
- videoinput_core
- = dynamic_cast<Ekiga::VideoInputCore*>(core.get ("videoinput-core"));
-
- if (videoinput_core != NULL) {
+ if (videoinput_core) {
GMVideoInputManager_mlogo *videoinput_manager = new GMVideoInputManager_mlogo(core);
Modified: trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp
==============================================================================
--- trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp (original)
+++ trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp Wed Oct 15 12:53:55 2008
@@ -42,12 +42,19 @@
#define DEVICE_NAME "Moving Logo"
GMVideoInputManager_mlogo::GMVideoInputManager_mlogo (Ekiga::ServiceCore & _core)
-: core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // keep a reference in the main thread
+ runtime = &*smart;
current_state.opened = false;
}
+GMVideoInputManager_mlogo::~GMVideoInputManager_mlogo ()
+{
+ gmref_dec (runtime);
+}
+
void GMVideoInputManager_mlogo::get_devices(std::vector <Ekiga::VideoInputDevice> & devices)
{
Ekiga::VideoInputDevice device;
@@ -103,7 +110,7 @@
settings.colour = 127;
settings.contrast = 127;
settings.modifyable = false;
- runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+ runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
return true;
}
@@ -113,7 +120,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));
+ 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/videoinput/mlogo/videoinput-manager-mlogo.h
==============================================================================
--- trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h (original)
+++ trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h Wed Oct 15 12:53:55 2008
@@ -57,7 +57,7 @@
GMVideoInputManager_mlogo (Ekiga::ServiceCore & core);
- virtual ~GMVideoInputManager_mlogo () {}
+ ~GMVideoInputManager_mlogo ();
virtual void get_devices(std::vector <Ekiga::VideoInputDevice> & devices);
@@ -87,7 +87,7 @@
unsigned increment;
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
PAdaptiveDelay adaptive_delay;
};
Modified: trunk/lib/engine/videoinput/ptlib/Makefile.am
==============================================================================
--- trunk/lib/engine/videoinput/ptlib/Makefile.am (original)
+++ trunk/lib/engine/videoinput/ptlib/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videooutput/skel \
Modified: trunk/lib/engine/videoinput/ptlib/videoinput-main-ptlib.cpp
==============================================================================
--- trunk/lib/engine/videoinput/ptlib/videoinput-main-ptlib.cpp (original)
+++ trunk/lib/engine/videoinput/ptlib/videoinput-main-ptlib.cpp Wed Oct 15 12:53:55 2008
@@ -46,12 +46,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::VideoInputCore *videoinput_core = NULL;
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core.get ("videoinput-core");
- videoinput_core
- = dynamic_cast<Ekiga::VideoInputCore*>(core.get ("videoinput-core"));
-
- if (videoinput_core != NULL) {
+ if (videoinput_core) {
GMVideoInputManager_ptlib *videoinput_manager = new GMVideoInputManager_ptlib(core);
Modified: trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp (original)
+++ trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp Wed Oct 15 12:53:55 2008
@@ -41,14 +41,21 @@
#define DEVICE_TYPE "PTLIB"
GMVideoInputManager_ptlib::GMVideoInputManager_ptlib (Ekiga::ServiceCore & _core)
-: core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+: core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
current_state.opened = false;
input_device = NULL;
expectedFrameSize = 0;
}
+GMVideoInputManager_ptlib::~GMVideoInputManager_ptlib ()
+{
+ gmref_dec (runtime); // leave a reference in the main thread
+}
+
void GMVideoInputManager_ptlib::get_devices(std::vector <Ekiga::VideoInputDevice> & devices)
{
PStringArray video_sources;
@@ -129,7 +136,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));
+ runtime->run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
return false;
}
@@ -144,7 +151,7 @@
settings.contrast = contrast >> 8;
settings.modifyable = true;
- runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+ runtime->run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
return true;
}
@@ -157,7 +164,7 @@
input_device = NULL;
}
current_state.opened = false;
- runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+ 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/videoinput/ptlib/videoinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h (original)
+++ trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h Wed Oct 15 12:53:55 2008
@@ -56,8 +56,7 @@
GMVideoInputManager_ptlib (Ekiga::ServiceCore & core);
- virtual ~GMVideoInputManager_ptlib () {}
-
+ ~GMVideoInputManager_ptlib ();
virtual void get_devices(std::vector <Ekiga::VideoInputDevice> & devices);
@@ -78,7 +77,7 @@
protected:
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
unsigned expectedFrameSize;
PVideoInputDevice *input_device;
Modified: trunk/lib/engine/videoinput/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/videoinput/skel/Makefile.am (original)
+++ trunk/lib/engine/videoinput/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videooutput/skel \
Modified: trunk/lib/engine/videooutput/Makefile.am
==============================================================================
--- trunk/lib/engine/videooutput/Makefile.am (original)
+++ trunk/lib/engine/videooutput/Makefile.am Wed Oct 15 12:53:55 2008
@@ -3,7 +3,7 @@
if !WIN32
SUBDIRS += x
endif
-
+
# DirectX
if HAVE_DX
SUBDIRS += dx
Modified: trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp
==============================================================================
--- trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp (original)
+++ trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp Wed Oct 15 12:53:55 2008
@@ -48,12 +48,16 @@
/* The functions */
GMVideoOutputManager::GMVideoOutputManager(Ekiga::ServiceCore & _core)
: PThread (1000, NoAutoDeleteThread, HighestPriority, "GMVideoOutputManager"),
- core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+ core (_core)
{
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference on smart in the main thread
+ runtime = &*smart;
}
GMVideoOutputManager::~GMVideoOutputManager ()
{
+ gmref_dec (runtime); // leave a reference on smart in the main thread
}
void GMVideoOutputManager::open ()
@@ -250,8 +254,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));
+ 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));
}
Modified: trunk/lib/engine/videooutput/common/videooutput-manager-common.h
==============================================================================
--- trunk/lib/engine/videooutput/common/videooutput-manager-common.h (original)
+++ trunk/lib/engine/videooutput/common/videooutput-manager-common.h Wed Oct 15 12:53:55 2008
@@ -257,7 +257,7 @@
from various threads */
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
};
/**
Modified: trunk/lib/engine/videooutput/dx/Makefile.am
==============================================================================
--- trunk/lib/engine/videooutput/dx/Makefile.am (original)
+++ trunk/lib/engine/videooutput/dx/Makefile.am Wed Oct 15 12:53:55 2008
@@ -7,6 +7,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videooutput/skel \
Modified: trunk/lib/engine/videooutput/dx/videooutput-main-dx.cpp
==============================================================================
--- trunk/lib/engine/videooutput/dx/videooutput-main-dx.cpp (original)
+++ trunk/lib/engine/videooutput/dx/videooutput-main-dx.cpp Wed Oct 15 12:53:55 2008
@@ -45,12 +45,9 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::VideoOutputCore *videooutput_core = NULL;
+ gmref_ptr<Ekiga::VideoOutputCore> videooutput_core = core.get ("videooutput-core");
- videooutput_core
- = dynamic_cast<Ekiga::VideoOutputCore*>(core.get ("videooutput-core"));
-
- if (videooutput_core != NULL) {
+ if (videooutput_core) {
GMVideoOutputManager_dx *videooutput_manager = new GMVideoOutputManager_dx(core);
Modified: trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp
==============================================================================
--- trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp (original)
+++ trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp Wed Oct 15 12:53:55 2008
@@ -76,21 +76,21 @@
get_display_info(local_display_info);
-// runtime.run_in_main (force_redraw.make_slot ()); //FIXME: check
+// 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)));
+ 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)));
+ 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));
+ 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));
+ runtime->run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
break;
case Ekiga::VO_MODE_UNSET:
default:
@@ -195,21 +195,22 @@
// close_frame_display ();
last_frame.both_streams_active = current_frame.both_streams_active;
+
if (video_disabled) {
delete dxWindow;
dxWindow = NULL;
- runtime.run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
+ 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));
+ 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 ());
+ runtime->run_in_main (device_closed.make_slot ());
if (dxWindow) {
@@ -241,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));
+ 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/videooutput/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/videooutput/skel/Makefile.am (original)
+++ trunk/lib/engine/videooutput/skel/Makefile.am Wed Oct 15 12:53:55 2008
@@ -6,6 +6,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videooutput/skel
Modified: trunk/lib/engine/videooutput/x/Makefile.am
==============================================================================
--- trunk/lib/engine/videooutput/x/Makefile.am (original)
+++ trunk/lib/engine/videooutput/x/Makefile.am Wed Oct 15 12:53:55 2008
@@ -7,6 +7,7 @@
INCLUDES = \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/videooutput/skel \
Modified: trunk/lib/engine/videooutput/x/videooutput-main-x.cpp
==============================================================================
--- trunk/lib/engine/videooutput/x/videooutput-main-x.cpp (original)
+++ trunk/lib/engine/videooutput/x/videooutput-main-x.cpp Wed Oct 15 12:53:55 2008
@@ -45,12 +45,10 @@
char **/*argv*/[])
{
bool result = false;
- Ekiga::VideoOutputCore *videooutput_core = NULL;
+ gmref_ptr<Ekiga::VideoOutputCore> videooutput_core
+ = core.get ("videooutput-core");
- videooutput_core
- = dynamic_cast<Ekiga::VideoOutputCore*>(core.get ("videooutput-core"));
-
- if (videooutput_core != NULL) {
+ if (videooutput_core) {
GMVideoOutputManager_x *videooutput_manager = new GMVideoOutputManager_x(core);
Modified: trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp
==============================================================================
--- trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp (original)
+++ trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp Wed Oct 15 12:53:55 2008
@@ -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)));
+ 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)));
+ 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));
+ 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));
+ runtime->run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
break;
case Ekiga::VO_MODE_UNSET:
default:
@@ -419,18 +419,19 @@
}
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));
+ 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));
+ 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 ());
+ runtime->run_in_main (device_closed.make_slot ());
if (rxWindow)
rxWindow->RegisterSlave (NULL);
@@ -481,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));
+ 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/src/components/dbus.cpp
==============================================================================
--- trunk/src/components/dbus.cpp (original)
+++ trunk/src/components/dbus.cpp Wed Oct 15 12:53:55 2008
@@ -137,9 +137,8 @@
const gchar *uri,
G_GNUC_UNUSED GError **error)
{
- Ekiga::CallCore *call_core = NULL;
-
- call_core = dynamic_cast<Ekiga::CallCore*> (self->priv->core->get ("call-core"));
+ gmref_ptr<Ekiga::CallCore> call_core
+ = self->priv->core->get ("call-core");
call_core->dial (uri);
return TRUE;
Modified: trunk/src/devices/audiodev.cpp
==============================================================================
--- trunk/src/devices/audiodev.cpp (original)
+++ trunk/src/devices/audiodev.cpp Wed Oct 15 12:53:55 2008
@@ -72,10 +72,10 @@
///////////////////////////////////////////////////////////////////////////////
-PSoundChannel_EKIGA::PSoundChannel_EKIGA (Ekiga::ServiceCore & _core)
-: core (_core),
- audioinput_core (*(dynamic_cast<Ekiga::AudioInputCore *> (_core.get ("audioinput-core")))),
- audiooutput_core (*(dynamic_cast<Ekiga::AudioOutputCore *> (_core.get ("audiooutput-core"))))
+PSoundChannel_EKIGA::PSoundChannel_EKIGA (Ekiga::ServiceCore & _core):
+ core (_core),
+ audioinput_core (core.get ("audioinput-core")),
+ audiooutput_core (core.get ("audiooutput-core"))
{
opened = false;
}
@@ -83,13 +83,13 @@
PSoundChannel_EKIGA::PSoundChannel_EKIGA (const PString & /*_device*/,
Directions dir,
- unsigned numChannels,
- unsigned sampleRate,
- unsigned bitsPerSample,
- Ekiga::ServiceCore & _core)
-: core (_core),
- audioinput_core (*(dynamic_cast<Ekiga::AudioInputCore *> (_core.get ("audioinput-core")))),
- audiooutput_core (*(dynamic_cast<Ekiga::AudioOutputCore *> (_core.get ("audiooutput-core"))))
+ unsigned numChannels,
+ unsigned sampleRate,
+ unsigned bitsPerSample,
+ Ekiga::ServiceCore & _core):
+ core (_core),
+ audioinput_core (core.get ("audioinput-core")),
+ audiooutput_core (core.get ("audiooutput-core"))
{
opened = false;
Open (device, dir, numChannels, sampleRate, bitsPerSample);
@@ -120,10 +120,10 @@
direction = _dir;
if (_dir == Recorder) {
- audioinput_core.start_stream(_numChannels, _sampleRate, _bitsPerSample);
+ audioinput_core->start_stream(_numChannels, _sampleRate, _bitsPerSample);
}
else {
- audiooutput_core.start (_numChannels, _sampleRate, _bitsPerSample);
+ audiooutput_core->start (_numChannels, _sampleRate, _bitsPerSample);
}
mNumChannels = _numChannels;
@@ -141,10 +141,10 @@
return true;
if (direction == Recorder) {
- audioinput_core.stop_stream();
+ audioinput_core->stop_stream();
}
else {
- audiooutput_core.stop();
+ audiooutput_core->stop();
}
opened = false;
return true;
@@ -156,7 +156,7 @@
unsigned bytesWritten;
if (direction == Player) {
- audiooutput_core.set_frame_data((char*)buf, len, bytesWritten);
+ audiooutput_core->set_frame_data((char*)buf, len, bytesWritten);
}
lastWriteCount = bytesWritten;
@@ -169,7 +169,7 @@
unsigned bytesRead;
if (direction == Recorder) {
- audioinput_core.get_frame_data((char*)buf, len, bytesRead);
+ audioinput_core->get_frame_data((char*)buf, len, bytesRead);
}
lastReadCount = bytesRead;
@@ -198,10 +198,10 @@
bool PSoundChannel_EKIGA::SetBuffers (PINDEX size, PINDEX count)
{
if (direction == Recorder) {
- audioinput_core.set_stream_buffer_size(size, count);
+ audioinput_core->set_stream_buffer_size(size, count);
}
else {
- audiooutput_core.set_buffer_size(size, count);
+ audiooutput_core->set_buffer_size(size, count);
}
storedPeriods = count;
Modified: trunk/src/devices/audiodev.h
==============================================================================
--- trunk/src/devices/audiodev.h (original)
+++ trunk/src/devices/audiodev.h Wed Oct 15 12:53:55 2008
@@ -92,8 +92,8 @@
PINDEX storedVolume;
Ekiga::ServiceCore & core;
- Ekiga::AudioInputCore & audioinput_core;
- Ekiga::AudioOutputCore & audiooutput_core;
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core;
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core;
bool opened;
};
Modified: trunk/src/devices/videoinput.cpp
==============================================================================
--- trunk/src/devices/videoinput.cpp (original)
+++ trunk/src/devices/videoinput.cpp Wed Oct 15 12:53:55 2008
@@ -68,9 +68,14 @@
int PVideoInputDevice_EKIGA::devices_nbr = 0;
-PVideoInputDevice_EKIGA::PVideoInputDevice_EKIGA (Ekiga::ServiceCore & _core)
-: core (_core), videoinput_core (*(dynamic_cast<Ekiga::VideoInputCore *> (_core.get ("videoinput-core"))))
+PVideoInputDevice_EKIGA::PVideoInputDevice_EKIGA (Ekiga::ServiceCore & _core):
+ core (_core)
{
+ {
+ gmref_ptr<Ekiga::VideoInputCore> smart = core.get ("videoinput-core");
+ gmref_inc (smart); // take a reference in the main thread
+ videoinput_core = &*smart;
+ }
opened = false;
is_active = false;
}
@@ -79,6 +84,7 @@
PVideoInputDevice_EKIGA::~PVideoInputDevice_EKIGA ()
{
Close ();
+ gmref_dec (videoinput_core); // leave a reference in the main thread
}
bool
@@ -88,8 +94,8 @@
if (start_immediate) {
if (!is_active) {
if (devices_nbr == 0) {
- videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
- videoinput_core.start_stream();
+ videoinput_core->set_stream_config(frameWidth, frameHeight, frameRate);
+ videoinput_core->start_stream();
}
is_active = true;
devices_nbr++;
@@ -114,7 +120,7 @@
if (is_active) {
devices_nbr--;
if (devices_nbr==0)
- videoinput_core.stop_stream();
+ videoinput_core->stop_stream();
is_active = false;
}
opened = false;
@@ -128,8 +134,8 @@
{
if (!is_active) {
if (devices_nbr == 0) {
- videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
- videoinput_core.start_stream();
+ videoinput_core->set_stream_config(frameWidth, frameHeight, frameRate);
+ videoinput_core->start_stream();
}
is_active = true;
devices_nbr++;
@@ -178,7 +184,7 @@
PVideoInputDevice_EKIGA::GetFrameData (BYTE *frame,
PINDEX *i)
{
- videoinput_core.get_frame_data((char*)frame);
+ videoinput_core->get_frame_data((char*)frame);
*i = frameWidth * frameHeight * 3 / 2;
@@ -189,7 +195,7 @@
bool PVideoInputDevice_EKIGA::GetFrameDataNoDelay (BYTE *frame,
PINDEX *i)
{
- videoinput_core.get_frame_data((char*)frame);
+ videoinput_core->get_frame_data((char*)frame);
*i = frameWidth * frameHeight * 3 / 2;
return true;
Modified: trunk/src/devices/videoinput.h
==============================================================================
--- trunk/src/devices/videoinput.h (original)
+++ trunk/src/devices/videoinput.h Wed Oct 15 12:53:55 2008
@@ -181,7 +181,7 @@
protected:
Ekiga::ServiceCore & core;
- Ekiga::VideoInputCore & videoinput_core;
+ Ekiga::VideoInputCore* videoinput_core;
bool opened;
};
Modified: trunk/src/devices/videooutput.cpp
==============================================================================
--- trunk/src/devices/videooutput.cpp (original)
+++ trunk/src/devices/videooutput.cpp Wed Oct 15 12:53:55 2008
@@ -78,9 +78,19 @@
/* The Methods */
PVideoOutputDevice_EKIGA::PVideoOutputDevice_EKIGA (Ekiga::ServiceCore & _core)
-: core (_core), videooutput_core (*(dynamic_cast<Ekiga::VideoOutputCore *> (_core.get ("videooutput-core"))))
+: core (_core)
{
- PWaitAndSignal m(videoDisplay_mutex);
+ PWaitAndSignal m(videoDisplay_mutex); /* FIXME: if it's really needed
+ * then we may crash : it's wrong to
+ * use 'core' from a thread -- mutex
+ * or not mutex.
+ */
+
+ {
+ gmref_ptr<Ekiga::VideoOutputCore> smart = core.get ("videooutput-core");
+ gmref_inc (smart); // take a reference in the main thread
+ videooutput_core = &*smart;
+ }
is_active = FALSE;
@@ -91,12 +101,17 @@
PVideoOutputDevice_EKIGA::~PVideoOutputDevice_EKIGA()
{
- PWaitAndSignal m(videoDisplay_mutex);
+ PWaitAndSignal m(videoDisplay_mutex); /* FIXME: if it's really needed
+ * then we may crash : it's wrong to
+ * have played with 'core' from a thread
+ */
+
+ gmref_dec (videooutput_core); // leave a reference in the main thread
if (is_active) {
devices_nbr--;
if (devices_nbr==0)
- videooutput_core.stop();
+ videooutput_core->stop();
is_active = false;
}
}
@@ -151,13 +166,13 @@
if (!is_active) {
if (devices_nbr == 0) {
- videooutput_core.start();
+ videooutput_core->start();
}
is_active = TRUE;
devices_nbr++;
}
- videooutput_core.set_frame_data((const char*) data, width, height, (device_id == LOCAL), devices_nbr);
+ videooutput_core->set_frame_data((const char*) data, width, height, (device_id == LOCAL), devices_nbr);
return TRUE;
}
Modified: trunk/src/devices/videooutput.h
==============================================================================
--- trunk/src/devices/videooutput.h (original)
+++ trunk/src/devices/videooutput.h Wed Oct 15 12:53:55 2008
@@ -141,7 +141,7 @@
enum {REMOTE, LOCAL};
Ekiga::ServiceCore & core;
- Ekiga::VideoOutputCore & videooutput_core;
+ Ekiga::VideoOutputCore* videooutput_core;
};
#endif
Modified: trunk/src/endpoints/h323-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/h323-endpoint.cpp (original)
+++ trunk/src/endpoints/h323-endpoint.cpp Wed Oct 15 12:53:55 2008
@@ -105,14 +105,18 @@
Opal::H323::EndPoint::EndPoint (Opal::CallManager & _manager, Ekiga::ServiceCore & _core, unsigned _listen_port)
: H323EndPoint (_manager),
manager (_manager),
- core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime")))),
- account_core (*(dynamic_cast<Ekiga::AccountCore *> (core.get ("account-core"))))
+ core (_core)
{
protocol_name = "h323";
uri_prefix = "h323:";
listen_port = _listen_port;
+ {
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
+ }
+
/* Initial requested bandwidth */
SetInitialBandwidth (40000);
@@ -341,15 +345,15 @@
info = _("Failed");
/* Signal */
- runtime.run_in_main (sigc::bind (account.registration_event.make_slot (),
- Ekiga::AccountCore::RegistrationFailed,
- info));
+ runtime->run_in_main (sigc::bind (account.registration_event.make_slot (),
+ Ekiga::AccountCore::RegistrationFailed,
+ info));
}
else {
- runtime.run_in_main (sigc::bind (account.registration_event.make_slot (),
- Ekiga::AccountCore::Registered,
- std::string ()));
+ runtime->run_in_main (sigc::bind (account.registration_event.make_slot (),
+ Ekiga::AccountCore::Registered,
+ std::string ()));
}
}
else if (unregister && IsRegisteredWithGatekeeper (account.get_host ())) {
@@ -358,9 +362,9 @@
RemoveAliasName (account.get_username ());
/* Signal */
- runtime.run_in_main (sigc::bind (account.registration_event.make_slot (),
- Ekiga::AccountCore::Unregistered,
- std::string ()));
+ runtime->run_in_main (sigc::bind (account.registration_event.make_slot (),
+ Ekiga::AccountCore::Unregistered,
+ std::string ()));
}
}
Modified: trunk/src/endpoints/h323-endpoint.h
==============================================================================
--- trunk/src/endpoints/h323-endpoint.h (original)
+++ trunk/src/endpoints/h323-endpoint.h Wed Oct 15 12:53:55 2008
@@ -121,8 +121,7 @@
CallManager & manager;
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
- Ekiga::AccountCore & account_core;
+ Ekiga::Runtime* runtime;
PMutex gk_name_mutex;
PString gk_name;
Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp (original)
+++ trunk/src/endpoints/manager.cpp Wed Oct 15 12:53:55 2008
@@ -102,8 +102,7 @@
/* The class */
CallManager::CallManager (Ekiga::ServiceCore & _core)
-: core (_core),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
+: core (_core)
{
/* Initialise the endpoint paramaters */
PIPSocket::SetDefaultIpAddressFamilyV4();
@@ -140,9 +139,7 @@
SetMediaFormatOrder (PStringArray ());
SetMediaFormatMask (PStringArray ());
- //
- call_core = dynamic_cast<Ekiga::CallCore *> (core.get ("call-core"));
-
+ call_core = core.get ("call-core");
// used to communicate with the StunDetector
#if GLIB_CHECK_VERSION(2,16,0)
@@ -169,7 +166,8 @@
new StunDetector (stun_server, *this, queue);
patience = 20;
- runtime.run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult), 1);
+ gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
+ runtime->run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult), 1);
}
@@ -721,9 +719,10 @@
} else {
patience--;
- runtime.run_in_main (sigc::mem_fun (this,
+ gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
+ runtime->run_in_main (sigc::mem_fun (this,
&CallManager::HandleSTUNResult),
- 1);
+ 1);
}
}
@@ -731,9 +730,12 @@
CallManager::ReportSTUNError (const std::string error)
{
// 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);
+ if ( !call_core->errors.handle_request (error)) {
+
+ gmref_ptr<Ekiga::Runtime> runtime = core.get ("runtime");
+ runtime->run_in_main (sigc::bind (sigc::mem_fun (this,
+ &CallManager::ReportSTUNError),
+ error),
+ 10);
+ }
}
Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h (original)
+++ trunk/src/endpoints/manager.h Wed Oct 15 12:53:55 2008
@@ -169,9 +169,8 @@
PMutex manager_access_mutex;
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
Ekiga::CodecList codecs;
- Ekiga::CallCore *call_core;
+ gmref_ptr<Ekiga::CallCore> call_core; // FIXME: is it threaded in there?
/* used to get the STUNDetector results */
GAsyncQueue* queue;
Modified: trunk/src/endpoints/opal-account.cpp
==============================================================================
--- trunk/src/endpoints/opal-account.cpp (original)
+++ trunk/src/endpoints/opal-account.cpp Wed Oct 15 12:53:55 2008
@@ -250,7 +250,7 @@
{
enabled = true;
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
account_core->subscribe_account (*this);
updated.emit ();
@@ -262,7 +262,7 @@
{
enabled = false;
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
account_core->unsubscribe_account (*this);
updated.emit ();
@@ -287,7 +287,7 @@
enabled = false;
dead = true;
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
account_core->unsubscribe_account (*this);
trigger_saving.emit ();
Modified: trunk/src/endpoints/opal-call.cpp
==============================================================================
--- trunk/src/endpoints/opal-call.cpp (original)
+++ trunk/src/endpoints/opal-call.cpp Wed Oct 15 12:53:55 2008
@@ -57,9 +57,13 @@
Opal::Call::Call (OpalManager & _manager, Ekiga::ServiceCore & _core)
: OpalCall (_manager), Ekiga::Call (), core (_core),
- runtime (*dynamic_cast<Ekiga::Runtime*>(core.get ("runtime"))),
call_setup(false),outgoing(true),jitter(0)
{
+ {
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
+ }
re_a_bytes = tr_a_bytes = re_v_bytes = tr_v_bytes = 0.0;
last_v_tick = last_a_tick = PTime ();
total_a =
@@ -79,6 +83,7 @@
Opal::Call::~Call ()
{
+ gmref_dec (runtime); // leave a reference in the main thead
}
@@ -172,9 +177,9 @@
stream->SetPaused (!paused);
if (paused)
- runtime.run_in_main (sigc::bind (stream_resumed, stream_name, type));
+ runtime->run_in_main (sigc::bind (stream_resumed, stream_name, type));
else
- runtime.run_in_main (sigc::bind (stream_paused, stream_name, type));
+ runtime->run_in_main (sigc::bind (stream_paused, stream_name, type));
}
}
}
@@ -342,7 +347,7 @@
if (!PIsDescendant(&connection, OpalPCSSConnection)) {
parse_info (connection);
- runtime.emit_signal_in_main (established);
+ runtime->emit_signal_in_main (established);
}
if (PIsDescendant(&connection, OpalRTPConnection)) {
@@ -400,7 +405,7 @@
&& !is_outgoing ()
&& GetCallEndReason () != OpalConnection::EndedByAnswerDenied) {
- runtime.emit_signal_in_main (missed);
+ runtime->emit_signal_in_main (missed);
}
else {
@@ -482,7 +487,7 @@
reason = _("Call completed");
}
- runtime.emit_signal_in_main (cleared, reason);
+ runtime->emit_signal_in_main (cleared, reason);
}
}
@@ -504,7 +509,7 @@
{
parse_info (connection);
- runtime.emit_signal_in_main (setup);
+ runtime->emit_signal_in_main (setup);
call_setup = true;
cleared.connect (sigc::mem_fun (this, &Opal::Call::on_cleared_call));
@@ -518,7 +523,7 @@
Opal::Call::OnAlerting (OpalConnection & connection)
{
if (!PIsDescendant(&connection, OpalPCSSConnection))
- runtime.emit_signal_in_main (ringing);
+ runtime->emit_signal_in_main (ringing);
return OpalCall::OnAlerting (connection);
}
@@ -530,9 +535,9 @@
bool on_hold)
{
if (on_hold)
- runtime.emit_signal_in_main (held);
+ runtime->emit_signal_in_main (held);
else
- runtime.emit_signal_in_main (retrieved);
+ runtime->emit_signal_in_main (retrieved);
}
@@ -547,7 +552,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));
+ runtime->run_in_main (sigc::bind (stream_opened, stream_name, type, is_transmitting));
}
@@ -562,7 +567,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));
+ runtime->run_in_main (sigc::bind (stream_closed, stream_name, type, is_transmitting));
}
Modified: trunk/src/endpoints/opal-call.h
==============================================================================
--- trunk/src/endpoints/opal-call.h (original)
+++ trunk/src/endpoints/opal-call.h Wed Oct 15 12:53:55 2008
@@ -210,7 +210,7 @@
* Variables
*/
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
+ Ekiga::Runtime* runtime;
bool call_setup;
Modified: trunk/src/endpoints/opal-main.cpp
==============================================================================
--- trunk/src/endpoints/opal-main.cpp (original)
+++ trunk/src/endpoints/opal-main.cpp Wed Oct 15 12:53:55 2008
@@ -82,11 +82,11 @@
void
on_call_manager_ready_cb (Ekiga::ServiceCore *core)
{
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (core->get ("account-core"));
- Opal::Bank *bank = new Bank (*core);
+ gmref_ptr<Ekiga::AccountCore> account_core = core->get ("account-core");
+ gmref_ptr<Opal::Bank> bank = new Bank (*core);
account_core->add_bank (*bank);
- core->add (*bank);
+ core->add (bank);
}
bool
@@ -94,21 +94,15 @@
int * /*argc*/,
char ** /*argv*/[])
{
- Ekiga::ContactCore *contact_core = NULL;
- Ekiga::PresenceCore *presence_core = NULL;
- Ekiga::CallCore *call_core = NULL;
- Ekiga::ChatCore *chat_core = NULL;
- Ekiga::AccountCore *account_core = NULL;
+ gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
+ gmref_ptr<Ekiga::CallCore> call_core = core.get ("call-core");
+ gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
+ gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
bool result = true;
- contact_core = dynamic_cast<Ekiga::ContactCore *> (core.get ("contact-core"));
- presence_core = dynamic_cast<Ekiga::PresenceCore *> (core.get ("presence-core"));
- call_core = dynamic_cast<Ekiga::CallCore *> (core.get ("call-core"));
- chat_core = dynamic_cast<Ekiga::ChatCore *> (core.get ("chat-core"));
- account_core = dynamic_cast<Ekiga::AccountCore *> (core.get ("account-core"));
-
- CallManager *call_manager = new CallManager (core);
+ gmref_ptr<CallManager> call_manager = new CallManager (core);
#ifdef HAVE_SIP
unsigned sip_port = gm_conf_get_int (SIP_KEY "listen_port");
@@ -126,12 +120,12 @@
call_core->add_manager (*call_manager);
- new ConfBridge (*call_manager);
+ new ConfBridge (*call_manager); // FIXME: isn't that leaked!?
// Add the bank of accounts when the CallManager is ready
call_manager->ready.connect (sigc::bind (sigc::ptr_fun (on_call_manager_ready_cb), &core));
- if (contact_core != NULL) {
+ if (contact_core) {
#ifdef HAVE_SIP
contact_core->add_contact_decorator (*sip_manager);
@@ -143,7 +137,7 @@
else
return false;
- if (presence_core != NULL) {
+ if (presence_core) {
#ifdef HAVE_SIP
presence_core->add_presentity_decorator (*sip_manager);
@@ -158,7 +152,7 @@
else
return false;
- core.add (*call_manager);
+ core.add (call_manager);
return result;
}
Modified: trunk/src/endpoints/pcss.cpp
==============================================================================
--- trunk/src/endpoints/pcss.cpp (original)
+++ trunk/src/endpoints/pcss.cpp Wed Oct 15 12:53:55 2008
@@ -47,8 +47,7 @@
GMPCSSEndpoint::GMPCSSEndpoint (Opal::CallManager & ep,
Ekiga::ServiceCore & _core)
: OpalPCSSEndPoint (ep),
- core (_core),
- runtime (*dynamic_cast<Ekiga::Runtime*>(core.get ("runtime")))
+ core (_core)
{
#ifdef WIN32
SetSoundChannelBufferDepth (20);
Modified: trunk/src/endpoints/pcss.h
==============================================================================
--- trunk/src/endpoints/pcss.h (original)
+++ trunk/src/endpoints/pcss.h Wed Oct 15 12:53:55 2008
@@ -61,7 +61,6 @@
private:
Ekiga::ServiceCore & core;
- Ekiga::Runtime & runtime;
};
#endif
Modified: trunk/src/endpoints/sip-chat-simple.cpp
==============================================================================
--- trunk/src/endpoints/sip-chat-simple.cpp (original)
+++ trunk/src/endpoints/sip-chat-simple.cpp Wed Oct 15 12:53:55 2008
@@ -86,10 +86,7 @@
SIP::SimpleChat::send_message (const std::string msg)
{
bool result;
- Ekiga::PersonalDetails* personal = NULL;
-
- personal
- = dynamic_cast<Ekiga::PersonalDetails*>(core.get ("personal-details"));
+ gmref_ptr<Ekiga::PersonalDetails> personal = core.get ("personal-details");
result = sender (msg);
for (std::list<Ekiga::ChatObserver*>::iterator iter
= observers.begin ();
Modified: trunk/src/endpoints/sip-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/sip-endpoint.cpp (original)
+++ trunk/src/endpoints/sip-endpoint.cpp Wed Oct 15 12:53:55 2008
@@ -46,7 +46,6 @@
#include "opal-bank.h"
#include "opal-call.h"
-#include "presence-core.h"
#include "account-core.h"
#include "chat-core.h"
#include "personal-details.h"
@@ -144,18 +143,26 @@
unsigned _listen_port)
: SIPEndPoint (_manager),
manager (_manager),
- core (_core),
- presence_core (*(dynamic_cast<Ekiga::PresenceCore *> (core.get ("presence-core")))),
- runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime")))),
- account_core (*(dynamic_cast<Ekiga::AccountCore *> (core.get ("account-core"))))
+ core (_core)
{
- Ekiga::ChatCore* chat_core;
+ gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
+
+ {
+ gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
+ gmref_inc (smart); // take a reference in the main thread
+ runtime = &*smart;
+ }
+ {
+ gmref_ptr<Ekiga::AccountCore> smart = core.get ("account-core");
+ gmref_inc (smart); // take a reference in the main thread
+ account_core = &*smart;
+ }
+
protocol_name = "sip";
uri_prefix = "sip:";
listen_port = _listen_port;
- chat_core = dynamic_cast<Ekiga::ChatCore *> (core.get ("chat-core"));
dialect = new SIP::Dialect (core, sigc::mem_fun (this, &Opal::Sip::EndPoint::send_message));
chat_core->add_dialect (*dialect);
@@ -180,7 +187,7 @@
/* NAT Binding */
SetNATBindingRefreshMethod (SIPEndPoint::EmptyRequest);
- Ekiga::PersonalDetails *details = dynamic_cast<Ekiga::PersonalDetails *> (_core.get ("personal-details"));
+ gmref_ptr<Ekiga::PersonalDetails> details = core.get ("personal-details");
if (details)
publish (*details);
}
@@ -188,6 +195,8 @@
Opal::Sip::EndPoint::~EndPoint ()
{
+ gmref_dec (runtime); // leave a reference in the main thread
+ gmref_dec (account_core); // leave a reference in the main thread
delete dialect;
}
@@ -223,7 +232,7 @@
if (uri.find ("@") == string::npos) {
- Opal::Bank *bank = dynamic_cast<Opal::Bank*> (core.get ("opal-account-store"));
+ gmref_ptr<Opal::Bank> bank = core.get ("opal-account-store");
if (bank) {
@@ -692,10 +701,10 @@
Subscribe (SIPSubscribe::MessageSummary, 3600, aor);
/* Signal */
- Ekiga::Account *account = account_core.find_account (strm.str ());
+ Ekiga::Account *account = account_core->find_account (strm.str ());
if (account)
- runtime.run_in_main (sigc::bind (account->registration_event.make_slot (),
- was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
+ runtime->run_in_main (sigc::bind (account->registration_event.make_slot (),
+ was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
std::string ()));
}
@@ -925,10 +934,10 @@
SIPEndPoint::OnRegistrationFailed (strm.str ().c_str (), r, wasRegistering);
/* Signal */
- Ekiga::Account *account = account_core.find_account (strm.str ());
+ Ekiga::Account *account = account_core->find_account (strm.str ());
if (account)
- runtime.run_in_main (sigc::bind (account->registration_event.make_slot (),
- wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
+ runtime->run_in_main (sigc::bind (account->registration_event.make_slot (),
+ wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
info));
}
@@ -941,9 +950,9 @@
mwi = "0/0";
/* Signal */
- Ekiga::Account *account = account_core.find_account (party);
+ Ekiga::Account *account = account_core->find_account (party);
if (account)
- runtime.run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
+ runtime->run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
}
@@ -1008,7 +1017,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));
+ runtime->run_in_main (sigc::bind (sigc::ptr_fun (push_message_in_main), dialect, message_uri, display_name, _message));
}
return SIPEndPoint::OnReceivedMESSAGE (transport, pdu);
@@ -1023,9 +1032,9 @@
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),
- dialect, uri, display_name,
- _("Could not send message")));
+ runtime->run_in_main (sigc::bind (sigc::ptr_fun (push_notice_in_main),
+ dialect, uri, display_name,
+ _("Could not send message")));
}
@@ -1053,7 +1062,7 @@
*/
if (host.GetHostAddress ().GetIpAndPort (address, port) && !manager.IsLocalAddress (address)) {
- Ekiga::Account *account = account_core.find_account ("ekiga.net");
+ Ekiga::Account *account = account_core->find_account ("ekiga.net");
if (account)
return SIPURL ("\"" + GetDefaultDisplayName () + "\" <" + PString(account->get_aor ()) + ">");
@@ -1115,7 +1124,7 @@
* TODO
* Wouldn't it be convenient to emit the signal and have the presence core listen to it ?
*/
- runtime.run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, _uri, presence, status));
+ runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, _uri, presence, status));
}
Modified: trunk/src/endpoints/sip-endpoint.h
==============================================================================
--- trunk/src/endpoints/sip-endpoint.h (original)
+++ trunk/src/endpoints/sip-endpoint.h Wed Oct 15 12:53:55 2008
@@ -182,9 +182,8 @@
std::list<std::string> domains; // List of registered domains
std::list<std::string> aors; // List of registered aor
Ekiga::ServiceCore & core;
- Ekiga::PresenceCore & presence_core;
- Ekiga::Runtime & runtime;
- Ekiga::AccountCore & account_core;
+ Ekiga::Runtime* runtime;
+ Ekiga::AccountCore* account_core;
Ekiga::CallProtocolManager::Interface listen_iface;
Modified: trunk/src/gui/accounts.cpp
==============================================================================
--- trunk/src/gui/accounts.cpp (original)
+++ trunk/src/gui/accounts.cpp Wed Oct 15 12:53:55 2008
@@ -266,16 +266,14 @@
std::string mwi,
gpointer self)
{
- GmAccountsWindow *aw = NULL;
-
- aw = gm_aw_get_aw (GTK_WIDGET (self));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (aw->core.get ("audiooutput-core"));
-
if (gm_accounts_window_update_account_state (GTK_WIDGET (self), false, account, NULL, mwi.c_str ())) {
std::string::size_type loc = mwi.find ("/", 0);
if (loc != std::string::npos) {
+ GmAccountsWindow *aw = gm_aw_get_aw (GTK_WIDGET (self));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = aw->core.get ("audiooutput-core");
std::stringstream new_messages;
int i;
new_messages << mwi.substr (0, loc);
@@ -306,7 +304,8 @@
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (aw->accounts_list));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (aw->accounts_list));
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (aw->core.get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = aw->core.get ("account-core");
if (account_core->populate_menu (builder)) {
item = gtk_separator_menu_item_new ();
@@ -765,7 +764,8 @@
/* Engine Signals callbacks */
// FIXME sigc::connection conn;
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (core.get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = core.get ("account-core");
account_core->bank_added.connect (sigc::bind (sigc::ptr_fun (on_bank_added), window));
account_core->account_added.connect (sigc::bind (sigc::ptr_fun (on_account_added), window));
account_core->account_updated.connect (sigc::bind (sigc::ptr_fun (on_account_updated), window));
Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp (original)
+++ trunk/src/gui/assistant.cpp Wed Oct 15 12:53:55 2008
@@ -627,7 +627,8 @@
static void
prepare_ekiga_net_page (EkigaAssistant *assistant)
{
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (assistant->priv->core->get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = assistant->priv->core->get ("account-core");
Ekiga::Account *account = account_core->find_account ("ekiga.net");
if (account && !account->get_username ().empty ())
@@ -644,11 +645,13 @@
static void
apply_ekiga_net_page (EkigaAssistant *assistant)
{
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (assistant->priv->core->get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = assistant->priv->core->get ("account-core");
/* Some specific Opal stuff for the Ekiga.net account */
- Opal::Bank *opal_bank = dynamic_cast<Opal::Bank *> (assistant->priv->core->get ("opal-account-store"));
- Opal::Account *account = dynamic_cast<Opal::Account *> (account_core->find_account ("ekiga.net"));
+ gmref_ptr<Opal::Bank> opal_bank =
+ assistant->priv->core->get ("opal-account-store");
+ Opal::Account* account = dynamic_cast<Opal::Account*>(account_core->find_account ("ekiga.net"));
bool new_account = (account == NULL);
@@ -775,7 +778,8 @@
static void
prepare_ekiga_out_page (EkigaAssistant *assistant)
{
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (assistant->priv->core->get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = assistant->priv->core->get ("account-core");
Ekiga::Account *account = account_core->find_account ("sip.diamondcard.us");
if (account && !account->get_username ().empty ())
@@ -792,11 +796,13 @@
static void
apply_ekiga_out_page (EkigaAssistant *assistant)
{
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (assistant->priv->core->get ("account-core"));
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = assistant->priv->core->get ("account-core");
/* Some specific Opal stuff for the Ekiga.net account */
- Opal::Bank *opal_bank = dynamic_cast<Opal::Bank *> (assistant->priv->core->get ("opal-account-store"));
- Opal::Account *account = dynamic_cast<Opal::Account *> (account_core->find_account ("sip.diamondcard.us"));
+ gmref_ptr<Opal::Bank> opal_bank
+ = assistant->priv->core->get ("opal-account-store");
+ Opal::Account* account = dynamic_cast<Opal::Account*> (account_core->find_account ("sip.diamondcard.us"));
bool new_account = (account == NULL);
@@ -1214,7 +1220,8 @@
get_audiooutput_devices_list (Ekiga::ServiceCore *core,
std::vector<std::string> & device_list)
{
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
std::vector <Ekiga::AudioOutputDevice> devices;
device_list.clear();
@@ -1237,7 +1244,8 @@
get_audioinput_devices_list (Ekiga::ServiceCore *core,
std::vector<std::string> & device_list)
{
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (core->get ("audioinput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core->get ("audioinput-core");
std::vector <Ekiga::AudioInputDevice> devices;
device_list.clear();
@@ -1260,7 +1268,8 @@
get_videoinput_devices_list (Ekiga::ServiceCore *core,
std::vector<std::string> & device_list)
{
- Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (core->get ("videoinput-core"));
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core->get ("videoinput-core");
std::vector<Ekiga::VideoInputDevice> devices;
device_list.clear();
@@ -1622,9 +1631,12 @@
G_CALLBACK (ekiga_assistant_key_press_cb), NULL);
sigc::connection conn;
- Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (core->get ("videoinput-core"));
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (core->get ("audioinput-core"));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core->get ("videoinput-core");
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core->get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
conn = videoinput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_added_cb), assistant));
assistant->priv->connections.push_back (conn);
Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp (original)
+++ trunk/src/gui/main.cpp Wed Oct 15 12:53:55 2008
@@ -541,7 +541,8 @@
gpointer self)
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
if (!call.is_outgoing ()) {
ekiga_main_window_update_calling_state (mw, Called);
@@ -566,7 +567,8 @@
gpointer self)
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
if (call.is_outgoing ()) {
audiooutput_core->start_play_event("ring_tone_sound", 3000, 256);
@@ -584,7 +586,8 @@
if (mw->priv->calling_state == Connected && mw->priv->current_call) {
Ekiga::VideoOutputStats videooutput_stats;
- Ekiga::VideoOutputCore *videooutput_core = dynamic_cast<Ekiga::VideoOutputCore *> (mw->priv->core->get ("videooutput-core"));
+ gmref_ptr<Ekiga::VideoOutputCore> videooutput_core
+ = mw->priv->core->get ("videooutput-core");
videooutput_core->get_videooutput_stats(videooutput_stats);
msg = g_strdup_printf (_("A:%.1f/%.1f V:%.1f/%.1f FPS:%d/%d"),
@@ -616,8 +619,10 @@
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->priv->core->get ("audioinput-core"));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = mw->priv->core->get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
gtk_levelmeter_set_level (GTK_LEVELMETER (mw->priv->output_signal), audiooutput_core->get_average_level());
gtk_levelmeter_set_level (GTK_LEVELMETER (mw->priv->input_signal), audioinput_core->get_average_level());
@@ -648,7 +653,8 @@
mw->priv->timeout_id = g_timeout_add (1000, on_stats_refresh_cb, self);
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
audiooutput_core->stop_play_event("incoming_call_sound");
audiooutput_core->stop_play_event("ring_tone_sound");
@@ -682,7 +688,8 @@
g_source_remove (mw->priv->timeout_id);
mw->priv->timeout_id = -1;
}
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
audiooutput_core->stop_play_event("incoming_call_sound");
audiooutput_core->stop_play_event("ring_tone_sound");
@@ -696,7 +703,8 @@
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (GnomeMeeting::Process ()->GetMainWindow ());
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
audiooutput_core->stop_play_event("incoming_call_sound");
audiooutput_core->stop_play_event("ring_tone_sound");
@@ -745,7 +753,8 @@
gpointer self)
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
audiooutput_core->stop_play_event ("incoming_call_sound");
audiooutput_core->stop_play_event ("ring_tone_sound");
@@ -1432,7 +1441,6 @@
gpointer data)
{
std::string uri;
- Ekiga::CallCore *call_core = NULL;
EkigaMainWindow *mw = NULL;
g_return_if_fail (EKIGA_IS_MAIN_WINDOW (data));
@@ -1444,7 +1452,7 @@
size_t pos;
ekiga_main_window_update_calling_state (mw, Calling);
- call_core = dynamic_cast<Ekiga::CallCore*> (mw->priv->core->get ("call-core"));
+ gmref_ptr<Ekiga::CallCore> call_core = mw->priv->core->get ("call-core");
uri = ekiga_main_window_get_call_url (mw);
if (call_core->dial (uri)) {
@@ -1826,7 +1834,8 @@
return;
Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore ();
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
std::string file_name_string = gm_conf_get_string (SOUND_EVENTS_KEY "new_message_sound");
@@ -1949,8 +1958,10 @@
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (data);
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->priv->core->get ("audioinput-core"));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = mw->priv->core->get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
audiooutput_core->set_volume (Ekiga::primary, (unsigned) GTK_ADJUSTMENT (mw->priv->adj_output_volume)->value);
audioinput_core->set_volume ((unsigned) GTK_ADJUSTMENT (mw->priv->adj_input_volume)->value);
@@ -1962,8 +1973,10 @@
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (data);
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->priv->core->get ("audioinput-core"));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = mw->priv->core->get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
audioinput_core->set_average_collection (true);
audiooutput_core->set_average_collection (true);
@@ -1977,8 +1990,10 @@
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (data);
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->priv->core->get ("audioinput-core"));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = mw->priv->core->get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
g_source_remove (mw->priv->levelmeter_timeout_id);
audioinput_core->set_average_collection (false);
@@ -1991,7 +2006,8 @@
{
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (data);
- Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (mw->priv->core->get ("videoinput-core"));
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = mw->priv->core->get ("videoinput-core");
videoinput_core->set_whiteness ((unsigned) GTK_ADJUSTMENT (mw->priv->adj_whiteness)->value);
videoinput_core->set_brightness ((unsigned) GTK_ADJUSTMENT (mw->priv->adj_brightness)->value);
@@ -2703,7 +2719,8 @@
mw = EKIGA_MAIN_WINDOW (main_window);
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
if (audiooutput_core)
audiooutput_core->stop_play_event ("incoming_call_sound");
}
@@ -3022,8 +3039,6 @@
ekiga_main_window_init_menu (EkigaMainWindow *mw)
{
Ekiga::ServiceCore *services = NULL;
- Ekiga::Trigger *local_cluster_trigger = NULL;
- GtkFrontend *gtk_frontend = NULL;
GtkWidget *addressbook_window = NULL;
GtkWidget *accounts_window = NULL;
@@ -3035,8 +3050,9 @@
g_return_if_fail (mw != NULL);
services = GnomeMeeting::Process ()->GetServiceCore ();
- local_cluster_trigger = dynamic_cast<Ekiga::Trigger *>(services->get ("local-cluster"));
- gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
+ gmref_ptr<Ekiga::Trigger> local_cluster_trigger
+ = services->get ("local-cluster");
+ gmref_ptr<GtkFrontend> gtk_frontend = services->get ("gtk-frontend");
addressbook_window = GTK_WIDGET (gtk_frontend->get_addressbook_window ());
accounts_window = GnomeMeeting::Process ()->GetAccountsWindow ();
@@ -3062,7 +3078,7 @@
GTK_MENU_ENTRY("add_contact", _("A_dd Contact"), _("Add a contact to the roster"),
GTK_STOCK_ADD, 'n',
- G_CALLBACK (pull_trigger_cb), local_cluster_trigger, true),
+ G_CALLBACK (pull_trigger_cb), &*local_cluster_trigger, true),
GTK_MENU_THEME_ENTRY("address_book", _("Address _Book"),
_("Find contacts"),
@@ -3333,14 +3349,13 @@
{
GtkWidget *label = NULL;
- GtkFrontend *gtk_frontend = NULL;
Ekiga::ServiceCore *services = NULL;
GtkWidget* roster_view = NULL;
services = GnomeMeeting::Process ()->GetServiceCore ();
g_return_if_fail (services != NULL);
- gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> gtk_frontend = services->get ("gtk-frontend");
label = gtk_label_new (_("Contacts"));
roster_view = GTK_WIDGET (gtk_frontend->get_roster_view ());
@@ -3376,12 +3391,11 @@
{
Ekiga::ServiceCore *services = NULL;
GtkWidget *label = NULL;
- GtkFrontend *gtk_frontend = NULL;
services = GnomeMeeting::Process ()->GetServiceCore ();
g_return_if_fail (services != NULL);
- gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> gtk_frontend = services->get ("gtk-frontend");
label = gtk_label_new (_("Call history"));
gtk_notebook_append_page (GTK_NOTEBOOK (mw->priv->main_notebook),
@@ -3771,7 +3785,8 @@
display_info.widget_info_set = TRUE;
- Ekiga::VideoOutputCore *videooutput_core = dynamic_cast<Ekiga::VideoOutputCore *> (mw->priv->core->get ("videooutput-core"));
+ gmref_ptr<Ekiga::VideoOutputCore> videooutput_core
+ = mw->priv->core->get ("videooutput-core");
videooutput_core->set_display_info (display_info);
return handled;
@@ -3884,7 +3899,8 @@
g_return_if_fail (EKIGA_IS_MAIN_WINDOW (mw));
/* New Display Engine signals */
- Ekiga::VideoOutputCore *videooutput_core = dynamic_cast<Ekiga::VideoOutputCore *> (mw->priv->core->get ("videooutput-core"));
+ gmref_ptr<Ekiga::VideoOutputCore> videooutput_core
+ = mw->priv->core->get ("videooutput-core");
conn = videooutput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_opened_cb), (gpointer) mw));
mw->priv->connections.push_back (conn);
@@ -3902,7 +3918,8 @@
mw->priv->connections.push_back (conn);
/* New VideoInput Engine signals */
- Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (mw->priv->core->get ("videoinput-core"));
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = mw->priv->core->get ("videoinput-core");
conn = videoinput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_opened_cb), (gpointer) mw));
mw->priv->connections.push_back (conn);
@@ -3920,7 +3937,8 @@
mw->priv->connections.push_back (conn);
/* New AudioInput Engine signals */
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->priv->core->get ("audioinput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = mw->priv->core->get ("audioinput-core");
conn = audioinput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_opened_cb), (gpointer) mw));
mw->priv->connections.push_back (conn);
@@ -3938,7 +3956,8 @@
mw->priv->connections.push_back (conn);
/* New AudioOutput Engine signals */
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->priv->core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = mw->priv->core->get ("audiooutput-core");
conn = audiooutput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_opened_cb), (gpointer) mw));
mw->priv->connections.push_back (conn);
@@ -3956,8 +3975,9 @@
mw->priv->connections.push_back (conn);
/* New Call Engine signals */
- Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->priv->core->get ("call-core"));
- Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (mw->priv->core->get ("account-core"));
+ gmref_ptr<Ekiga::CallCore> call_core = mw->priv->core->get ("call-core");
+ gmref_ptr<Ekiga::AccountCore> account_core
+ = mw->priv->core->get ("account-core");
/* Engine Signals callbacks */
conn = account_core->registration_event.connect (sigc::bind (sigc::ptr_fun (on_registration_event), (gpointer) mw));
@@ -4024,12 +4044,11 @@
GtkStatusIcon *status_icon = NULL;
- GtkFrontend *gtk_frontend = NULL;
GtkWidget *chat_window = NULL;
/* initialize the callback to play IM message sound */
/* FIXME: move this to the chat window code */
- gtk_frontend = dynamic_cast<GtkFrontend *>(core.get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> gtk_frontend = core.get ("gtk-frontend");
chat_window = GTK_WIDGET (gtk_frontend->get_chat_window ());
g_signal_connect (chat_window, "unread-alert",
@@ -4424,7 +4443,7 @@
*/
main_window = GnomeMeeting::Process ()->GetMainWindow ();
EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (main_window); //TODO no priv here
- Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->priv->core->get ("call-core"));
+ gmref_ptr<Ekiga::CallCore> call_core = mw->priv->core->get ("call-core");
if (error == -1) {
if (gm_conf_get_int (GENERAL_KEY "version")
Modified: trunk/src/gui/preferences.cpp
==============================================================================
--- trunk/src/gui/preferences.cpp (original)
+++ trunk/src/gui/preferences.cpp Wed Oct 15 12:53:55 2008
@@ -717,7 +717,8 @@
gm_prefs_window_get_videoinput_devices_list (Ekiga::ServiceCore *core,
std::vector<std::string> & device_list)
{
- Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (core->get ("videoinput-core"));
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core->get ("videoinput-core");
std::vector <Ekiga::VideoInputDevice> devices;
device_list.clear();
@@ -739,7 +740,8 @@
gm_prefs_window_get_audiooutput_devices_list (Ekiga::ServiceCore *core,
std::vector<std::string> & device_list)
{
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
std::vector <Ekiga::AudioOutputDevice> devices;
std::string device_string;
@@ -764,7 +766,8 @@
gm_prefs_window_get_audioinput_devices_list (Ekiga::ServiceCore *core,
std::vector<std::string> & device_list)
{
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (core->get ("audioinput-core"));
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core->get ("audioinput-core");
std::vector <Ekiga::AudioInputDevice> devices;
device_list.clear();
@@ -1132,7 +1135,8 @@
//FIXME
Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore ();
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
gchar* file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data));
if (file_name) {
@@ -1217,7 +1221,8 @@
//FIXME
Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore ();
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
gchar* file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data));
std::string file_name_string = file_name;
@@ -1490,9 +1495,12 @@
G_CALLBACK (delete_window_cb), NULL);
sigc::connection conn;
- Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (core->get ("videoinput-core"));
- Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (core->get ("audioinput-core"));
- Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+ gmref_ptr<Ekiga::VideoInputCore> videoinput_core
+ = core->get ("videoinput-core");
+ gmref_ptr<Ekiga::AudioInputCore> audioinput_core
+ = core->get ("audioinput-core");
+ gmref_ptr<Ekiga::AudioOutputCore> audiooutput_core
+ = core->get ("audiooutput-core");
conn = videoinput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_added_cb), window));
pw->connections.push_back (conn);
Modified: trunk/src/gui/statusicon.cpp
==============================================================================
--- trunk/src/gui/statusicon.cpp (original)
+++ trunk/src/gui/statusicon.cpp Wed Oct 15 12:53:55 2008
@@ -276,7 +276,7 @@
}
else {
- GtkFrontend *frontend = dynamic_cast<GtkFrontend*>(self->priv->core.get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> frontend = self->priv->core.get ("gtk-frontend");
GtkWidget *w = GTK_WIDGET (frontend->get_chat_window ());
gtk_widget_show (w);
@@ -323,13 +323,12 @@
{
StatusIcon *statusicon = STATUSICON (data);
- GtkFrontend *frontend = NULL;
GtkWidget *chat_window = NULL;
GdkPixbuf *pixbuf = NULL;
g_return_val_if_fail (data != NULL, false);
- frontend = dynamic_cast<GtkFrontend*>(STATUSICON (data)->priv->core.get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> frontend = statusicon->priv->core.get ("gtk-frontend");
// FIXME use main_window here
chat_window = GTK_WIDGET (frontend->get_chat_window ());
@@ -349,7 +348,7 @@
static void
personal_details_updated_cb (StatusIcon* self,
- Ekiga::PersonalDetails* details)
+ gmref_ptr<Ekiga::PersonalDetails> details)
{
statusicon_set_status (self, details->get_short_status ());
}
@@ -383,10 +382,9 @@
GtkWidget *main_window = NULL;
Ekiga::ServiceCore *services = NULL;
- GtkFrontend *gtk_frontend = NULL;
services = GnomeMeeting::Process ()->GetServiceCore ();
- gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> gtk_frontend = services->get ("gtk-frontend");
main_window = GnomeMeeting::Process ()->GetMainWindow ();
static MenuEntry menu [] =
@@ -452,13 +450,12 @@
statusicon_set_status (StatusIcon *statusicon,
const std::string & short_status)
{
- GtkFrontend *frontend = NULL;
GtkWidget *chat_window = NULL;
GdkPixbuf *pixbuf = NULL;
g_return_if_fail (statusicon != NULL);
- frontend = dynamic_cast<GtkFrontend*>(statusicon->priv->core.get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> frontend = statusicon->priv->core.get ("gtk-frontend");
// FIXME use main_window here
chat_window = GTK_WIDGET (frontend->get_chat_window ());
@@ -485,13 +482,12 @@
statusicon_set_inacall (StatusIcon *statusicon,
bool inacall)
{
- GtkFrontend *frontend = NULL;
GtkWidget *chat_window = NULL;
GdkPixbuf *pixbuf = NULL;
g_return_if_fail (statusicon != NULL);
- frontend = dynamic_cast<GtkFrontend*>(statusicon->priv->core.get ("gtk-frontend"));
+ gmref_ptr<GtkFrontend> frontend = statusicon->priv->core.get ("gtk-frontend");
// FIXME use main_window here
chat_window = GTK_WIDGET (frontend->get_chat_window ());
@@ -533,9 +529,9 @@
self->priv->blink_image = NULL;
self->priv->unread_messages = false;
- GtkFrontend *frontend = dynamic_cast<GtkFrontend*>(core.get ("gtk-frontend"));
- Ekiga::PersonalDetails *details = dynamic_cast<Ekiga::PersonalDetails*> (core.get ("personal-details"));
- Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore*> (core.get ("call-core"));
+ gmref_ptr<GtkFrontend> frontend = core.get ("gtk-frontend");
+ gmref_ptr<Ekiga::PersonalDetails> details = core.get ("personal-details");
+ gmref_ptr<Ekiga::CallCore> call_core = core.get ("call-core");
GtkWidget *chat_window = GTK_WIDGET (frontend->get_chat_window ());
statusicon_set_status (self, details->get_short_status ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]