cpw.gillux.detachablepurple: 612b7907: Make pack_pobject_properties() and pack_...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Sun May 20 13:21:24 EDT 2012
----------------------------------------------------------------------
Revision: 612b79074de959b70a2e215ddc856dc10a79640f
Parent: 008d9c52b4bcfa1e365df664f0703c696583cf82
Author: gillux at soc.pidgin.im
Date: 05/20/12 11:16:29
Branch: im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/612b79074de959b70a2e215ddc856dc10a79640f
Changelog:
Make pack_pobject_properties() and pack_pobject() public,
so that others may easily send PurpleObjects on D-Bus.
Changes against parent 008d9c52b4bcfa1e365df664f0703c696583cf82
patched libpurple/dbus/constructor.c
patched libpurple/dbus/constructor.h
-------------- next part --------------
============================================================
--- libpurple/dbus/constructor.c a1c0043380a4b7fe8a644f32d6def539ed2d09c9
+++ libpurple/dbus/constructor.c 683a2e01e722c9209f18b7cf136ebe17ea17a223
@@ -192,8 +192,8 @@ purple_constructor_new_proxy_object(cons
}
/* Packs all the exported properties of a PurpleObject into an a(sv) GVariant. */
-static GVariant*
-pack_pobject_properties(PurpleObject *pobject)
+GVariant *
+purple_constructor_pack_pobject_props(PurpleObject *pobject)
{
GVariantBuilder builder;
GParamSpec *pspec;
@@ -242,13 +242,13 @@ pack_pobject_properties(PurpleObject *po
return g_variant_builder_end(&builder);
}
-static GVariant*
-pack_pobject(gpointer obj)
+GVariant *
+purple_constructor_pack_pobject(gpointer obj)
{
PurpleObject *pobj = PURPLE_OBJECT(obj);
return g_variant_new("(o at a(sv))",
purple_object_get_dbus_path(pobj),
- pack_pobject_properties(pobj));
+ purple_constructor_pack_pobject_props(pobj));
}
static gpointer
@@ -307,7 +307,8 @@ purple_constructor_get_all_accounts(void
g_variant_builder_init(&builder, (const GVariantType *) "a(oa(sv))");
while (all) {
PurpleAccount *account = all->data;
- g_variant_builder_add_value(&builder, pack_pobject(account));
+ g_variant_builder_add_value
+ (&builder, purple_constructor_pack_pobject(account));
all = all->next;
}
return g_variant_new("(@a(oa(sv)))", g_variant_builder_end(&builder));
@@ -343,7 +344,7 @@ purple_constructor_announce_pobject_crea
params = g_variant_new("(so at a(sv))",
G_OBJECT_TYPE_NAME(pobj),
purple_object_get_dbus_path(pobj),
- pack_pobject_properties(pobj));
+ purple_constructor_pack_pobject_props(pobj));
purple_object_emit_dbus_signal(PURPLE_OBJECT(con),
purple_constructor_interface_info.name,
"PurpleObjectCreated", params, NULL);
@@ -379,7 +380,7 @@ purple_constructor_new_account(PurpleCon
{
PurpleAccount *account;
account = purple_account_new(username, protocol_id);
- return pack_pobject(account);
+ return purple_constructor_pack_pobject(account);
}
PurpleAccount *
============================================================
--- libpurple/dbus/constructor.h e76cd179321714bfebd81ba8f477b18e723717fe
+++ libpurple/dbus/constructor.h 091181571026c112907fba635c79837a8d65e66f
@@ -67,6 +67,26 @@ void purple_constructor_announce_pobject
void purple_constructor_announce_pobject_creation(PurpleObject *pobj);
/**
+ * Packs all the exported properties of all the D-Bus interfaces added with
+ * purple_object_class_register_dbus_iface() of the PurpleObject into an
+ * "a(sv)" GVariant ("s" is the property name, "v" is the property value).
+ *
+ * @param pobject A PurpleObject.
+ * @return An "a(sv)" GVariant containing the properties.
+ */
+GVariant *purple_constructor_pack_pobject_props(PurpleObject *pobject);
+
+/**
+ * Packs a PurpleObject instance into an "(oa(sv))" GVariant. "o" is the
+ * D-Bus path of of the object, and "a(sv)" is its properties packed with
+ * purple_constructor_pack_pobject_props().
+ *
+ * @param pobject A PurpleObject instance.
+ * @return An "(oa(sv))" GVariant defining the object.
+ */
+GVariant *purple_constructor_pack_pobject(gpointer pobject);
+
+/**
* What's get actually called when you call NewAccount over dbus.
*/
gboolean DBUS_purple_constructor_new_account(PurpleConstructor *con, gchar* username, gchar* protocol_id, gchar **account_path, GError** error);
More information about the Commits
mailing list