soc.2010.detachablepurple: 43db6309: Added 2 new properties to PurpleObject, ...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Tue Jul 6 17:01:08 EDT 2010
----------------------------------------------------------------------
Revision: 43db6309f1a932adcab522e09872c1eb8c64a3a8
Parent: 684f1837e36804ab5e2b4cc97237e42b68dac246
Author: gillux at soc.pidgin.im
Date: 07/06/10 15:04:36
Branch: im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/43db6309f1a932adcab522e09872c1eb8c64a3a8
Changelog:
Added 2 new properties to PurpleObject, used in detachable sessions context,
dbus_path and dbus_proxy. When in remote mode, a client access the gobjects
remotely through a DBusGProxy. So it will create dummy gobjects that only
hold a DBusGProxy through which it can RPC. On the other end, the purpled in
normal mode have its objects published on DBus, and named with dbus path like
/im/pidgin/purple/stuff. We keep these path names in this dbus_path property.
Changes against parent 684f1837e36804ab5e2b4cc97237e42b68dac246
patched libpurple/pobject.c
patched libpurple/pobject.h
-------------- next part --------------
============================================================
--- libpurple/pobject.c b6b4d35699e20131212d0d9a336179f49e99da96
+++ libpurple/pobject.c bc4c82f8cc423d3afc91af3ad6c69e4a608466e1
@@ -24,6 +24,12 @@ struct _PurpleObjectPrivate
{
gpointer proto_data;
gpointer ui_data;
+ /* This is actually a DBusGProxy*, but we hold it as a pointer
+ * to avoid to have to include dbus just *everywhere* beceause
+ * of this definition.
+ */
+ gpointer dbus_proxy;
+ char* dbus_path;
};
enum
@@ -48,6 +54,11 @@ purple_object_dispose(GObject *obj)
g_warning("Purple-Object: object destroyed without unsetting the ui data. This may lead to memory leak.\n");
}
+ if(pobj->priv->dbus_proxy)
+ g_object_unref(pobj->priv->dbus_proxy);
+
+ g_free(pobj->priv->dbus_path);
+
/* XXX: do _notify_close_with_handle etc here */
parent_class->dispose(obj);
@@ -79,6 +90,8 @@ purple_object_init(GTypeInstance *instan
PurpleObject *pobj = PURPLE_OBJECT(instance);
pobj->priv = G_TYPE_INSTANCE_GET_PRIVATE(pobj, PURPLE_TYPE_OBJECT, PurpleObjectPrivate);
pobj->priv->proto_data = NULL;
+ pobj->priv->dbus_proxy = NULL;
+ pobj->priv->dbus_path = NULL;
}
GType purple_object_get_type(void)
@@ -131,6 +144,34 @@ gpointer purple_object_get_ui_data(Purpl
return pobj->priv->ui_data;
}
+gpointer
+purple_object_get_dbus_proxy(PurpleObject *pobj)
+{
+ g_return_val_if_fail(pobj, NULL);
+ return pobj->priv->dbus_proxy;
+}
+
+void
+purple_object_set_dbus_proxy(PurpleObject *pobj, gpointer dbus_proxy)
+{
+ g_return_if_fail(pobj);
+ pobj->priv->dbus_proxy = dbus_proxy;
+}
+
+char*
+purple_object_get_dbus_path(PurpleObject *pobj)
+{
+ g_return_val_if_fail(pobj, NULL);
+ return pobj->priv->dbus_path;
+}
+
+void
+purple_object_set_dbus_path(PurpleObject *pobj, char* path)
+{
+ g_return_if_fail(pobj);
+ pobj->priv->dbus_path = g_strdup(path);
+}
+
int purple_object_get_int(PurpleObject *pobj, const char *prop)
{
int ret;
============================================================
--- libpurple/pobject.h 18fe9cec069e515633b56a33dea53ecdc2b83f88
+++ libpurple/pobject.h 985e218574cfa7017eba19a1546a08d3535f0279
@@ -61,6 +61,49 @@ gpointer purple_object_get_ui_data(Purpl
gpointer purple_object_get_ui_data(PurpleObject *pobj);
+/**
+ * Gets the dbus proxy. This is used in detachable sessions context only.
+ * When a client is in remote mode, the gobjects it creates are dummy ones
+ * and only hold a dbus proxy, which is a kind of mirror of the remote object.
+ *
+ * We use a gpointer here but we mean a DBusDProxy. It is to avoid to include
+ * dbus everywhere pobject.h is included.
+ *
+ * @param pobj The PurpleObject we want to get the DBusDProxy from.
+ * @return The DBusDProxy.
+ */
+gpointer purple_object_get_dbus_proxy(PurpleObject *pobj);
+
+/**
+ * Sets the dbus proxy. This is used in detachable sessions context only.
+ *
+ * We use a gpointer here but we mean a DBusDProxy. It is to avoid to include
+ * dbus everywhere pobject.h is included.
+ *
+ * @param pobj The PurpleObject.
+ * @param dbus_proxy The DBusGProxy associated with pobj.
+ */
+void purple_object_set_dbus_proxy(PurpleObject *pobj, gpointer dbus_proxy);
+
+/**
+ * Gets the dbus path associated with this PurpleObject.
+ * Each gobjects that are published on DBus have a path name (something like
+ * /im/purple/pidgin/stuff). Remote applications can access this object using
+ * that name.
+ *
+ * @param pobj The PurpleObject.
+ * @return The path name of this PurpleObject on DBus.
+ */
+char* purple_object_get_dbus_path(PurpleObject *pobj);
+
+/**
+ * Sets the dbus path associated with this PurpleObject.
+ *
+ * @param pobj The PurpleObject that is belived to have that name on DBus.
+ * @param path The path name.
+ */
+void purple_object_set_dbus_path(PurpleObject *pobj, char* path);
+
int purple_object_get_int(PurpleObject *pobj, const char *prop);
G_END_DECLS
More information about the Commits
mailing list