[Galago-commits] r2560 - in branches/libgalago/protocol-cleanup: .
libgalago
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Mon Feb 6 00:19:24 PST 2006
Author: chipx86
Date: 2006-02-06 00:19:17 -0800 (Mon, 06 Feb 2006)
New Revision: 2560
Modified:
branches/libgalago/protocol-cleanup/ChangeLog
branches/libgalago/protocol-cleanup/libgalago/galago-core.c
branches/libgalago/protocol-cleanup/libgalago/galago-person.c
Log:
Set the object path on the GalagoPerson based on the result from the daemon when a feed adds an object.
Modified: branches/libgalago/protocol-cleanup/ChangeLog
===================================================================
--- branches/libgalago/protocol-cleanup/ChangeLog 2006-02-06 08:15:20 UTC (rev 2559)
+++ branches/libgalago/protocol-cleanup/ChangeLog 2006-02-06 08:19:17 UTC (rev 2560)
@@ -1,3 +1,10 @@
+Mon Feb 06 00:18:31 PST 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libgalago/galago-core.c:
+ * libgalago/galago-person.c:
+ - Set the object path on the GalagoPerson based on the result from
+ the daemon when a feed adds an object.
+
Fri Feb 03 02:25:55 PST 2006 Christian Hammond <chipx86 at chipx86.com>
* libgalago/galago-account.c:
Modified: branches/libgalago/protocol-cleanup/libgalago/galago-core.c
===================================================================
--- branches/libgalago/protocol-cleanup/libgalago/galago-core.c 2006-02-06 08:15:20 UTC (rev 2559)
+++ branches/libgalago/protocol-cleanup/libgalago/galago-core.c 2006-02-06 08:19:17 UTC (rev 2560)
@@ -1309,6 +1309,8 @@
return;
}
+ g_assert(galago_object_get_dbus_path(GALAGO_OBJECT(service)) == NULL);
+
dbus_conn = galago_get_dbus_conn();
message = dbus_message_new_method_call(GALAGO_DBUS_SERVICE,
@@ -1389,6 +1391,8 @@
return;
}
+ g_assert(galago_object_get_dbus_path(GALAGO_OBJECT(person)) == NULL);
+
dbus_conn = galago_get_dbus_conn();
message = dbus_message_new_method_call(GALAGO_DBUS_SERVICE,
Modified: branches/libgalago/protocol-cleanup/libgalago/galago-person.c
===================================================================
--- branches/libgalago/protocol-cleanup/libgalago/galago-person.c 2006-02-06 08:15:20 UTC (rev 2559)
+++ branches/libgalago/protocol-cleanup/libgalago/galago-person.c 2006-02-06 08:19:17 UTC (rev 2560)
@@ -61,9 +61,8 @@
/* galago-core.c */
GalagoAccount *_galago_core_calc_priority_account(const GalagoPerson *person);
-static GalagoPerson *_galago_create_person_common(const char *id,
- GalagoOrigin origin,
- const char *obj_path);
+static GalagoPerson *_galago_person_new(const char *id, GalagoOrigin origin,
+ const char *obj_path);
static void _galago_dbus_person_set_photo(GalagoPerson *person,
GalagoImage *photo);
@@ -233,7 +232,7 @@
id = galago_person_get_id(person);
is_me = galago_person_is_me(person);
- dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &obj_path);
+ galago_dbus_message_iter_append_string_or_nil(iter, obj_path);
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &id);
dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &is_me);
}
@@ -245,7 +244,7 @@
const char *obj_path, *uid;
gboolean me;
- dbus_message_iter_get_basic(iter, &obj_path);
+ obj_path = galago_dbus_message_iter_get_string_or_nil(iter);
dbus_message_iter_next(iter);
dbus_message_iter_get_basic(iter, &uid);
@@ -256,7 +255,7 @@
if (me)
uid = GALAGO_ME_ID;
- person = _galago_create_person_common(uid, GALAGO_REMOTE, obj_path);
+ person = _galago_person_new(uid, GALAGO_REMOTE, obj_path);
return person;
}
@@ -331,8 +330,7 @@
* GalagoPerson API
**************************************************************************/
static GalagoPerson *
-_galago_create_person_common(const char *uid, GalagoOrigin origin,
- const char *obj_path)
+_galago_person_new(const char *uid, GalagoOrigin origin, const char *obj_path)
{
GalagoPerson *person;
@@ -343,35 +341,15 @@
if (person == NULL)
{
- const char *obj_prefix;
-
person = g_object_new(GALAGO_TYPE_PERSON,
"id", uid,
"origin", origin,
NULL);
- if (obj_path != NULL)
- {
+ /* Set the object path, if specified. */
+ if (origin == GALAGO_REMOTE)
galago_object_set_dbus_path(GALAGO_OBJECT(person), obj_path);
- }
- else if ((obj_prefix = galago_context_get_obj_path_prefix()) != NULL)
- {
- char *new_obj_path;
- const char *escaped_id;
- if (!strcmp(uid, GALAGO_ME_ID))
- escaped_id = GALAGO_ME_ID;
- else
- escaped_id = galago_dbus_normalize_name(uid);
-
- new_obj_path = g_strdup_printf("%s/people/%s",
- obj_prefix, escaped_id);
-
- galago_object_set_dbus_path(GALAGO_OBJECT(person), new_obj_path);
-
- g_free(new_obj_path);
- }
-
galago_context_add_person(person);
}
@@ -384,7 +362,7 @@
g_return_val_if_fail(galago_is_initted(), NULL);
g_return_val_if_fail(uid != NULL && *uid != '\0', NULL);
- return _galago_create_person_common(uid, GALAGO_LOCAL, NULL);
+ return _galago_person_new(uid, GALAGO_LOCAL, NULL);
}
void
More information about the galago-commits
mailing list