diff options
author | Ankit Vani <a@nevitus.org> | 2013-11-24 00:33:47 +0530 |
---|---|---|
committer | Ankit Vani <a@nevitus.org> | 2013-11-24 00:33:47 +0530 |
commit | 4684a9c0c55d1f945aa0e349b182a080961122c2 (patch) | |
tree | 1d4bd940c72405c099405a50eca5dd5d5eb8f8e5 /libpurple/blistnode.c | |
parent | 8d3ebf81f9e702f05ac1092aef6ff47cb6dced39 (diff) | |
download | pidgin-4684a9c0c55d1f945aa0e349b182a080961122c2.tar.gz |
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Diffstat (limited to 'libpurple/blistnode.c')
-rw-r--r-- | libpurple/blistnode.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/libpurple/blistnode.c b/libpurple/blistnode.c index e035493867..640ab12c7c 100644 --- a/libpurple/blistnode.c +++ b/libpurple/blistnode.c @@ -20,8 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ -#include "blistnodetypes.h" #include "internal.h" +#include "glibcompat.h" +#include "blistnodetypes.h" #define PURPLE_BLIST_NODE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_BLIST_NODE, PurpleBlistNodePrivate)) @@ -70,6 +71,9 @@ enum static GObjectClass *parent_class; +static GParamSpec *bn_properties[BLNODE_PROP_LAST]; +static GParamSpec *cn_properties[CNODE_PROP_LAST]; + /**************************************************************************/ /* Buddy list node API */ /**************************************************************************/ @@ -163,7 +167,8 @@ purple_blist_node_set_transient(PurpleBlistNode *node, gboolean transient) priv->transient = transient; - g_object_notify(G_OBJECT(node), "transient"); + g_object_notify_by_pspec(G_OBJECT(node), + bn_properties[BLNODE_PROP_TRANSIENT]); } gboolean @@ -407,11 +412,12 @@ purple_blist_node_class_init(PurpleBlistNodeClass *klass) 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, BLNODE_PROP_TRANSIENT, - g_param_spec_boolean("transient", "Transient", + bn_properties[BLNODE_PROP_TRANSIENT] = g_param_spec_boolean("transient", + "Transient", "Whether node should not be saved with the buddy list.", - FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BLNODE_PROP_TRANSIENT, + bn_properties[BLNODE_PROP_TRANSIENT]); g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate)); } @@ -515,7 +521,8 @@ purple_counting_node_set_total_size(PurpleCountingNode *counter, int totalsize) priv->totalsize = totalsize; - g_object_notify(G_OBJECT(counter), "total-size"); + g_object_notify_by_pspec(G_OBJECT(counter), + cn_properties[CNODE_PROP_TOTAL_SIZE]); } void @@ -527,7 +534,8 @@ purple_counting_node_set_current_size(PurpleCountingNode *counter, int currentsi priv->currentsize = currentsize; - g_object_notify(G_OBJECT(counter), "current-size"); + g_object_notify_by_pspec(G_OBJECT(counter), + cn_properties[CNODE_PROP_CURRENT_SIZE]); } void @@ -539,7 +547,8 @@ purple_counting_node_set_online_count(PurpleCountingNode *counter, int onlinecou priv->onlinecount = onlinecount; - g_object_notify(G_OBJECT(counter), "online-count"); + g_object_notify_by_pspec(G_OBJECT(counter), + cn_properties[CNODE_PROP_ONLINE_COUNT]); } /************************************************************************** @@ -602,26 +611,29 @@ purple_counting_node_class_init(PurpleCountingNodeClass *klass) obj_class->get_property = purple_counting_node_get_property; obj_class->set_property = purple_counting_node_set_property; - g_object_class_install_property(obj_class, CNODE_PROP_TOTAL_SIZE, - g_param_spec_int("total-size", "Total size", + cn_properties[CNODE_PROP_TOTAL_SIZE] = g_param_spec_int("total-size", + "Total size", "The number of children under this node.", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CNODE_PROP_TOTAL_SIZE, + cn_properties[CNODE_PROP_TOTAL_SIZE]); - g_object_class_install_property(obj_class, CNODE_PROP_CURRENT_SIZE, - g_param_spec_int("current-size", "Current size", + cn_properties[CNODE_PROP_CURRENT_SIZE] = g_param_spec_int("current-size", + "Current size", "The number of children with online accounts.", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CNODE_PROP_CURRENT_SIZE, + cn_properties[CNODE_PROP_CURRENT_SIZE]); - g_object_class_install_property(obj_class, CNODE_PROP_ONLINE_COUNT, - g_param_spec_int("online-count", "Online count", + cn_properties[CNODE_PROP_ONLINE_COUNT] = g_param_spec_int("online-count", + "Online count", "The number of children that are online.", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CNODE_PROP_ONLINE_COUNT, + cn_properties[CNODE_PROP_ONLINE_COUNT]); g_type_class_add_private(klass, sizeof(PurpleCountingNodePrivate)); } |