cpw.gillux.detachablepurple: 2e99e138: Turned the "root" field of the PurpleBud...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Sun May 20 13:21:11 EDT 2012
----------------------------------------------------------------------
Revision: 2e99e138d0e61e211c03698969f8f5941f1c6b3c
Parent: 056b42c3e9f4f361fe248f0e138cd377b097ffe1
Author: gillux at soc.pidgin.im
Date: 05/20/12 12:19:49
Branch: im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/2e99e138d0e61e211c03698969f8f5941f1c6b3c
Changelog:
Turned the "root" field of the PurpleBuddyList into a GObject property.
This gobjectification is only for detachable sessions'sake, as the
PurpleBuddyList type's scope is limited to blist.c.
Changes against parent 056b42c3e9f4f361fe248f0e138cd377b097ffe1
patched libpurple/blist.c
-------------- next part --------------
============================================================
--- libpurple/blist.c 0a8628033e00303ef6e6b8b33a600609d7d6b6a3
+++ libpurple/blist.c 29d936c36a7f278e16ba8f2ffb7b27fbc9b58796
@@ -1353,7 +1353,50 @@ purple_blist_uninit(void)
/* GObject Code */
/******************/
+/* GObject Property enums */
+enum
+{
+ PROP_0,
+ PROP_ROOT,
+ PROP_LAST
+};
+
+/* GObject Property names */
+#define PROP_ROOT_S "root"
+
+/* Set method for GObject properties */
static void
+purple_blist_set_property(GObject *obj, guint param_id, const GValue *value,
+ GParamSpec *pspec)
+{
+ PurpleBuddyList *blist = PURPLE_BUDDY_LIST(obj);
+ switch (param_id) {
+ case PROP_ROOT:
+ blist->node = 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_get_property(GObject *obj, guint param_id, GValue *value,
+ GParamSpec *pspec)
+{
+ PurpleBuddyList *blist = PURPLE_BUDDY_LIST(obj);
+ switch (param_id) {
+ case PROP_ROOT:
+ g_value_set_object(value, blist->node);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
purple_blist_finalize(GObject *object)
{
PurpleBuddyList *purplebuddylist = PURPLE_BUDDY_LIST(object);
@@ -1370,9 +1413,10 @@ new_group_added(PurpleGroup *group, gpoi
new_group_added(PurpleGroup *group, gpointer null)
{
PurpleBuddyList *list = PURPLE_BLIST;
- if (list->node == NULL)
+ if (list->node == NULL) {
list->node = PURPLE_BLIST_NODE(group);
- else {
+ g_object_notify(G_OBJECT(list), PROP_ROOT_S);
+ } else {
PurpleBlistNode *node = list->node, *next;
while ((next = purple_blist_node_next(node)))
node = next;
@@ -1390,6 +1434,7 @@ group_destroyed(PurpleGroup *group, gpoi
if (list->node == PURPLE_BLIST_NODE(group))
list->node = purple_blist_node_next(PURPLE_BLIST_NODE(group));
g_hash_table_remove(list->groups_cache, purple_group_get_name(group));
+ g_object_notify(G_OBJECT(list), PROP_ROOT_S);
}
static void
@@ -1429,6 +1474,15 @@ purple_blist_class_init(PurpleBuddyListC
parent_class = g_type_class_peek_parent(klass);
obj_class->finalize = purple_blist_finalize;
+ obj_class->get_property = purple_blist_get_property;
+ obj_class->set_property = purple_blist_set_property;
+
+ g_object_class_install_property(obj_class, PROP_ROOT,
+ g_param_spec_object(PROP_ROOT_S, _("Root"),
+ _("The root node for the buddy list."),
+ PURPLE_TYPE_BUDDY_LIST, G_PARAM_READWRITE)
+ );
+
purple_signal_register(handle, "buddy-status-changed",
purple_marshal_VOID__POINTER_POINTER_POINTER, NULL,
3,
More information about the Commits
mailing list