ekiga r7562 - in trunk/lib/engine: . components/avahi components/avahi-publisher
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7562 - in trunk/lib/engine: . components/avahi components/avahi-publisher
- Date: Fri, 16 Jan 2009 13:48:53 +0000 (UTC)
Author: jpuydt
Date: Fri Jan 16 13:48:53 2009
New Revision: 7562
URL: http://svn.gnome.org/viewvc/ekiga?rev=7562&view=rev
Log:
Made the avahi code use the kickstart system
Modified:
trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.cpp
trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.h
trunk/lib/engine/components/avahi/avahi-main.cpp
trunk/lib/engine/components/avahi/avahi-main.h
trunk/lib/engine/engine.cpp
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 Fri Jan 16 13:48:53 2009
@@ -38,26 +38,43 @@
#include "avahi-publisher-main.h"
#include "avahi-publisher.h"
-#include <iostream>
-
-bool
-avahi_publisher_init (Ekiga::ServiceCore &core,
- int* /*argc*/,
- char* */*argv*/[])
+struct AVAHIPUBSpark: public Ekiga::Spark
{
- bool result = false;
- 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");
-
- if (presence_core && call_core && details) {
-
- gmref_ptr<Avahi::PresencePublisher> publisher (new Avahi::PresencePublisher (core, *details, *call_core));
- presence_core->add_presence_publisher (publisher);
- core.add (publisher);
- result = true;
+ AVAHIPUBSpark (): result(false)
+ {}
+
+ bool try_initialize_more (Ekiga::ServiceCore& core,
+ int* /*argc*/,
+ char** /*argv*/[])
+ {
+ gmref_ptr<Ekiga::Service> service = core.get ("avahi-presence-publisher");
+ 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");
+
+ if (presence_core && call_core && details && !service) {
+
+ gmref_ptr<Avahi::PresencePublisher> publisher (new Avahi::PresencePublisher (core, *details, *call_core));
+ presence_core->add_presence_publisher (publisher);
+ core.add (publisher);
+ result = true;
+ }
+
+ return result;
}
- return result;
+ Ekiga::Spark::state get_state () const
+ { return result?FULL:BLANK; }
+
+ const std::string get_name () const
+ { return "AVAHIPUB"; }
+
+ bool result;
+};
+
+void
+avahi_publisher_init (Ekiga::KickStart& kickstart)
+{
+ gmref_ptr<Ekiga::Spark> spark(new AVAHIPUBSpark);
+ kickstart.add_spark (spark);
}
Modified: trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.h
==============================================================================
--- trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.h (original)
+++ trunk/lib/engine/components/avahi-publisher/avahi-publisher-main.h Fri Jan 16 13:48:53 2009
@@ -38,16 +38,14 @@
#ifndef __AVAHI_PUBLISHER_MAIN_H__
#define __AVAHI_PUBLISHER_MAIN_H__
-#include "services.h"
+#include "kickstart.h"
/**
* @addtogroup presence
* @{
*/
-bool avahi_publisher_init (Ekiga::ServiceCore &services,
- int *argc,
- char **argv[]);
+void avahi_publisher_init (Ekiga::KickStart& kickstart);
/**
* @}
Modified: trunk/lib/engine/components/avahi/avahi-main.cpp
==============================================================================
--- trunk/lib/engine/components/avahi/avahi-main.cpp (original)
+++ trunk/lib/engine/components/avahi/avahi-main.cpp Fri Jan 16 13:48:53 2009
@@ -39,21 +39,41 @@
#include "presence-core.h"
#include "avahi-cluster.h"
-bool
-avahi_init (Ekiga::ServiceCore &core,
- int */*argc*/,
- char **/*argv*/[])
+struct AVAHISpark: public Ekiga::Spark
{
- bool result = false;
- gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
+ AVAHISpark (): result(false)
+ {}
- if (presence_core) {
+ bool try_initialize_more (Ekiga::ServiceCore& core,
+ int* /*argc*/,
+ char** /*argv*/[])
+ {
+ gmref_ptr<Ekiga::Service> service = core.get ("avahi-core");
+ gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
- gmref_ptr<Avahi::Cluster> cluster (new Avahi::Cluster (core));
- core.add (cluster);
- presence_core->add_cluster (cluster);
- result = true;
+ if ( !service && presence_core) {
+
+ gmref_ptr<Avahi::Cluster> cluster (new Avahi::Cluster (core));
+ core.add (cluster);
+ presence_core->add_cluster (cluster);
+ result = true;
+ }
+
+ return result;
}
- return result;
+ Ekiga::Spark::state get_state () const
+ { return result?FULL:BLANK; }
+
+ const std::string get_name () const
+ { return "AVAHI"; }
+
+ bool result;
+};
+
+void
+avahi_init (Ekiga::KickStart& kickstart)
+{
+ gmref_ptr<Ekiga::Spark> spark(new AVAHISpark);
+ kickstart.add_spark (spark);
}
Modified: trunk/lib/engine/components/avahi/avahi-main.h
==============================================================================
--- trunk/lib/engine/components/avahi/avahi-main.h (original)
+++ trunk/lib/engine/components/avahi/avahi-main.h Fri Jan 16 13:48:53 2009
@@ -38,16 +38,14 @@
#ifndef __AVAHI_MAIN_H__
#define __AVAHI_MAIN_H__
-#include "services.h"
+#include "kickstart.h"
/**
* @addtogroup presence
* @{
*/
-bool avahi_init (Ekiga::ServiceCore &core,
- int *argc,
- char **argv[]);
+void avahi_init (Ekiga::KickStart& kickstart);
/**
* @}
Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp (original)
+++ trunk/lib/engine/engine.cpp Fri Jan 16 13:48:53 2009
@@ -223,15 +223,8 @@
}
#ifdef HAVE_AVAHI
- if (!avahi_init (*service_core, &argc, &argv)) {
- delete service_core;
- return;
- }
-
- if (!avahi_publisher_init (*service_core, &argc, &argv)) {
- delete service_core;
- return;
- }
+ avahi_init (kickstart);
+ avahi_publisher_init (kickstart);
#endif
#ifdef HAVE_EDS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]