ekiga r7228 - in trunk/lib/engine: addressbook/kab components/kde components/resource-list components/xcap framework



Author: jpuydt
Date: Wed Oct 15 14:41:46 2008
New Revision: 7228
URL: http://svn.gnome.org/viewvc/ekiga?rev=7228&view=rev

Log:
Mode gmref_ptr for the services fixes : I forgot some optional directories!

Modified:
   trunk/lib/engine/addressbook/kab/Makefile.am
   trunk/lib/engine/addressbook/kab/kab-main.cpp
   trunk/lib/engine/addressbook/kab/kab-source.h
   trunk/lib/engine/components/kde/Makefile.am
   trunk/lib/engine/components/kde/kde-main.cpp
   trunk/lib/engine/components/resource-list/resource-list-main.cpp
   trunk/lib/engine/components/resource-list/rl-cluster.cpp
   trunk/lib/engine/components/resource-list/rl-entry-ref.cpp
   trunk/lib/engine/components/resource-list/rl-entry.cpp
   trunk/lib/engine/components/resource-list/rl-heap.cpp
   trunk/lib/engine/components/xcap/xcap-main.cpp
   trunk/lib/engine/framework/services.cpp

Modified: trunk/lib/engine/addressbook/kab/Makefile.am
==============================================================================
--- trunk/lib/engine/addressbook/kab/Makefile.am	(original)
+++ trunk/lib/engine/addressbook/kab/Makefile.am	Wed Oct 15 14:41:46 2008
@@ -9,6 +9,7 @@
 AM_CPPFLAGS = $(SIGC_CFLAGS) $(KAB_CFLAGS)
 
 INCLUDES = \
+	-I$(top_srcdir)/lib/gmref \
 	-I$(top_srcdir)/lib/engine/framework \
 	-I$(top_srcdir)/lib/engine/addressbook/skel
 

Modified: trunk/lib/engine/addressbook/kab/kab-main.cpp
==============================================================================
--- trunk/lib/engine/addressbook/kab/kab-main.cpp	(original)
+++ trunk/lib/engine/addressbook/kab/kab-main.cpp	Wed Oct 15 14:41:46 2008
@@ -39,50 +39,19 @@
 #include "contact-core.h"
 #include "kab-source.h"
 
-namespace KAB
-{
-  class Service: public Ekiga::Service
-  {
-  public:
-
-    Service (Source *_source): source(_source)
-    {}
-
-    ~Service ()
-    { delete source; }
-
-    const std::string get_name () const
-    { return "kab-source"; }
-
-    const std::string get_description () const
-    { return "\tComponent bringing in KDE's addressbook"; }
-
-  private:
-
-    Source *source;
-  };
-};
-
 bool
 kab_init (Ekiga::ServiceCore &core,
 	  int */*argc*/,
 	  char **/*argv*/[])
 {
   bool result = false;
-  //Ekiga::Service *kde_core = NULL;
-  Ekiga::ContactCore *contact_core = NULL;
-  KAB::Source *source = NULL;
-  KAB::Service *service = NULL;
-
-  contact_core = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
-
-  //kde_core = core.get ("kde-core"); // we only care if it's there
+  gmref_ptr<Ekiga::Service> kde_core = core.get ("kde-core");
+  gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
 
-  if (contact_core != NULL ) {//&& kde_core != NULL) {
+  if (contact_core && kde_core) {
 
-    source = new KAB::Source (*contact_core);
-    service = new KAB::Service (source);
-    core.add (*service);
+    gmref_ptr<KAB::Source> source = new KAB::Source (*contact_core);
+    core.add (source);
     contact_core->add_source (*source);
     result = true;
   }

Modified: trunk/lib/engine/addressbook/kab/kab-source.h
==============================================================================
--- trunk/lib/engine/addressbook/kab/kab-source.h	(original)
+++ trunk/lib/engine/addressbook/kab/kab-source.h	Wed Oct 15 14:41:46 2008
@@ -40,6 +40,7 @@
 
 #include "contact-core.h"
 #include "source-impl.h"
+#include "services.h"
 
 #include "kab-book.h"
 
@@ -52,7 +53,9 @@
  * @{
  */
 
-  class Source: public Ekiga::SourceImpl<Book>
+  class Source:
+    public Ekiga::Service,
+    public Ekiga::SourceImpl<Book>
   {
   public:
 
@@ -60,6 +63,12 @@
 
     ~Source ();
 
+    const std::string get_name () const
+    { return "kab-source"; }
+
+    const std::string get_description () const
+    { return "\tComponent bringing in KDE's addressbook"; }
+
     bool populate_menu (Ekiga::MenuBuilder &builder);
 
   private:

Modified: trunk/lib/engine/components/kde/Makefile.am
==============================================================================
--- trunk/lib/engine/components/kde/Makefile.am	(original)
+++ trunk/lib/engine/components/kde/Makefile.am	Wed Oct 15 14:41:46 2008
@@ -5,6 +5,7 @@
 AM_CXXFLAGS = $(SIGC_CFLAGS) $(KDE_CFLAGS)
 
 INCLUDES = \
+	-I$(top_srcdir)/lib/gmref \
 	-I$(top_srcdir)/lib/engine/framework
 
 libgmkde_la_SOURCES = \

Modified: trunk/lib/engine/components/kde/kde-main.cpp
==============================================================================
--- trunk/lib/engine/components/kde/kde-main.cpp	(original)
+++ trunk/lib/engine/components/kde/kde-main.cpp	Wed Oct 15 14:41:46 2008
@@ -54,8 +54,8 @@
 
   KCmdLineArgs::init (&about);
   new KApplication (false);
-  services.add (*new Ekiga::BasicService ("kde-core",
-					  "KDE support"));
+  services.add (new Ekiga::BasicService ("kde-core",
+					 "KDE support"));
 
   return true;
 }

Modified: trunk/lib/engine/components/resource-list/resource-list-main.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/resource-list-main.cpp	(original)
+++ trunk/lib/engine/components/resource-list/resource-list-main.cpp	Wed Oct 15 14:41:46 2008
@@ -46,21 +46,17 @@
 		    char** /*argv*/[])
 {
   bool result = false;
-  Ekiga::Service* service = NULL;
+  gmref_ptr<Ekiga::Service> service = services.get ("resource-list");
 
-  service = services.get ("resource-list");
+  if ( !service) {
 
-  if (service == NULL) {
+    gmref_ptr<Ekiga::PresenceCore> core = services.get ("presence-core");
+    gmref_ptr<XCAP::Core> xcap = services.get ("xcap-core");
 
-    Ekiga::PresenceCore* core = NULL;
-    XCAP::Core* xcap = NULL;
+    if (core && xcap) {
 
-    core = dynamic_cast<Ekiga::PresenceCore*>(services.get ("presence-core"));
-    xcap = dynamic_cast<XCAP::Core*>(services.get ("xcap-core"));
-    if (core != NULL && xcap != NULL) {
-
-      RL::Cluster* cluster = new RL::Cluster (services);
-      services.add (*cluster);
+      gmref_ptr<RL::Cluster> cluster = new RL::Cluster (services);
+      services.add (cluster);
       core->add_cluster (*cluster);
       result = true;
     }

Modified: trunk/lib/engine/components/resource-list/rl-cluster.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-cluster.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-cluster.cpp	Wed Oct 15 14:41:46 2008
@@ -51,8 +51,7 @@
 {
   gchar* c_raw = NULL;
 
-  Ekiga::PresenceCore* 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, &RL::Cluster::on_presence_received));
   presence_core->status_received.connect (sigc::mem_fun (this, &RL::Cluster::on_status_received));

Modified: trunk/lib/engine/components/resource-list/rl-entry-ref.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-entry-ref.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-entry-ref.cpp	Wed Oct 15 14:41:46 2008
@@ -130,8 +130,7 @@
 RL::EntryRef::populate_menu (Ekiga::MenuBuilder& builder)
 {
   bool populated = false;
-  Ekiga::PresenceCore* presence_core
-    = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
+  gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
   std::string uri(get_uri ());
 
   builder.add_action ("refresh", _("_Refresh"),

Modified: trunk/lib/engine/components/resource-list/rl-entry.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-entry.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-entry.cpp	Wed Oct 15 14:41:46 2008
@@ -135,8 +135,7 @@
 RL::Entry::populate_menu (Ekiga::MenuBuilder& builder)
 {
   bool populated = false;
-  Ekiga::PresenceCore* presence_core
-    = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
+  gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
   std::string uri(get_uri ());
 
   builder.add_action ("refresh", _("_Refresh"),

Modified: trunk/lib/engine/components/resource-list/rl-heap.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-heap.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-heap.cpp	Wed Oct 15 14:41:46 2008
@@ -197,8 +197,7 @@
 void
 RL::Heap::refresh ()
 {
-  XCAP::Core* xcap
-    = dynamic_cast<XCAP::Core*>(core.get ("xcap-core"));
+  gmref_ptr<XCAP::Core> xcap = core.get ("xcap-core");
   std::string root_str;
   std::string username_str;
   std::string password_str;

Modified: trunk/lib/engine/components/xcap/xcap-main.cpp
==============================================================================
--- trunk/lib/engine/components/xcap/xcap-main.cpp	(original)
+++ trunk/lib/engine/components/xcap/xcap-main.cpp	Wed Oct 15 14:41:46 2008
@@ -41,9 +41,9 @@
 bool
 xcap_init (Ekiga::ServiceCore& core)
 {
-  XCAP::Core* xcap = new XCAP::Core ();
+  gmref_ptr<XCAP::Core> xcap = new XCAP::Core ();
 
-  core.add (*xcap);
+  core.add (xcap);
 
   return true;
 }

Modified: trunk/lib/engine/framework/services.cpp
==============================================================================
--- trunk/lib/engine/framework/services.cpp	(original)
+++ trunk/lib/engine/framework/services.cpp	Wed Oct 15 14:41:46 2008
@@ -39,7 +39,11 @@
 
 Ekiga::ServiceCore::~ServiceCore ()
 {
-  services.clear(); // frees the memory, if we're the only to hold references
+  /* this frees the memory, if we're the only to hold references,
+   * and frees the last first -- so there's no problem
+   */
+  while (services.begin () != services.end ())
+    services.pop_back ();
 }
 
 bool



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