soc.2010.detachablepurple: cc85c863: Added a new property in PurpleObject: an...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Wed Jul 7 01:41:31 EDT 2010


----------------------------------------------------------------------
Revision: cc85c8630fb11a6ef6a68a6ae653c5647af1ae1e
Parent:   bebf5d8100853c57e06617a816344285c751ac16
Author:   gillux at soc.pidgin.im
Date:     07/06/10 23:23:36
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/cc85c8630fb11a6ef6a68a6ae653c5647af1ae1e

Changelog: 

Added a new property in PurpleObject: another DBusGProxy. Because a DBusGProxy
is a proxy for one interface of a remote object, we need one proxy for the
PurpleStuff object interface (typically im.pidgin.purple.stuff) and one proxy
for the org.freedesktop.DBus.Properties interface. This interface is is
automatically created by the glib-dbus binding, and I want to use it in the
future.

Changes against parent bebf5d8100853c57e06617a816344285c751ac16

  patched  libpurple/pobject.c
  patched  libpurple/pobject.h

-------------- next part --------------
============================================================
--- libpurple/pobject.c	bc4c82f8cc423d3afc91af3ad6c69e4a608466e1
+++ libpurple/pobject.c	eba4b66a79feefc0b7747adb4f5e3f84cc227f43
@@ -26,9 +26,14 @@ struct _PurpleObjectPrivate
 	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.
+	 * of this definition. This proxy is for the related object interface,
+	 * e.g. im.pidgin.purple.account.
 	 */
-	gpointer dbus_proxy;
+	gpointer dbus_obj_proxy;
+	/* This is a DBusGProxy* too, but this time for the dbus properties
+	 * interface org.freedesktop.DBus.Properties.
+	 */
+	gpointer dbus_props_proxy;
 	char* dbus_path;
 };
 
@@ -54,9 +59,12 @@ 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);
+	if(pobj->priv->dbus_obj_proxy)
+		g_object_unref(pobj->priv->dbus_obj_proxy);
 
+	if(pobj->priv->dbus_props_proxy)
+		g_object_unref(pobj->priv->dbus_props_proxy);
+
 	g_free(pobj->priv->dbus_path);
 
 	/* XXX: do _notify_close_with_handle etc here */
@@ -90,7 +98,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_obj_proxy = NULL;
+	pobj->priv->dbus_props_proxy = NULL;
 	pobj->priv->dbus_path = NULL;
 }
 
@@ -145,19 +154,33 @@ gpointer
 }
 
 gpointer
-purple_object_get_dbus_proxy(PurpleObject *pobj)
+purple_object_get_dbus_obj_proxy(PurpleObject *pobj)
 {
 	g_return_val_if_fail(pobj, NULL);
-	return pobj->priv->dbus_proxy;
+	return pobj->priv->dbus_obj_proxy;
 }
 
 void
-purple_object_set_dbus_proxy(PurpleObject *pobj, gpointer dbus_proxy)
+purple_object_set_dbus_obj_proxy(PurpleObject *pobj, gpointer dbus_proxy)
 {
 	g_return_if_fail(pobj);
-	pobj->priv->dbus_proxy = dbus_proxy;
+	pobj->priv->dbus_obj_proxy = dbus_proxy;
 }
 
+gpointer
+purple_object_get_dbus_props_proxy(PurpleObject *pobj)
+{
+	g_return_val_if_fail(pobj, NULL);
+	return pobj->priv->dbus_props_proxy;
+}
+
+void
+purple_object_set_dbus_props_proxy(PurpleObject *pobj, gpointer dbus_proxy)
+{
+	g_return_if_fail(pobj);
+	pobj->priv->dbus_props_proxy = dbus_proxy;
+}
+
 char*
 purple_object_get_dbus_path(PurpleObject *pobj)
 {
============================================================
--- libpurple/pobject.h	985e218574cfa7017eba19a1546a08d3535f0279
+++ libpurple/pobject.h	50728c875bc2bb6a90d6b1de2b924fe149ca4848
@@ -72,9 +72,14 @@ gpointer purple_object_get_ui_data(Purpl
  * @param pobj The PurpleObject we want to get the DBusDProxy from.
  * @return The DBusDProxy.
  */
-gpointer purple_object_get_dbus_proxy(PurpleObject *pobj);
+gpointer purple_object_get_dbus_obj_proxy(PurpleObject *pobj);
 
 /**
+ * The same for the org.freedesktop.DBus.Properties interface.
+ */
+gpointer purple_object_get_dbus_props_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
@@ -83,9 +88,14 @@ gpointer purple_object_get_dbus_proxy(Pu
  * @param pobj The PurpleObject.
  * @param dbus_proxy The DBusGProxy associated with pobj.
  */
-void purple_object_set_dbus_proxy(PurpleObject *pobj, gpointer dbus_proxy);
+void purple_object_set_dbus_obj_proxy(PurpleObject *pobj, gpointer dbus_proxy);
 
 /**
+ * The same for the org.freedesktop.DBus.Properties interface.
+ */
+void purple_object_set_dbus_props_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


More information about the Commits mailing list