cpw.gillux.detachablepurple: fcc1ef13: Turned the PurpleBlistNode struct fields...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Sun May 20 13:22:11 EDT 2012
----------------------------------------------------------------------
Revision: fcc1ef13e4e11d85b2d8d28e82b7e3cef8ddf6a8
Parent: 407f3aacc935ec70ff1ed472fe8d0b2e750b9a4b
Author: gillux at soc.pidgin.im
Date: 05/20/12 11:58:00
Branch: im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/fcc1ef13e4e11d85b2d8d28e82b7e3cef8ddf6a8
Changelog:
Turned the PurpleBlistNode struct fields into GObject properties,
so that we can export them on D-Bus. I did not commit this to the
gobjectification branch because I think such a think would be
overkill, we only need it here for detachable sessions'sake.
Changes against parent 407f3aacc935ec70ff1ed472fe8d0b2e750b9a4b
patched libpurple/blist-node.c
-------------- next part --------------
============================================================
--- libpurple/blist-node.c 72110be4c24ca99c6589df824f20a5e7c9d12b03
+++ libpurple/blist-node.c 5032d81f233cbc07b621471351ff146b341258a1
@@ -690,7 +690,76 @@ static GObjectClass *parent_class = NULL
static GObjectClass *parent_class = NULL;
+/* GObject Property enums */
+enum
+{
+ PROP_0,
+ PROP_PREV,
+ PROP_NEXT,
+ PROP_PARENT,
+ PROP_CHILD,
+ PROP_LAST
+};
+
+/* GObject Property names */
+#define PROP_PREV_S "prev"
+#define PROP_NEXT_S "next"
+#define PROP_PARENT_S "parent"
+#define PROP_CHILD_S "child"
+
+/* Set method for GObject properties */
static void
+purple_blist_node_set_property(GObject *obj, guint param_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ PurpleBlistNode *node = PURPLE_BLIST_NODE(obj);
+
+ switch (param_id) {
+ case PROP_PREV:
+ node->prev = g_value_get_object(value);
+ break;
+ case PROP_NEXT:
+ node->next = g_value_get_object(value);
+ break;
+ case PROP_PARENT:
+ node->parent = g_value_get_object(value);
+ break;
+ case PROP_CHILD:
+ node->child = g_value_get_object(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+/* Get method for GObject properties */
+static void
+purple_blist_node_get_property(GObject *obj, guint param_id,
+ GValue *value, GParamSpec *pspec)
+{
+ PurpleBlistNode *node = PURPLE_BLIST_NODE(obj);
+
+ switch (param_id) {
+ case PROP_PREV:
+ g_value_set_object(value, node->prev);
+ break;
+ case PROP_NEXT:
+ g_value_set_object(value, node->next);
+ break;
+ case PROP_PARENT:
+ g_value_set_object(value, node->parent);
+ break;
+ case PROP_CHILD:
+ g_value_set_object(value, node->child);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
purple_blist_node_finalize(GObject *object)
{
PurpleBlistNode *node = PURPLE_BLIST_NODE(object);
@@ -743,6 +812,34 @@ purple_blist_node_class_init(PurpleBlist
klass->prev = purple_blist_node_real_prev;
klass->is_online = NULL;
+ /* Setup properties */
+ obj_class->get_property = purple_blist_node_get_property;
+ obj_class->set_property = purple_blist_node_set_property;
+
+ g_object_class_install_property(obj_class, PROP_PREV,
+ g_param_spec_object(PROP_PREV_S, _("Previous"),
+ _("The previous node."), PURPLE_TYPE_BLIST_NODE,
+ G_PARAM_READWRITE)
+ );
+
+ g_object_class_install_property(obj_class, PROP_NEXT,
+ g_param_spec_object(PROP_NEXT_S, _("Next"),
+ _("The next node."), PURPLE_TYPE_BLIST_NODE,
+ G_PARAM_READWRITE)
+ );
+
+ g_object_class_install_property(obj_class, PROP_PARENT,
+ g_param_spec_object(PROP_PARENT_S, _("Parent"),
+ _("The parent node."), PURPLE_TYPE_BLIST_NODE,
+ G_PARAM_READWRITE)
+ );
+
+ g_object_class_install_property(obj_class, PROP_CHILD,
+ g_param_spec_object(PROP_CHILD_S, _("Child"),
+ _("The child node."), PURPLE_TYPE_BLIST_NODE,
+ G_PARAM_READWRITE)
+ );
+
#if 0
purple_signal_register( purple_blist_node_handle(),
"node-removed",
More information about the Commits
mailing list