[ekiga/ds-gsettings3] LDAP: Ported to GSettings.



commit dbd6c1f1e221623e8381d4e98dde4e40134b9485
Author: Damien Sandras <dsandras beip be>
Date:   Mon Nov 11 19:16:22 2013 +0100

    LDAP: Ported to GSettings.

 plugins/ldap/Makefile.am     |    4 ++--
 plugins/ldap/ldap-source.cpp |   21 +++++++++------------
 plugins/ldap/ldap-source.h   |    4 ++++
 3 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/plugins/ldap/Makefile.am b/plugins/ldap/Makefile.am
index 5bf7daa..71b978d 100644
--- a/plugins/ldap/Makefile.am
+++ b/plugins/ldap/Makefile.am
@@ -2,8 +2,8 @@ plugin_LTLIBRARIES = libgmldap.la
 
 AM_CPPFLAGS = \
        $(LDAP_CFLAGS) $(BOOST_CPPFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS) \
-       -I$(top_srcdir)/lib/gmconf                      \
-       -I$(top_srcdir)/lib/engine/framework            \
+       -I$(top_srcdir)/lib/                    \
+       -I$(top_srcdir)/lib/engine/framework    \
        -I$(top_srcdir)/lib/engine/addressbook
 
 libgmldap_la_SOURCES = \
diff --git a/plugins/ldap/ldap-source.cpp b/plugins/ldap/ldap-source.cpp
index aa7dc84..bb58986 100644
--- a/plugins/ldap/ldap-source.cpp
+++ b/plugins/ldap/ldap-source.cpp
@@ -41,21 +41,18 @@
 
 #include "config.h"
 
-#include "gmconf.h"
-
 #include "ldap-source.h"
 
-#define LDAP_KEY CONTACTS_KEY "ldap_servers"
+#define LDAP_KEY "ldap-servers"
 
 OPENLDAP::Source::Source (Ekiga::ServiceCore &_core):
   core(_core), doc(), should_add_ekiga_net_book(false)
 {
   xmlNodePtr root;
-  gchar *c_raw = gm_conf_get_string (LDAP_KEY);
-
-  if (c_raw != NULL && g_strcmp0 (c_raw, "")) {
+  contacts_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (CONTACTS_SCHEMA));
+  std::string raw = contacts_settings->get_string (LDAP_KEY);
 
-    const std::string raw = c_raw;
+  if (!raw.empty ()) {
 
     doc = boost::shared_ptr<xmlDoc> (xmlRecoverMemory (raw.c_str (), raw.length ()), xmlFreeDoc);
     if ( !doc)
@@ -79,8 +76,8 @@ OPENLDAP::Source::Source (Ekiga::ServiceCore &_core):
          && xmlStrEqual (BAD_CAST "server", child->name))
        add (child);
 
-    g_free (c_raw);
-  } else {
+  } 
+  else {
 
     doc = boost::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc);
     root = xmlNewDocNode (doc.get (), NULL, BAD_CAST "list", NULL);
@@ -200,11 +197,11 @@ void
 OPENLDAP::Source::save ()
 {
   xmlChar *buffer = NULL;
-  int size = 0;
+  int lsize = 0;
 
-  xmlDocDumpMemory (doc.get (), &buffer, &size);
+  xmlDocDumpMemory (doc.get (), &buffer, &lsize);
 
-  gm_conf_set_string (LDAP_KEY, (const char *)buffer);
+  contacts_settings->set_string (LDAP_KEY, (const char *)buffer);
 
   xmlFree (buffer);
 }
diff --git a/plugins/ldap/ldap-source.h b/plugins/ldap/ldap-source.h
index 56d0afb..9cf7511 100644
--- a/plugins/ldap/ldap-source.h
+++ b/plugins/ldap/ldap-source.h
@@ -39,6 +39,8 @@
 #ifndef __LDAP_SOURCE_H__
 #define __LDAP_SOURCE_H__
 
+#include "ekiga-settings.h"
+
 #include "services.h"
 #include "form.h"
 #include "contact-core.h"
@@ -97,6 +99,8 @@ namespace OPENLDAP
     bool has_ekiga_net_book () const;
     gboolean should_add_ekiga_net_book;
     void migrate_from_3_0_0 ();
+
+    boost::shared_ptr<Ekiga::Settings> contacts_settings;
   };
 
 /**


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