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



commit 5ba6e5eec20cc4854749d2cd0a46a8bf7604d5b1
Author: Damien Sandras <dsandras beip be>
Date:   Sun Nov 17 17:37:18 2013 +0100

    Call History: Ported to GSettings.

 .../components/call-history/history-book.cpp       |   15 +++++++--------
 lib/engine/components/call-history/history-book.h  |    3 +++
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/lib/engine/components/call-history/history-book.cpp 
b/lib/engine/components/call-history/history-book.cpp
index b2bc417..dedbbcd 100644
--- a/lib/engine/components/call-history/history-book.cpp
+++ b/lib/engine/components/call-history/history-book.cpp
@@ -37,18 +37,17 @@
 
 #include <glib/gi18n.h>
 
-#include "gmconf.h"
+#define CALL_HISTORY_KEY "call-history"
 
 History::Book::Book (Ekiga::ServiceCore& core):
   contact_core(core.get<Ekiga::ContactCore>("contact-core")), doc()
 {
   xmlNodePtr root = NULL;
 
-  gchar *c_raw = gm_conf_get_string (CALL_HISTORY_KEY);
+  contacts_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (CONTACTS_SCHEMA));
+  std::string raw = contacts_settings->get_string (CALL_HISTORY_KEY);
 
-  if (c_raw != NULL) {
-
-    const std::string raw = c_raw;
+  if (!raw.empty ()) {
 
     doc = boost::shared_ptr<xmlDoc> (xmlRecoverMemory (raw.c_str (), raw.length ()), xmlFreeDoc);
     if ( !doc)
@@ -69,8 +68,8 @@ History::Book::Book (Ekiga::ServiceCore& core):
          && xmlStrEqual (BAD_CAST ("entry"), 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);
@@ -166,7 +165,7 @@ History::Book::save () const
 
   xmlDocDumpMemory (doc.get (), &buffer, &size);
 
-  gm_conf_set_string (CALL_HISTORY_KEY, (const char *)buffer);
+  contacts_settings->set_string (CALL_HISTORY_KEY, (const char *)buffer);
 
   xmlFree (buffer);
 }
diff --git a/lib/engine/components/call-history/history-book.h 
b/lib/engine/components/call-history/history-book.h
index c561ffb..fce8c3f 100644
--- a/lib/engine/components/call-history/history-book.h
+++ b/lib/engine/components/call-history/history-book.h
@@ -42,6 +42,8 @@
 #include "book-impl.h"
 #include "history-contact.h"
 
+#include "ekiga-settings.h"
+
 namespace History
 {
 
@@ -110,6 +112,7 @@ namespace History
     boost::weak_ptr<Ekiga::ContactCore> contact_core;
     boost::shared_ptr<xmlDoc> doc;
     std::list<ContactPtr> ordered_contacts;
+    boost::shared_ptr<Ekiga::Settings> contacts_settings;
   };
 
   typedef boost::shared_ptr<Book> BookPtr;


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