=== modified file 'configure.in'
--- configure.in	2008-06-18 12:23:32 +0000
+++ configure.in	2008-08-04 13:30:24 +0000
@@ -13,7 +13,7 @@
 AM_DISABLE_SHARED
 AM_PROG_LIBTOOL
 
-GNOKII_REQS="gnokii >= 0.6.26 bluez >= 3.12"
+GNOKII_REQS="gnokii >= 0.6.27cvs bluez >= 3.12"
 GNOME_BLUETOOTH_REQS="gnome-bluetooth > 0.8.0"
 
 AC_PROG_CC
@@ -120,35 +120,35 @@
     set_more_warnings=no
 fi
 ])
-AC_MSG_CHECKING(for more warnings, including -Werror)
+AC_MSG_CHECKING(for more warnings, including -Wall)
 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
     AC_MSG_RESULT(yes)
-    CXXFLAGS="\
+    CFLAGS="\
     -Wall \
     -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
     -Wnested-externs -Wpointer-arith \
     -Wcast-align -Wsign-compare \
-    $CXXFLAGS"
+    $CFLAGS"
 
     for option in -Wsign-promo -Wno-sign-compare -Wmissing-noreturn; do
-        SAVE_CFLAGS="$CXXFLAGS"
-        CFLAGS="$option $CXXFLAGS"
+        SAVE_CFLAGS="$CFLAGS"
+        CFLAGS="$option $CFLAGS"
         AC_MSG_CHECKING([whether gcc understands $option])
         AC_TRY_COMPILE([], [],
             has_option=yes,
             has_option=no,)
         if test $has_option = no; then
-            CXXFLAGS="$SAVE_CXXFLAGS"
+            CFLAGS="$SAVE_CFLAGS"
         fi
         AC_MSG_RESULT($has_option)
         unset has_option
-        unset SAVE_CXXFLAGS
+        unset SAVE_CFLAGS
     done
     unset option
 else
     AC_MSG_RESULT(no)
 fi
-
+if 
 AC_CONFIG_FILES([
 Makefile
 data/Makefile

=== modified file 'cut-n-paste/e-contact-entry/e-contact-entry.c'
--- cut-n-paste/e-contact-entry/e-contact-entry.c	2008-06-16 20:28:51 +0000
+++ cut-n-paste/e-contact-entry/e-contact-entry.c	2008-08-08 19:00:51 +0000
@@ -501,7 +501,6 @@
     sources = e_source_group_peek_sources (group);
     for (m = sources; m != NULL; m = m->next) {
       ESource *source = m->data;
-      const char *p;
       ESource *s = e_source_copy (source);
       EntryLookup *lookup;
       char *uri;
@@ -518,7 +517,7 @@
 
       if ((lookup->book = e_book_new (s, &error)) == NULL) {
         /* TODO handle this better, fire the error signal I guess */
-        g_warning (error->message);
+        g_warning ("%s", error->message);
 	g_error_free (error);
 	g_free (lookup);
       } else {

=== modified file 'cut-n-paste/gconf-bridge/gconf-bridge.c'
--- cut-n-paste/gconf-bridge/gconf-bridge.c	2008-06-16 20:28:51 +0000
+++ cut-n-paste/gconf-bridge/gconf-bridge.c	2008-08-08 19:01:03 +0000
@@ -1220,7 +1220,7 @@
                 dlg = gtk_message_dialog_new (NULL, 0,
                                               GTK_MESSAGE_ERROR,
                                               GTK_BUTTONS_OK,
-                                              message);
+                                              "%s", message);
                 g_free (message);
 
                 gtk_message_dialog_format_secondary_text

=== modified file 'libgsm/glibgsmtest.c'
--- libgsm/glibgsmtest.c	2008-06-20 13:05:15 +0000
+++ libgsm/glibgsmtest.c	2008-08-08 19:02:27 +0000
@@ -95,6 +95,7 @@
 {
 	phonemgr_listener_queue_message (l, "+447736665138",
 					 "test message XXX", TRUE);
+	return TRUE;
 }
 
 static gboolean debug = FALSE;
@@ -121,7 +122,6 @@
 int
 main (int argc, char **argv)
 {
-	GOptionGroup *options;
 	GOptionContext *context;
 	GError *err = NULL;
 	PhonemgrListener *listener;
@@ -222,7 +222,7 @@
 				return 1;
 			}
 
-			uuid = phonemgr_listener_put_data (listener, type, contents);
+			uuid = phonemgr_listener_put_data (listener, type, NULL, contents);
 			if (uuid != NULL) {
 				g_print ("Added data at location '%s'\n", uuid);
 				g_free (uuid);

=== modified file 'libgsm/phonemgr-listener.c'
--- libgsm/phonemgr-listener.c	2008-06-20 13:05:15 +0000
+++ libgsm/phonemgr-listener.c	2008-08-15 14:45:27 +0000
@@ -33,8 +33,8 @@
 #include "phonemgr-utils.h"
 
 /* #define DUMMY 1 */
-#define POLL_TIMEOUT 300 * 1000
-#define TRYLOCK_TIMEOUT 50 * 1000
+#define POLL_TIMEOUT 300 * 1000 * 1000
+#define TRYLOCK_TIMEOUT 50 * 1000 *1000
 
 #define CHECK_EXIT { if (l->terminated != FALSE) { g_mutex_unlock (l->mutex); goto exit_thread; } }
 
@@ -100,6 +100,8 @@
 	guint supports_sms_notif : 1;
 	/* Whether or not the driver supports GN_OP_GetPowersource */
 	guint supports_power_source : 1;
+
+	gint last_free_location;
 };
 
 static void phonemgr_listener_class_init (PhonemgrListenerClass *klass);
@@ -348,16 +350,16 @@
 phonemgr_listener_emit_message (PhonemgrListener *l, gn_sms *message)
 {
 	time_t time;
-	char *text, *sender, *origtext;
+	gchar *text, *sender, *origtext;
 
 	text = NULL;
 
 	/* The data should be in whatever the locale's encoding is,
 	 * if it doesn't fit the default GSM alphabet (roughly ISO8859-1)
 	 * as a design decision in gnokii */
-	origtext = (char *) message->user_data[0].u.text;
+	origtext = (gchar *) message->user_data[0].u.text;
 
-	if (gn_char_def_alphabet (origtext)) {
+	if (gn_char_def_alphabet (message->user_data[0].u.text)) {
 		GError *err = NULL;
 
 		text = g_convert (origtext, -1,
@@ -519,7 +521,7 @@
 {
 	AsyncSignal *signal;
 
-	g_return_if_fail (l->connected != FALSE);
+	g_return_val_if_fail (l->connected != FALSE, FALSE);
 
 	signal = g_async_queue_try_pop (l->queue);
 	if (signal == NULL)
@@ -584,7 +586,7 @@
 	else if (message->type == GN_SMS_MT_Deliver)
 		type = MESSAGE_SIGNAL;
 	else
-		return;
+		return GN_ERR_NOTSUPPORTED;
 
 	signal = g_new0 (AsyncSignal, 1);
 	signal->type = type;
@@ -649,7 +651,6 @@
 phonemgr_listener_new_call_cb (gn_call_status call_status, gn_call_info *call_info, struct gn_statemachine *state, void *user_data)
 {
 	PhonemgrListener *l = (PhonemgrListener *) user_data;
-	PhonemgrListenerCallStatus status;
 
 	/* We should ignore things that aren't the first call, but we have no idea of what
 	 * call ID the drivers might be using */
@@ -672,7 +673,7 @@
 	else
 		cid = (info->cell_id[0] << 24) + (info->cell_id[1] << 16) + (info->cell_id[2] << 8) + info->cell_id[3];
 
-	lac = info->LAC[0] << 8 + info->LAC[1];
+	lac = (info->LAC[0] << 8) + info->LAC[1];
 
 	/* Is it the same cells? */
 	if (lac == l->lac && cid == l->cid)
@@ -846,6 +847,8 @@
 
 		l->phone_state->data.phonebook_entry = &entry;
 		error = phonemgr_listener_gnokii_func (GN_OP_ReadPhonebook, l);
+		if (error)
+			g_warning ("GN_OP_ReadPhonebook returned %d", error);
 		if (error != GN_ERR_NONE && error != GN_ERR_EMPTYLOCATION)
 			break;
 		if (entry.empty != FALSE)
@@ -1192,7 +1195,7 @@
 	if (strlen(s) < 5)
 		return FALSE;
 
-	if (memory_type != NULL) {
+	if (type != NULL) {
 		memory_type = g_strndup (s + 1, 2);
 		*type = gn_str2memory_type (memory_type);
 		g_free (memory_type);
@@ -1210,6 +1213,8 @@
 {
 	gn_error error;
 
+	g_debug ("%s: type %d, index %d", G_STRFUNC, type, index);
+
 	memset(entry, 0, sizeof(gn_phonebook_entry));
 	entry->memory_type = type;
 	entry->location = index;
@@ -1221,6 +1226,9 @@
 		return TRUE;
 	}
 
+	if (error != GN_ERR_NONE) {
+		g_debug ("%s: error %d", G_STRFUNC, error);
+	}
 	return (error == GN_ERR_NONE);
 }
 
@@ -1229,26 +1237,31 @@
 			    PhonemgrListenerDataType type,
 			    const char *dataid)
 {
+	g_debug("%s:  phone_state = %p", G_STRFUNC, l->phone_state);
 	switch (type) {
 	case PHONEMGR_LISTENER_DATA_CONTACT:
 		{
 			gn_phonebook_entry entry;
 			gn_memory_type memory_type;
 			char *retval;
-			gn_error error;
 			int index;
 
-			if (phonemgr_listener_parse_data_uuid (dataid, &memory_type, &index) == FALSE)
+			if (phonemgr_listener_parse_data_uuid (dataid, &memory_type, &index) == FALSE) {
+				g_debug ("phonemgr_listener_parse_data_uuid failed");
 				return NULL;
+			}
 
+			g_debug ("%s: phonemgr_listener_parse_data_uuid returned memory type %d", G_STRFUNC, memory_type);
 			g_mutex_lock (l->mutex);
 
 			if (phonemgr_listener_get_phonebook_entry (l, memory_type, index, &entry) == FALSE) {
+				g_debug ("phonemgr_listener_get_phonebook_entry failed");
 				g_mutex_unlock (l->mutex);
 				return NULL;
 			}
 
 			if (entry.empty != FALSE) {
+				g_debug ("entry was empty");
 				g_mutex_unlock (l->mutex);
 				return NULL;
 			}
@@ -1264,7 +1277,7 @@
 		{
 			gn_calnote_list calnote_list;
 			gn_calnote calnote;
-			char *memory_type, *retval;
+			char *retval;
 			gn_error error;
 			int index;
 
@@ -1324,12 +1337,14 @@
 			}
 
 			a = g_ptr_array_sized_new (memstat.used);
-			for (i = 1, found = 0; found <= memstat.used; i++) {
+			g_debug ("memstat.used=%d, memstat.free=%d", memstat.used, memstat.free);
+			for (i = 1, found = 0; found < memstat.used; i++) {
 				gn_phonebook_entry entry;
 				if (phonemgr_listener_get_phonebook_entry (l, memstat.memory_type, i, &entry) == FALSE) {
 					break;
 				} else if (entry.empty == FALSE) {
 					char *uuid;
+					g_debug ("Got one for %d, found = %d, memstat.used = %d", i, found+1, memstat.used);
 					uuid = g_strdup_printf ("GPM-UUID-%s-%s-%d", l->imei, "ME", entry.location);
 					g_ptr_array_add (a, uuid);
 					found++;
@@ -1347,7 +1362,7 @@
 				return (char **) g_ptr_array_free (a, FALSE);
 			}
 
-			for (i = 1, found = 0; found <= memstat.used; i++) {
+			for (i = 1, found = 0; found < memstat.used; i++) {
 				gn_phonebook_entry entry;
 				if (phonemgr_listener_get_phonebook_entry (l, memstat.memory_type, i, &entry) == FALSE) {
 					break;
@@ -1420,7 +1435,6 @@
 		{
 			gn_phonebook_entry entry;
 			gn_memory_type memory_type;
-			char *retval;
 			gn_error error;
 			int index;
 
@@ -1446,7 +1460,6 @@
 		{
 			gn_calnote_list calnote_list;
 			gn_calnote calnote;
-			char *memory_type;
 			gn_error error;
 			int index;
 
@@ -1480,8 +1493,10 @@
 char *
 phonemgr_listener_put_data (PhonemgrListener *l,
 			    PhonemgrListenerDataType type,
+			    const char *dataid,
 			    const char *data)
 {
+	g_debug("%s:  phone_state = %p", G_STRFUNC, l->phone_state);
 	switch (type) {
 	case PHONEMGR_LISTENER_DATA_CONTACT:
 		{
@@ -1489,6 +1504,9 @@
 			char *retval;
 			gn_error error;
 			guint i;
+			gn_memory_type memory_type;
+			gn_memory_status memstat;
+			int index;
 
 			g_mutex_lock (l->mutex);
 
@@ -1499,20 +1517,40 @@
 			}
 			entry.memory_type = GN_MT_ME;
 
-			/* Find an empty spot */
-			for (i = 1; ; i++) {
-				gn_phonebook_entry aux;
-
-				memcpy(&aux, &entry, sizeof(gn_phonebook_entry));
-				l->phone_state->data.phonebook_entry = &aux;
-				l->phone_state->data.phonebook_entry->location = i;
-				error = phonemgr_listener_gnokii_func (GN_OP_ReadPhonebook, l);
-				if (error != GN_ERR_NONE && error != GN_ERR_EMPTYLOCATION)
-					break;
-				if (aux.empty || error == GN_ERR_EMPTYLOCATION) {
-					entry.location = aux.location;
-					error = GN_ERR_NONE;
-					break;
+			/* If we have a uuid to replace, extract the entry*/
+
+			if (dataid &&
+			    phonemgr_listener_parse_data_uuid (dataid, &memory_type, &index)) {
+				entry.location = index;
+				if (memory_type != entry.memory_type) {
+					g_mutex_unlock (l->mutex);
+					return NULL;
+				}
+			} else {
+				/* Find an empty spot */
+
+				/*HACK HACK HACK*/
+				if (l->last_free_location == 0)
+					l->last_free_location = 1;
+
+				for (i = l->last_free_location; ; i++) {
+					gn_phonebook_entry aux;
+				
+					g_debug ("%s: Look for empty location at %d (listener %p)", G_STRFUNC, i, l);
+
+					memcpy(&aux, &entry, sizeof(gn_phonebook_entry));
+					l->phone_state->data.phonebook_entry = &aux;
+					l->phone_state->data.phonebook_entry->location = i;
+					error = phonemgr_listener_gnokii_func (GN_OP_ReadPhonebook, l);
+					if (error != GN_ERR_NONE && error != GN_ERR_EMPTYLOCATION) {
+						g_warning ("%s: failure when finding an empty location", G_STRFUNC);
+						break;
+					}
+					if (aux.empty || error == GN_ERR_EMPTYLOCATION) {
+						entry.location = aux.location;
+						error = GN_ERR_NONE;
+						break;
+					}
 				}
 			}
 
@@ -1521,14 +1559,21 @@
 				return NULL;
 			}
 
+			l->last_free_location = entry.location;
+
 			//FIXME This should sanitise the phone numbers
 			gn_phonebook_entry_sanitize(&entry);
+			g_debug("YEAAAAAAAAAH");
+			memset (&memstat, 0, sizeof (memstat));
+			memstat.memory_type = memory_type;
+			l->phone_state->data.memory_status = &memstat;
+			l->phone_state->data.phonebook_entry = &entry;
 
-			l->phone_state->data.phonebook_entry = &entry;
 			error = phonemgr_listener_gnokii_func (GN_OP_WritePhonebook, l);
 
 			if (error != GN_ERR_NONE) {
 				g_mutex_unlock (l->mutex);
+				g_warning ("%s: Error when writing phonebook entry", G_STRFUNC);
 				return NULL;
 			}
 

=== modified file 'libgsm/phonemgr-listener.h'
--- libgsm/phonemgr-listener.h	2008-06-18 12:23:32 +0000
+++ libgsm/phonemgr-listener.h	2008-07-25 16:38:43 +0000
@@ -59,7 +59,8 @@
 typedef enum {
 	PHONEMGR_LISTENER_DATA_CONTACT,
 	PHONEMGR_LISTENER_DATA_CALENDAR,
-	PHONEMGR_LISTENER_DATA_TODO
+	PHONEMGR_LISTENER_DATA_TODO,
+	PHONEMGR_LISTENER_DATA_LAST = PHONEMGR_LISTENER_DATA_TODO
 } PhonemgrListenerDataType;
 
 #define CALL_NAME_UNKNOWN "Unknown"
@@ -106,6 +107,7 @@
 					 const char *dataid);
 char * phonemgr_listener_put_data	(PhonemgrListener *l,
 					 PhonemgrListenerDataType type,
+					 const char *dataid,
 					 const char *data);
 
 gboolean phonemgr_listener_connected	(PhonemgrListener *listener);

=== modified file 'libgsm/phonemgr-utils.c'
--- libgsm/phonemgr-utils.c	2008-06-18 14:40:27 +0000
+++ libgsm/phonemgr-utils.c	2008-08-15 16:06:57 +0000
@@ -184,7 +184,7 @@
 {
 	sdp_session_t *sdp = NULL;
 	sdp_list_t *search = NULL, *attrs = NULL, *recs = NULL, *tmp;
-	uuid_t browse_uuid, service_id, obex_uuid;
+	uuid_t service_id;
 	uint32_t range = 0x0000ffff;
 	int channel = -1;
 
@@ -465,7 +465,6 @@
 {
 	const char *model;
 	char *driver;
-	gn_error err;
 
 	driver = phonemgr_utils_driver_for_device (device);
 	if (driver != NULL)
@@ -477,7 +476,6 @@
 	model = gn_lib_get_phone_model (&phone_state->state);
 
 	if (model == NULL) {
-		PhoneMgrError perr;
 		g_warning ("gn_lib_get_phone_model failed");
 		goto bail;
 	}
@@ -749,6 +747,7 @@
 	EContact *contact;
 
 	contact = e_contact_new_from_vcard (vcard);
+	g_message ("%s: name is %s", G_STRFUNC, e_contact_get_const (contact, E_CONTACT_FULL_NAME));
 	SET_ENTRY(E_CONTACT_FULL_NAME, entry->name);
 	if (entry->name == NULL)
 		return FALSE;

=== modified file 'src/main.c'
--- src/main.c	2008-05-12 19:58:01 +0000
+++ src/main.c	2008-08-15 14:57:49 +0000
@@ -25,6 +25,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
+#include <phonemgr-utils.h>
 #include "phonemgr-object.h"
 #include "app.h"
 
@@ -48,6 +49,7 @@
 	GOptionContext *context;
 	GError *error = NULL;
 
+	g_type_init();
 	g_thread_init (NULL);
 
 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -84,16 +86,17 @@
 
 	gconf_init (argc, argv, NULL);
 
-	/* Setup the D-Bus object */
-	app->object = g_object_new (phonemgr_object_get_type (), NULL);
-
 	app->client = gconf_client_get_default ();
 	gconf_client_add_dir (app->client, CONFBASE,
 			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
+
 	/* Setup the listener */
 	app->listener = phonemgr_listener_new (debug);
 
+	/* Setup the D-Bus object */
+	app->object = phonemgr_object_new (app->listener);
+
 	initialise_connection (app);
 
 	ui_init (app);

=== modified file 'src/org_gnome_phone_Manager.xml'
--- src/org_gnome_phone_Manager.xml	2008-05-30 13:54:00 +0000
+++ src/org_gnome_phone_Manager.xml	2008-07-25 16:27:52 +0000
@@ -2,6 +2,30 @@
 
 <node name="/org/gnome/phone/Manager">
   <interface name="org.gnome.phone.Manager">
+    <method name="GetDataIds">
+       <arg type="u" name="DataType" direction="in"/>
+       <arg type="as" direction="out"/>
+    </method>
+    <method name="GetData">
+       <arg type="u" name="DataType" direction="in"/>
+       <arg type="s" name="ID" direction="in"/>
+       <arg type="s" direction="out"/>
+    </method>
+    <method name="AddData">
+       <arg type="u" name="DataType" direction="in"/>
+       <arg type="s" name="Data" direction="in"/>
+       <arg type="s" name="NewID" direction="out"/>
+    </method>
+     <method name="UpdateData">
+       <arg type="u" name="DataType" direction="in"/>
+       <arg type="s" name="ID" direction="in"/>
+       <arg type="s" name="Data" direction="in"/>
+       <arg type="s" name="NewID" direction="out"/>
+    </method>
+    <method name="DeleteData">
+       <arg type="u" name="DataType" direction="in"/>
+       <arg type="s" name="ID" direction="in"/>
+    </method>
     <method name="Coldplug" />
     <signal name="BatteryStateChanged">
       <arg type="u" name="BatteryIndex" />

=== modified file 'src/phonemgr-chooser-button.c'
--- src/phonemgr-chooser-button.c	2007-09-24 11:56:41 +0000
+++ src/phonemgr-chooser-button.c	2008-08-08 19:01:43 +0000
@@ -63,7 +63,6 @@
 static void
 set_btdevname (PhonemgrChooserButton *button, const char *bdaddr)
 {
-	GtkWidget *w;
 	char *c;
 
 	if (bdaddr != NULL && bdaddr[0] != '\0') {
@@ -171,7 +170,6 @@
 phonemgr_chooser_button_class_init (PhonemgrChooserButtonClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
 	parent_class = g_type_class_peek_parent (klass);
 

=== modified file 'src/phonemgr-object.c'
--- src/phonemgr-object.c	2008-05-30 13:54:00 +0000
+++ src/phonemgr-object.c	2008-07-31 13:39:37 +0000
@@ -26,6 +26,7 @@
 #include "phonemgr-object.h"
 #include "phone-manager-interface.h"
 #include "app.h"
+#include "phonemgr-listener.h"
 
 enum {
 	NUMBER_BATTERIES_CHANGED,
@@ -42,15 +43,60 @@
 #define PHONEMGR_DBUS_INTERFACE		"org.gnome.phone.Manager"
 #define PHONEMGR_DBUS_PATH		"/org/gnome/phone/Manager"
 
+GQuark
+phonemgr_object_error_quark (void)
+{
+  static GQuark quark = 0;
+  if (!quark)
+    quark = g_quark_from_static_string ("phonemgr_object_error");
+
+  return quark;
+}
+
+/* This should really be standard. */
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+phonemgr_object_error_get_type (void)
+{
+	static GType etype = 0;
+
+	if (etype == 0)
+	{
+		static const GEnumValue values[] =
+		{
+
+			ENUM_ENTRY (PHONEMGR_OBJECT_ERROR_ID_INVALID, "IdInvalid"),
+			ENUM_ENTRY (PHONEMGR_OBJECT_ERROR_TYPE_INVALID, "TypeInvalid"),
+			ENUM_ENTRY (PHONEMGR_OBJECT_ERROR_DATA_INVALID, "DataInvalid"),
+			{ 0, 0, 0 }
+		};
+
+		etype = g_enum_register_static ("PhonemgrObjectError", values);
+	}
+
+	return etype;
+}
+
 G_DEFINE_TYPE (PhonemgrObject, phonemgr_object, G_TYPE_OBJECT)
 
 static void
+phonemgr_object_dispose (GObject *object)
+{
+	PhonemgrObject *self = PHONEMGR_OBJECT (object);
+	g_object_unref (self->listener);
+}
+
+
+static void
 phonemgr_object_class_init (PhonemgrObjectClass *klass)
 {
 	GObjectClass *object_class;
 
 	object_class = (GObjectClass*) klass;
 
+	object_class->dispose = phonemgr_object_dispose;
+
 	phonemgr_object_signals[NUMBER_BATTERIES_CHANGED] =
 		g_signal_new ("number-batteries-changed",
 			      G_OBJECT_CLASS_TYPE (klass),
@@ -85,6 +131,16 @@
 					 &dbus_glib_phonemgr_object_object_info);
 }
 
+PhonemgrObject *
+phonemgr_object_new (PhonemgrListener *listener)
+{
+	PhonemgrObject *self;
+
+	self = PHONEMGR_OBJECT(g_object_new (phonemgr_object_get_type (), NULL));
+	self->listener = g_object_ref (listener);
+	return self;
+}
+
 void
 phonemgr_object_emit_number_batteries_changed (PhonemgrObject *o, guint num_batteries)
 {
@@ -141,6 +197,171 @@
 	return TRUE;
 }
 
+
+gboolean
+phonemgr_object_get_data_ids (PhonemgrObject *o, guint unchecked_type, char *** ret, GError **error)
+{
+	char ** ids;
+	PhonemgrListenerDataType data_type;
+
+	if (unchecked_type > PHONEMGR_LISTENER_DATA_LAST) {
+		goto error;
+	}
+	data_type = (PhonemgrListenerDataType) unchecked_type;
+	g_debug("listing all data");
+	ids = phonemgr_listener_list_all_data (o->listener, data_type);
+	g_debug("finished listing all data");
+	ids = phonemgr_listener_list_all_data (o->listener, data_type);
+	if (!ids) {
+		goto error;
+	}
+
+	*ret = ids;
+	return TRUE;
+
+error:
+	g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_TYPE_INVALID,
+		     "%d is an invalid data type",
+		     data_type);
+	return FALSE;
+
+}
+
+
+gboolean
+phonemgr_object_get_data (PhonemgrObject *o, guint unchecked_type, const char *dataid, char **ret, GError **error)
+{
+	PhonemgrListenerDataType data_type;
+	char *data;
+
+	if (unchecked_type > PHONEMGR_LISTENER_DATA_LAST) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_TYPE_INVALID,
+		     "%d is an invalid data type",
+		     data_type);
+		return FALSE;
+	}
+	data_type = (PhonemgrListenerDataType) unchecked_type;
+
+	g_debug("getting data %s", dataid);
+	data = phonemgr_listener_get_data (o->listener, data_type, dataid);
+	g_debug("finished getting data %s", dataid);
+
+	if (!data) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_ID_INVALID,
+		     "%s is an invalid id",
+		     dataid);
+		return FALSE;
+	}
+
+	*ret = data;
+	return TRUE;
+}
+
+gboolean
+phonemgr_object_update_data (PhonemgrObject *o, guint unchecked_type, const char *dataid, const char *data, char **ret, GError **error)
+{
+	PhonemgrListenerDataType data_type;
+	char *newdataid;
+
+	if (unchecked_type > PHONEMGR_LISTENER_DATA_LAST) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_TYPE_INVALID,
+		     "%d is an invalid data type",
+		     data_type);
+		return FALSE;
+	}
+	data_type = (PhonemgrListenerDataType) unchecked_type;
+
+	g_debug("updating data %s with %s", dataid, data);
+	newdataid = phonemgr_listener_put_data (o->listener, data_type, dataid, data);
+	g_debug("finsihed updating data %s", dataid);
+
+	/*TODO fix up phonemgr_listener_put_data to have better error returning.. */
+
+	if (!newdataid) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_DATA_INVALID,
+		     "%s",
+		     "Invalid data");
+		return FALSE;
+	}
+
+	*ret = newdataid;
+	return TRUE;
+}
+
+gboolean
+phonemgr_object_add_data (PhonemgrObject *o, guint unchecked_type, const char *data, char **ret, GError **error)
+{
+	PhonemgrListenerDataType data_type;
+	char *dataid;
+
+	if (unchecked_type > PHONEMGR_LISTENER_DATA_LAST) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_TYPE_INVALID,
+		     "%d is an invalid data type",
+		     data_type);
+		return FALSE;
+	}
+	data_type = (PhonemgrListenerDataType) unchecked_type;
+
+	g_debug("adding data %s", data);
+	dataid = phonemgr_listener_put_data (o->listener, data_type, NULL, data);
+	g_debug("finished adding data ");
+
+	/*TODO fix up phonemgr_listener_put_data to have better error returning.. */
+
+	if (!dataid) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_DATA_INVALID,
+		     "%s",
+		     "Invalid data");
+		return FALSE;
+	}
+
+	*ret = dataid;
+	return TRUE;
+}
+
+gboolean
+phonemgr_object_delete_data (PhonemgrObject *o, guint unchecked_type, const char *dataid, GError **error)
+{
+	PhonemgrListenerDataType data_type;
+
+	if (unchecked_type > PHONEMGR_LISTENER_DATA_LAST) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_TYPE_INVALID,
+		     "%d is an invalid data type",
+		     data_type);
+		return FALSE;
+	}
+	data_type = (PhonemgrListenerDataType) unchecked_type;
+
+	if (!phonemgr_listener_delete_data (o->listener, data_type, dataid)) {
+		g_set_error (error,
+		     PHONEMGR_OBJECT_ERROR,
+		     PHONEMGR_OBJECT_ERROR_ID_INVALID,
+		     "%s is an invalid id",
+		     dataid);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+
+
 static gboolean
 phonemgr_object_register (DBusGConnection *connection,
 		          GObject         *object)
@@ -150,6 +371,10 @@
 	guint request_name_result;
 	gboolean ret;
 
+	dbus_g_error_domain_register (PHONEMGR_OBJECT_ERROR,
+				      NULL,
+				      PHONEMGR_TYPE_OBJECT_ERROR);
+
 	bus_proxy = dbus_g_proxy_new_for_name (connection,
 					       DBUS_SERVICE_DBUS,
 					       DBUS_PATH_DBUS,

=== modified file 'src/phonemgr-object.h'
--- src/phonemgr-object.h	2008-05-30 13:54:00 +0000
+++ src/phonemgr-object.h	2008-07-26 12:41:20 +0000
@@ -24,10 +24,19 @@
 G_BEGIN_DECLS
 
 #include <glib-object.h>
+#include "phonemgr-listener.h"
 
 typedef struct _PhonemgrObject PhonemgrObject;
 typedef struct _PhonemgrObjectClass PhonemgrObjectClass;
 
+
+#define PHONEMGR_TYPE_OBJECT          (phonemgr_object_get_type())
+#define PHONEMGR_OBJECT(obj)          (G_TYPE_CHECK_INSTANCE_CAST (obj, PHONEMGR_TYPE_OBJECT, PhonemgrObject))
+#define PHONEMGR_OBJECT_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST (klass, PHONEMGR_TYPE_OBJECT, PhonemgrObjectClass))
+#define PHONEMGR_IS_OBJECT(obj)       (G_TYPE_CHECK_INSTANCE_TYPE (obj, PHONEMGR_TYPE_OBJECT))
+#define PHONEMGR_IS_OBJECT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PHONEMGR_TYPE_OBJECT))
+#define PHONEMGR_OBJECT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PHONEMGR_TYPE_OBJECT, PhonemgrObjectClass)
+
 struct _PhonemgrObjectClass {
 	GObjectClass  parent_class;
 	void (* number_batteries_changed) (PhonemgrObject *o, guint num_batteries);
@@ -53,14 +62,37 @@
 	guint on_ac : 1;
 	/* We can only have one battery */
 	guint num_batteries : 1;
+
+	PhonemgrListener *listener;
 };
 
+typedef enum
+{
+  PHONEMGR_OBJECT_ERROR_ID_INVALID,
+  PHONEMGR_OBJECT_ERROR_TYPE_INVALID,
+  PHONEMGR_OBJECT_ERROR_DATA_INVALID,
+} PhonemgrObjectError;
+
+#define PHONEMGR_OBJECT_ERROR (phonemgr_object_error_quark ())
+#define PHONEMGR_TYPE_OBJECT_ERROR (phonemgr_object_error_get_type ()) 
+
+GQuark phonemgr_object_error_quark (void);
+GType phonemgr_object_error_get_type (void);
+
+PhonemgrObject *phonemgr_object_new (PhonemgrListener *listener);
+
 void phonemgr_object_emit_number_batteries_changed (PhonemgrObject *o, guint num_batteries);
 void phonemgr_object_emit_battery_state_changed (PhonemgrObject *o, guint index, guint percentage, gboolean on_ac);
 void phonemgr_object_emit_network_registration_changed (PhonemgrObject *o, int mcc, int mnc, int lac, int cid);
 
 gboolean phonemgr_object_coldplug (PhonemgrObject *o, GError **error);
 
+gboolean phonemgr_object_get_data_ids (PhonemgrObject *o, guint datatype, char *** ret, GError **error);
+gboolean phonemgr_object_get_data (PhonemgrObject *o, guint datatype, const char *dataid, char **data, GError **error);
+gboolean phonemgr_object_update_data (PhonemgrObject *o, guint datatype, const char *dataid, const char *data, char **ret, GError **error);
+gboolean phonemgr_object_add_data (PhonemgrObject *o, guint datatype, const char *data, char **ret, GError **error);
+gboolean phonemgr_object_delete_data (PhonemgrObject *o, guint datatype, const char *dataid, GError **error);
+
 G_END_DECLS
 
 #endif /* !_PHONEMGR_OBJECT_H */

=== modified file 'src/ui.c'
--- src/ui.c	2008-03-13 15:35:25 +0000
+++ src/ui.c	2008-08-08 19:01:26 +0000
@@ -247,7 +247,7 @@
 populate_prefs (MyApp *app)
 {
 	GtkWidget *w;
-	char *c, *bdaddr;
+	char *c;
 	int ctype;
 	
 	ctype = gconf_client_get_int (app->client,

