Sun, 24 Nov 2013 00:33:47 +0530
libpurple: use g_object_notify_by_pspec instead of g_object_notify
--- a/libpurple/account.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/account.c Sun Nov 24 00:33:47 2013 +0530 @@ -24,6 +24,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" +#include "glibcompat.h" + #include "accounts.h" #include "core.h" #include "dbus-maybe.h" @@ -133,6 +135,7 @@ }; static GObjectClass *parent_class = NULL; +static GParamSpec *properties[PROP_LAST]; static GList *handles = NULL; void _purple_account_set_current_error(PurpleAccount *account, @@ -742,7 +745,7 @@ g_free(priv->username); priv->username = g_strdup(username); - g_object_notify(G_OBJECT(account), "username"); + g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_USERNAME]); purple_accounts_schedule_save(); @@ -802,7 +805,8 @@ char *old = priv->alias; priv->alias = g_strdup(alias); - g_object_notify(G_OBJECT(account), "private-alias"); + g_object_notify_by_pspec(G_OBJECT(account), + properties[PROP_PRIVATE_ALIAS]); purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed", account, old); g_free(old); @@ -823,7 +827,7 @@ g_free(priv->user_info); priv->user_info = g_strdup(user_info); - g_object_notify(G_OBJECT(account), "user-info"); + g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_USER_INFO]); purple_accounts_schedule_save(); } @@ -839,7 +843,8 @@ g_free(priv->buddy_icon_path); priv->buddy_icon_path = g_strdup(path); - g_object_notify(G_OBJECT(account), "buddy-icon-path"); + g_object_notify_by_pspec(G_OBJECT(account), + properties[PROP_BUDDY_ICON_PATH]); purple_accounts_schedule_save(); } @@ -857,7 +862,7 @@ g_free(priv->protocol_id); priv->protocol_id = g_strdup(protocol_id); - g_object_notify(G_OBJECT(account), "protocol-id"); + g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_PROTOCOL_ID]); purple_accounts_schedule_save(); } @@ -872,7 +877,7 @@ priv = PURPLE_ACCOUNT_GET_PRIVATE(account); priv->gc = gc; - g_object_notify(G_OBJECT(account), "connection"); + g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_CONNECTION]); } void @@ -885,7 +890,8 @@ priv = PURPLE_ACCOUNT_GET_PRIVATE(account); priv->remember_pass = value; - g_object_notify(G_OBJECT(account), "remember-password"); + g_object_notify_by_pspec(G_OBJECT(account), + properties[PROP_REMEMBER_PASSWORD]); purple_accounts_schedule_save(); } @@ -897,7 +903,7 @@ purple_account_set_bool(account, "check-mail", value); - g_object_notify(G_OBJECT(account), "check-mail"); + g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_CHECK_MAIL]); } void @@ -921,7 +927,7 @@ else if(!was_enabled && value) purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account); - g_object_notify(G_OBJECT(account), "enabled"); + g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ENABLED]); if ((gc != NULL) && (_purple_connection_wants_to_die(gc))) wants_to_die = TRUE; @@ -3068,60 +3074,67 @@ obj_class->get_property = purple_account_get_property; obj_class->set_property = purple_account_set_property; - g_object_class_install_property(obj_class, PROP_USERNAME, - g_param_spec_string("username", "Username", + properties[PROP_USERNAME] = g_param_spec_string("username", "Username", "The username for the account.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_PRIVATE_ALIAS, - g_param_spec_string("private-alias", "Private Alias", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_USERNAME, + properties[PROP_USERNAME]); + + properties[PROP_PRIVATE_ALIAS] = g_param_spec_string("private-alias", + "Private Alias", "The private alias for the account.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_USER_INFO, - g_param_spec_string("user-info", "User information", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_PRIVATE_ALIAS, + properties[PROP_PRIVATE_ALIAS]); + + properties[PROP_USER_INFO] = g_param_spec_string("user-info", + "User information", "Detailed user information for the account.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_USER_INFO, + properties[PROP_USER_INFO]); + + properties[PROP_BUDDY_ICON_PATH] = g_param_spec_string("buddy-icon-path", + "Buddy icon path", + "Path to the buddyicon for the account.", NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_BUDDY_ICON_PATH, - g_param_spec_string("buddy-icon-path", "Buddy icon path", - "Path to the buddyicon for the account.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - + properties[PROP_BUDDY_ICON_PATH]); + + properties[PROP_ENABLED] = g_param_spec_boolean("enabled", "Enabled", + "Whether the account is enabled or not.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_ENABLED, - g_param_spec_boolean("enabled", "Enabled", - "Whether the account is enabled or not.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - + properties[PROP_ENABLED]); + + properties[PROP_REMEMBER_PASSWORD] = g_param_spec_boolean( + "remember-password", "Remember password", + "Whether to remember and store the password for this account.", + FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_REMEMBER_PASSWORD, - g_param_spec_boolean("remember-password", "Remember password", - "Whether to remember and store the password for this account.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - + properties[PROP_REMEMBER_PASSWORD]); + + properties[PROP_CHECK_MAIL] = g_param_spec_boolean("check-mail", + "Check mail", + "Whether to check mails for this account.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_CHECK_MAIL, - g_param_spec_boolean("check-mail", "Check mail", - "Whether to check mails for this account.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - + properties[PROP_CHECK_MAIL]); + + properties[PROP_CONNECTION] = g_param_spec_object("connection", + "Connection", + "The connection for the account.", PURPLE_TYPE_CONNECTION, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_CONNECTION, - g_param_spec_object("connection", "Connection", - "The connection for the account.", PURPLE_TYPE_CONNECTION, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_PROTOCOL_ID, - g_param_spec_string("protocol-id", "Protocol ID", + properties[PROP_CONNECTION]); + + properties[PROP_PROTOCOL_ID] = g_param_spec_string("protocol-id", + "Protocol ID", "ID of the protocol that is responsible for the account.", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_PROTOCOL_ID, + properties[PROP_PROTOCOL_ID]); g_type_class_add_private(klass, sizeof(PurpleAccountPrivate)); }
--- a/libpurple/blistnode.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/blistnode.c Sun Nov 24 00:33:47 2013 +0530 @@ -20,8 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ +#include "internal.h" +#include "glibcompat.h" #include "blistnodetypes.h" -#include "internal.h" #define PURPLE_BLIST_NODE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_BLIST_NODE, PurpleBlistNodePrivate)) @@ -70,6 +71,9 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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)); }
--- a/libpurple/blistnodetypes.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/blistnodetypes.c Sun Nov 24 00:33:47 2013 +0530 @@ -21,6 +21,7 @@ * */ #include "internal.h" +#include "glibcompat.h" #include "dbus-maybe.h" #include "debug.h" @@ -129,6 +130,11 @@ static PurpleBlistNode *blistnode_parent_class; static PurpleCountingNode *counting_parent_class; +static GParamSpec *bd_properties[BUDDY_PROP_LAST]; +static GParamSpec *co_properties[CONTACT_PROP_LAST]; +static GParamSpec *gr_properties[GROUP_PROP_LAST]; +static GParamSpec *ch_properties[CHAT_PROP_LAST]; + static gboolean purple_strings_are_different(const char *one, const char *two) { @@ -155,7 +161,8 @@ purple_buddy_icon_unref(priv->icon); priv->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL); - g_object_notify(G_OBJECT(buddy), "icon"); + g_object_notify_by_pspec(G_OBJECT(buddy), + bd_properties[BUDDY_PROP_ICON]); } purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy); @@ -197,7 +204,7 @@ g_free(priv->name); priv->name = purple_utf8_strip_unprintables(name); - g_object_notify(G_OBJECT(buddy), "name"); + g_object_notify_by_pspec(G_OBJECT(buddy), bd_properties[BUDDY_PROP_NAME]); if (ops) { if (ops->save_node) @@ -326,7 +333,8 @@ g_free(new_alias); /* could be "\0" */ } - g_object_notify(G_OBJECT(buddy), "local-alias"); + g_object_notify_by_pspec(G_OBJECT(buddy), + bd_properties[BUDDY_PROP_LOCAL_ALIAS]); if (ops && ops->save_node) ops->save_node(PURPLE_BLIST_NODE(buddy)); @@ -381,7 +389,8 @@ g_free(new_alias); /* could be "\0"; */ } - g_object_notify(G_OBJECT(buddy), "server-alias"); + g_object_notify_by_pspec(G_OBJECT(buddy), + bd_properties[BUDDY_PROP_SERVER_ALIAS]); if (ops) { if (ops->save_node) @@ -511,7 +520,8 @@ priv->media_caps = media_caps; - g_object_notify(G_OBJECT(buddy), "media-caps"); + g_object_notify_by_pspec(G_OBJECT(buddy), + bd_properties[BUDDY_PROP_MEDIA_CAPS]); } PurpleGroup *purple_buddy_get_group(PurpleBuddy *buddy) @@ -685,49 +695,54 @@ obj_class->set_property = purple_buddy_set_property; obj_class->constructed = purple_buddy_constructed; - g_object_class_install_property(obj_class, BUDDY_PROP_NAME, - g_param_spec_string("name", "Name", + bd_properties[BUDDY_PROP_NAME] = g_param_spec_string("name", "Name", "The name of the buddy.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BUDDY_PROP_NAME, + bd_properties[BUDDY_PROP_NAME]); - g_object_class_install_property(obj_class, BUDDY_PROP_LOCAL_ALIAS, - g_param_spec_string("local-alias", "Local alias", + bd_properties[BUDDY_PROP_LOCAL_ALIAS] = g_param_spec_string("local-alias", + "Local alias", "Local alias of thee buddy.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BUDDY_PROP_LOCAL_ALIAS, + bd_properties[BUDDY_PROP_LOCAL_ALIAS]); + bd_properties[BUDDY_PROP_SERVER_ALIAS] = g_param_spec_string("server-alias", + "Server alias", + "Server-side alias of the buddy.", NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, BUDDY_PROP_SERVER_ALIAS, - g_param_spec_string("server-alias", "Server alias", - "Server-side alias of the buddy.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + bd_properties[BUDDY_PROP_SERVER_ALIAS]); + bd_properties[BUDDY_PROP_ICON] = g_param_spec_pointer("icon", "Buddy icon", + "The icon for the buddy.", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, BUDDY_PROP_ICON, - g_param_spec_pointer("icon", "Buddy icon", - "The icon for the buddy.", - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + bd_properties[BUDDY_PROP_ICON]); - g_object_class_install_property(obj_class, BUDDY_PROP_ACCOUNT, - g_param_spec_object("account", "Account", + bd_properties[BUDDY_PROP_ACCOUNT] = g_param_spec_object("account", + "Account", "The account for the buddy.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BUDDY_PROP_ACCOUNT, + bd_properties[BUDDY_PROP_ACCOUNT]); - g_object_class_install_property(obj_class, BUDDY_PROP_PRESENCE, - g_param_spec_object("presence", "Presence", + bd_properties[BUDDY_PROP_PRESENCE] = g_param_spec_object("presence", + "Presence", "The status information for the buddy.", PURPLE_TYPE_PRESENCE, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BUDDY_PROP_PRESENCE, + bd_properties[BUDDY_PROP_PRESENCE]); - g_object_class_install_property(obj_class, BUDDY_PROP_MEDIA_CAPS, - g_param_spec_enum("media-caps", "Media capabilities", + bd_properties[BUDDY_PROP_MEDIA_CAPS] = g_param_spec_enum("media-caps", + "Media capabilities", "The media capabilities of the buddy.", PURPLE_MEDIA_TYPE_CAPS, PURPLE_MEDIA_CAPS_NONE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BUDDY_PROP_MEDIA_CAPS, + bd_properties[BUDDY_PROP_MEDIA_CAPS]); g_type_class_add_private(klass, sizeof(PurpleBuddyPrivate)); } @@ -821,7 +836,8 @@ priv->priority_buddy = new_priority; priv->priority_valid = TRUE; - g_object_notify(G_OBJECT(contact), "priority-buddy"); + g_object_notify_by_pspec(G_OBJECT(contact), + co_properties[CONTACT_PROP_PRIORITY_BUDDY]); } PurpleGroup * @@ -861,7 +877,8 @@ g_free(new_alias); /* could be "\0" */ } - g_object_notify(G_OBJECT(contact), "alias"); + g_object_notify_by_pspec(G_OBJECT(contact), + co_properties[CONTACT_PROP_ALIAS]); if (ops) { if (ops->save_node) @@ -1051,17 +1068,18 @@ obj_class->get_property = purple_contact_get_property; obj_class->set_property = purple_contact_set_property; - g_object_class_install_property(obj_class, CONTACT_PROP_ALIAS, - g_param_spec_string("alias", "Alias", + co_properties[CONTACT_PROP_ALIAS] = g_param_spec_string("alias", "Alias", "The alias for the contact.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CONTACT_PROP_ALIAS, + co_properties[CONTACT_PROP_ALIAS]); - g_object_class_install_property(obj_class, CONTACT_PROP_PRIORITY_BUDDY, - g_param_spec_object("priority-buddy", + co_properties[CONTACT_PROP_PRIORITY_BUDDY] = g_param_spec_object( + "priority-buddy", "Priority buddy", "The priority buddy of the contact.", - PURPLE_TYPE_BUDDY, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); + PURPLE_TYPE_BUDDY, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CONTACT_PROP_PRIORITY_BUDDY, + co_properties[CONTACT_PROP_PRIORITY_BUDDY]); g_type_class_add_private(klass, sizeof(PurpleContactPrivate)); } @@ -1166,7 +1184,7 @@ g_free(new_alias); /* could be "\0" */ } - g_object_notify(G_OBJECT(chat), "alias"); + g_object_notify_by_pspec(G_OBJECT(chat), ch_properties[CHAT_PROP_ALIAS]); if (ops) { if (ops->save_node) @@ -1309,25 +1327,26 @@ obj_class->set_property = purple_chat_set_property; obj_class->constructed = purple_chat_constructed; - g_object_class_install_property(obj_class, CHAT_PROP_ALIAS, - g_param_spec_string("alias", "Alias", + ch_properties[CHAT_PROP_ALIAS] = g_param_spec_string("alias", "Alias", "The alias for the chat.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CHAT_PROP_ALIAS, + ch_properties[CHAT_PROP_ALIAS]); - g_object_class_install_property(obj_class, CHAT_PROP_ACCOUNT, - g_param_spec_object("account", "Account", + ch_properties[CHAT_PROP_ACCOUNT] = g_param_spec_object("account", "Account", "The account that the chat belongs to.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CHAT_PROP_ACCOUNT, + ch_properties[CHAT_PROP_ACCOUNT]); - g_object_class_install_property(obj_class, CHAT_PROP_COMPONENTS, - g_param_spec_pointer("components", "Components", + ch_properties[CHAT_PROP_COMPONENTS] = g_param_spec_pointer("components", + "Components", "The protocol components of the chat.", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CHAT_PROP_COMPONENTS, + ch_properties[CHAT_PROP_COMPONENTS]); g_type_class_add_private(klass, sizeof(PurpleChatPrivate)); } @@ -1498,7 +1517,7 @@ old_name = priv->name; priv->name = new_name; - g_object_notify(G_OBJECT(source), "name"); + g_object_notify_by_pspec(G_OBJECT(source), gr_properties[GROUP_PROP_NAME]); } /* Save our changes */ @@ -1559,7 +1578,7 @@ g_list_free(moved_buddies); g_free(old_name); - g_object_notify(G_OBJECT(source), "name"); + g_object_notify_by_pspec(G_OBJECT(source), gr_properties[GROUP_PROP_NAME]); } const char *purple_group_get_name(PurpleGroup *group) @@ -1655,11 +1674,11 @@ obj_class->get_property = purple_group_get_property; obj_class->set_property = purple_group_set_property; - g_object_class_install_property(obj_class, GROUP_PROP_NAME, - g_param_spec_string("name", "Name", + gr_properties[GROUP_PROP_NAME] = g_param_spec_string("name", "Name", "Name of the group.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, GROUP_PROP_NAME, + gr_properties[GROUP_PROP_NAME]); g_type_class_add_private(klass, sizeof(PurpleGroupPrivate)); }
--- a/libpurple/connection.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/connection.c Sun Nov 24 00:33:47 2013 +0530 @@ -26,6 +26,8 @@ #define _PURPLE_CONNECTION_C_ #include "internal.h" +#include "glibcompat.h" + #include "account.h" #include "buddylist.h" #include "connection.h" @@ -101,6 +103,7 @@ }; static GObjectClass *parent_class; +static GParamSpec *properties[PROP_LAST]; static GList *connections = NULL; static GList *connections_connecting = NULL; @@ -254,7 +257,7 @@ ops->disconnected(gc); } - g_object_notify(G_OBJECT(gc), "state"); + g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_STATE]); } void @@ -266,7 +269,7 @@ priv->flags = flags; - g_object_notify(G_OBJECT(gc), "flags"); + g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_FLAGS]); } void @@ -279,7 +282,7 @@ g_free(priv->display_name); priv->display_name = g_strdup(name); - g_object_notify(G_OBJECT(gc), "display-name"); + g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_DISPLAY_NAME]); } void @@ -812,46 +815,47 @@ obj_class->get_property = purple_connection_get_property; obj_class->set_property = purple_connection_set_property; - g_object_class_install_property(obj_class, PROP_PRPL, - g_param_spec_pointer("prpl", "Protocol plugin", + properties[PROP_PRPL] = g_param_spec_pointer("prpl", "Protocol plugin", "The prpl that is using the connection.", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_PRPL, + properties[PROP_PRPL]); - g_object_class_install_property(obj_class, PROP_FLAGS, - g_param_spec_flags("flags", "Connection flags", + properties[PROP_FLAGS] = g_param_spec_flags("flags", "Connection flags", "The flags of the connection.", PURPLE_TYPE_CONNECTION_FLAGS, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_FLAGS, + properties[PROP_FLAGS]); - g_object_class_install_property(obj_class, PROP_STATE, - g_param_spec_enum("state", "Connection state", + properties[PROP_STATE] = g_param_spec_enum("state", "Connection state", "The current state of the connection.", PURPLE_TYPE_CONNECTION_STATE, PURPLE_CONNECTION_DISCONNECTED, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_STATE, + properties[PROP_STATE]); - g_object_class_install_property(obj_class, PROP_ACCOUNT, - g_param_spec_object("account", "Account", + properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", "The account using the connection.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_ACCOUNT, + properties[PROP_ACCOUNT]); - g_object_class_install_property(obj_class, PROP_PASSWORD, - g_param_spec_string("password", "Password", + properties[PROP_PASSWORD] = g_param_spec_string("password", "Password", "The password used for connection.", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_PASSWORD, + properties[PROP_PASSWORD]); + properties[PROP_DISPLAY_NAME] = g_param_spec_string("display-name", + "Display name", + "Your name that appears to other people.", NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_DISPLAY_NAME, - g_param_spec_string("display-name", "Display name", - "Your name that appears to other people.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + properties[PROP_DISPLAY_NAME]); g_type_class_add_private(klass, sizeof(PurpleConnectionPrivate)); }
--- a/libpurple/conversation.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/conversation.c Sun Nov 24 00:33:47 2013 +0530 @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" +#include "glibcompat.h" + #include "buddylist.h" #include "cmds.h" #include "conversation.h" @@ -87,7 +89,7 @@ }; static GObjectClass *parent_class; - +static GParamSpec *properties[PROP_LAST]; static void common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags) @@ -283,7 +285,7 @@ priv->features = features; - g_object_notify(G_OBJECT(conv), "features"); + g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_FEATURES]); purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_FEATURES); } @@ -338,7 +340,7 @@ purple_conversations_update_cache(conv, NULL, account); priv->account = account; - g_object_notify(G_OBJECT(conv), "account"); + g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_ACCOUNT]); purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ACCOUNT); } @@ -379,7 +381,7 @@ g_free(priv->title); priv->title = g_strdup(title); - g_object_notify(G_OBJECT(conv), "title"); + g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_TITLE]); purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_TITLE); } @@ -433,7 +435,7 @@ g_free(priv->name); priv->name = g_strdup(name); - g_object_notify(G_OBJECT(conv), "name"); + g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_NAME]); purple_conversation_autoset_title(conv); purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_NAME); @@ -511,7 +513,7 @@ if (log && priv->logs == NULL) open_log(conv); - g_object_notify(G_OBJECT(conv), "logging"); + g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_LOGGING]); purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_LOGGING); } @@ -1125,36 +1127,37 @@ obj_class->get_property = purple_conversation_get_property; obj_class->set_property = purple_conversation_set_property; - g_object_class_install_property(obj_class, PROP_ACCOUNT, - g_param_spec_object("account", "Account", + properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", "The account for the conversation.", PURPLE_TYPE_ACCOUNT, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_ACCOUNT, + properties[PROP_ACCOUNT]); - g_object_class_install_property(obj_class, PROP_NAME, - g_param_spec_string("name", "Name", + properties[PROP_NAME] = g_param_spec_string("name", "Name", "The name of the conversation.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_NAME, + properties[PROP_NAME]); + properties[PROP_TITLE] = g_param_spec_string("title", "Title", + "The title of the conversation.", NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_TITLE, - g_param_spec_string("title", "Title", - "The title of the conversation.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + properties[PROP_TITLE]); + properties[PROP_LOGGING] = g_param_spec_boolean("logging", "Logging status", + "Whether logging is enabled or not.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_LOGGING, - g_param_spec_boolean("logging", "Logging status", - "Whether logging is enabled or not.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + properties[PROP_LOGGING]); - g_object_class_install_property(obj_class, PROP_FEATURES, - g_param_spec_flags("features", "Connection features", + properties[PROP_FEATURES] = g_param_spec_flags("features", + "Connection features", "The connection features of the conversation.", PURPLE_TYPE_CONNECTION_FLAGS, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_FEATURES, + properties[PROP_FEATURES]); g_type_class_add_private(klass, sizeof(PurpleConversationPrivate)); }
--- a/libpurple/conversationtypes.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/conversationtypes.c Sun Nov 24 00:33:47 2013 +0530 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" +#include "glibcompat.h" #include "conversationtypes.h" #include "dbus-maybe.h" #include "debug.h" @@ -126,6 +127,10 @@ static PurpleConversationClass *parent_class; static GObjectClass *cb_parent_class; +static GParamSpec *chat_properties[CHAT_PROP_LAST]; +static GParamSpec *im_properties[IM_PROP_LAST]; +static GParamSpec *cu_properties[CU_PROP_LAST]; + static int purple_chat_user_compare(PurpleChatUser *a, PurpleChatUser *b); @@ -182,7 +187,7 @@ priv->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon)); - g_object_notify(G_OBJECT(im), "icon"); + g_object_notify_by_pspec(G_OBJECT(im), im_properties[IM_PROP_ICON]); } purple_conversation_update(PURPLE_CONVERSATION(im), @@ -215,7 +220,8 @@ { priv->typing_state = state; - g_object_notify(G_OBJECT(im), "typing-state"); + g_object_notify_by_pspec(G_OBJECT(im), + im_properties[IM_PROP_TYPING_STATE]); switch (state) { @@ -515,20 +521,22 @@ conv_class->write_message = im_conversation_write_message; - g_object_class_install_property(obj_class, IM_PROP_TYPING_STATE, - g_param_spec_enum("typing-state", "Typing state", + im_properties[IM_PROP_TYPING_STATE] = g_param_spec_enum("typing-state", + "Typing state", "Status of the user's typing of a message.", PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, IM_PROP_TYPING_STATE, + im_properties[IM_PROP_TYPING_STATE]); - g_object_class_install_property(obj_class, IM_PROP_ICON, - g_param_spec_pointer("icon", "Buddy icon", + im_properties[IM_PROP_ICON] = g_param_spec_pointer("icon", + "Buddy icon", "The buddy icon for the IM.", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, IM_PROP_ICON, + im_properties[IM_PROP_ICON]); g_type_class_add_private(klass, sizeof(PurpleIMConversationPrivate)); } @@ -732,8 +740,8 @@ obj = G_OBJECT(chat); g_object_freeze_notify(obj); - g_object_notify(obj, "topic-who"); - g_object_notify(obj, "topic"); + g_object_notify_by_pspec(obj, chat_properties[CHAT_PROP_TOPIC_WHO]); + g_object_notify_by_pspec(obj, chat_properties[CHAT_PROP_TOPIC]); g_object_thaw_notify(obj); purple_conversation_update(PURPLE_CONVERSATION(chat), @@ -772,7 +780,7 @@ priv->id = id; - g_object_notify(G_OBJECT(chat), "chat-id"); + g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_ID]); } int @@ -1207,7 +1215,7 @@ priv->nick = g_strdup(purple_normalize( purple_conversation_get_account(PURPLE_CONVERSATION(chat)), nick)); - g_object_notify(G_OBJECT(chat), "nick"); + g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_NICK]); } const char *purple_chat_conversation_get_nick(PurpleChatConversation *chat) { @@ -1294,7 +1302,7 @@ priv->left = TRUE; - g_object_notify(G_OBJECT(chat), "left"); + g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]); purple_conversation_update(PURPLE_CONVERSATION(chat), PURPLE_CONVERSATION_UPDATE_CHATLEFT); } @@ -1337,7 +1345,7 @@ purple_chat_conversation_set_topic(chat, NULL, NULL); priv->left = FALSE; - g_object_notify(G_OBJECT(chat), "left"); + g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]); purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_CHATLEFT); } @@ -1557,35 +1565,40 @@ conv_class->write_message = chat_conversation_write_message; - g_object_class_install_property(obj_class, CHAT_PROP_TOPIC_WHO, - g_param_spec_string("topic-who", "Who set topic", + chat_properties[CHAT_PROP_TOPIC_WHO] = g_param_spec_string("topic-who", + "Who set topic", "Who set the chat topic.", NULL, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CHAT_PROP_TOPIC_WHO, + chat_properties[CHAT_PROP_TOPIC_WHO]); + chat_properties[CHAT_PROP_TOPIC] = g_param_spec_string("topic", + "Topic", + "Topic of the chat.", NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, CHAT_PROP_TOPIC, - g_param_spec_string("topic", "Topic", - "Topic of the chat.", NULL, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); + chat_properties[CHAT_PROP_TOPIC]); - g_object_class_install_property(obj_class, CHAT_PROP_ID, - g_param_spec_int("chat-id", "Chat ID", + chat_properties[CHAT_PROP_ID] = g_param_spec_int("chat-id", + "Chat ID", "The ID of the chat.", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CHAT_PROP_ID, + chat_properties[CHAT_PROP_ID]); - g_object_class_install_property(obj_class, CHAT_PROP_NICK, - g_param_spec_string("nick", "Nickname", + chat_properties[CHAT_PROP_NICK] = g_param_spec_string("nick", + "Nickname", "The nickname of the user in a chat.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CHAT_PROP_NICK, + chat_properties[CHAT_PROP_NICK]); + chat_properties[CHAT_PROP_LEFT] = g_param_spec_boolean("left", + "Left the chat", + "Whether the user has left the chat.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, CHAT_PROP_LEFT, - g_param_spec_boolean("left", "Left the chat", - "Whether the user has left the chat.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + chat_properties[CHAT_PROP_LEFT]); g_type_class_add_private(klass, sizeof(PurpleChatConversationPrivate)); } @@ -1744,7 +1757,7 @@ oldflags = priv->flags; priv->flags = flags; - g_object_notify(G_OBJECT(cb), "flags"); + g_object_notify_by_pspec(G_OBJECT(cb), cu_properties[CU_PROP_FLAGS]); ops = purple_conversation_get_ui_ops(PURPLE_CONVERSATION(priv->chat)); @@ -1793,7 +1806,7 @@ priv->chat = chat; - g_object_notify(G_OBJECT(cb), "chat"); + g_object_notify_by_pspec(G_OBJECT(cb), cu_properties[CU_PROP_CHAT]); } PurpleChatConversation * @@ -1932,31 +1945,31 @@ obj_class->get_property = purple_chat_user_get_property; obj_class->set_property = purple_chat_user_set_property; - g_object_class_install_property(obj_class, CU_PROP_CHAT, - g_param_spec_object("chat", "Chat", + cu_properties[CU_PROP_CHAT] = g_param_spec_object("chat", "Chat", "The chat the buddy belongs to.", PURPLE_TYPE_CHAT_CONVERSATION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, CU_PROP_NAME, - g_param_spec_string("name", "Name", - "Name of the chat user.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CU_PROP_CHAT, + cu_properties[CU_PROP_CHAT]); - g_object_class_install_property(obj_class, CU_PROP_ALIAS, - g_param_spec_string("alias", "Alias", + cu_properties[CU_PROP_NAME] = g_param_spec_string("name", "Name", + "Name of the chat user.", NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CU_PROP_NAME, + cu_properties[CU_PROP_NAME]); + + cu_properties[CU_PROP_ALIAS] = g_param_spec_string("alias", "Alias", "Alias of the chat user.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CU_PROP_ALIAS, + cu_properties[CU_PROP_ALIAS]); - g_object_class_install_property(obj_class, CU_PROP_FLAGS, - g_param_spec_flags("flags", "Buddy flags", + cu_properties[CU_PROP_FLAGS] = g_param_spec_flags("flags", "Buddy flags", "The flags for the chat user.", PURPLE_TYPE_CHAT_USER_FLAGS, PURPLE_CHAT_USER_NONE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, CU_PROP_FLAGS, + cu_properties[CU_PROP_FLAGS]); g_type_class_add_private(klass, sizeof(PurpleChatUserPrivate)); }
--- a/libpurple/presence.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/presence.c Sun Nov 24 00:33:47 2013 +0530 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" +#include "glibcompat.h" #include "debug.h" #include "dbus-maybe.h" #include "presence.h" @@ -97,6 +98,10 @@ static GObjectClass *parent_class; static PurplePresenceClass *presence_class; +static GParamSpec *properties[PRES_PROP_LAST]; +static GParamSpec *ap_properties[ACPRES_PROP_LAST]; +static GParamSpec *bp_properties[BUDPRES_PROP_LAST]; + int *_purple_get_primitive_scores(void); /************************************************************************** @@ -159,8 +164,8 @@ obj = G_OBJECT(presence); g_object_freeze_notify(obj); - g_object_notify(obj, "idle"); - g_object_notify(obj, "idle-time"); + g_object_notify_by_pspec(obj, properties[PRES_PROP_IDLE]); + g_object_notify_by_pspec(obj, properties[PRES_PROP_IDLE_TIME]); g_object_thaw_notify(obj); if (klass->update_idle) @@ -179,7 +184,8 @@ priv->login_time = login_time; - g_object_notify(G_OBJECT(presence), "login-time"); + g_object_notify_by_pspec(G_OBJECT(presence), + properties[PRES_PROP_LOGIN_TIME]); } GList * @@ -463,18 +469,17 @@ obj_class->get_property = purple_presence_get_property; obj_class->set_property = purple_presence_set_property; - g_object_class_install_property(obj_class, PRES_PROP_IDLE, - g_param_spec_boolean("idle", "Idle", + properties[PRES_PROP_IDLE] = g_param_spec_boolean("idle", "Idle", "Whether the presence is in idle state.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PRES_PROP_IDLE, + properties[PRES_PROP_IDLE]); - - g_object_class_install_property(obj_class, PRES_PROP_IDLE_TIME, + properties[PRES_PROP_IDLE_TIME] = #if SIZEOF_TIME_T == 4 - g_param_spec_int + g_param_spec_int #elif SIZEOF_TIME_T == 8 - g_param_spec_int64 + g_param_spec_int64 #else #error Unknown size of time_t #endif @@ -487,14 +492,15 @@ #else #error Unknown size of time_t #endif - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PRES_PROP_IDLE_TIME, + properties[PRES_PROP_IDLE_TIME]); - g_object_class_install_property(obj_class, PRES_PROP_LOGIN_TIME, + properties[PRES_PROP_LOGIN_TIME] = #if SIZEOF_TIME_T == 4 - g_param_spec_int + g_param_spec_int #elif SIZEOF_TIME_T == 8 - g_param_spec_int64 + g_param_spec_int64 #else #error Unknown size of time_t #endif @@ -507,20 +513,23 @@ #else #error Unknown size of time_t #endif - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PRES_PROP_LOGIN_TIME, + properties[PRES_PROP_LOGIN_TIME]); - g_object_class_install_property(obj_class, PRES_PROP_STATUSES, - g_param_spec_pointer("statuses", "Statuses", + properties[PRES_PROP_STATUSES] = g_param_spec_pointer("statuses", + "Statuses", "The list of statuses in the presence.", - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PRES_PROP_STATUSES, + properties[PRES_PROP_STATUSES]); + properties[PRES_PROP_ACTIVE_STATUS] = g_param_spec_object("active-status", + "Active status", + "The active status for the presence.", PURPLE_TYPE_STATUS, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PRES_PROP_ACTIVE_STATUS, - g_param_spec_object("active-status", "Active status", - "The active status for the presence.", PURPLE_TYPE_STATUS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + properties[PRES_PROP_ACTIVE_STATUS]); g_type_class_add_private(klass, sizeof(PurplePresencePrivate)); } @@ -755,12 +764,13 @@ obj_class->get_property = purple_account_presence_get_property; obj_class->set_property = purple_account_presence_set_property; - g_object_class_install_property(obj_class, ACPRES_PROP_ACCOUNT, - g_param_spec_object("account", "Account", + ap_properties[ACPRES_PROP_ACCOUNT] = g_param_spec_object("account", + "Account", "The account that this presence is of.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, ACPRES_PROP_ACCOUNT, + ap_properties[ACPRES_PROP_ACCOUNT]); g_type_class_add_private(klass, sizeof(PurpleAccountPresencePrivate)); } @@ -950,12 +960,12 @@ obj_class->get_property = purple_buddy_presence_get_property; obj_class->set_property = purple_buddy_presence_set_property; - g_object_class_install_property(obj_class, BUDPRES_PROP_BUDDY, - g_param_spec_object("buddy", "Buddy", + bp_properties[BUDPRES_PROP_BUDDY] = g_param_spec_object("buddy", "Buddy", "The buddy that this presence is of.", PURPLE_TYPE_BUDDY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, BUDPRES_PROP_BUDDY, + bp_properties[BUDPRES_PROP_BUDDY]); g_type_class_add_private(klass, sizeof(PurpleBuddyPresencePrivate)); }
--- a/libpurple/roomlist.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/roomlist.c Sun Nov 24 00:33:47 2013 +0530 @@ -24,6 +24,7 @@ */ #include "internal.h" +#include "glibcompat.h" #include "account.h" #include "connection.h" @@ -82,6 +83,7 @@ }; static GObjectClass *parent_class; +static GParamSpec *properties[PROP_LAST]; static PurpleRoomlistUiOps *ops = NULL; static void purple_roomlist_field_free(PurpleRoomlistField *f); @@ -118,7 +120,7 @@ if (ops && ops->set_fields) ops->set_fields(list, fields); - g_object_notify(G_OBJECT(list), "fields"); + g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); } void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) @@ -132,7 +134,7 @@ if (ops && ops->in_progress) ops->in_progress(list, in_progress); - g_object_notify(G_OBJECT(list), "in-progress"); + g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_IN_PROGRESS]); } gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) @@ -370,25 +372,26 @@ obj_class->get_property = purple_roomlist_get_property; obj_class->set_property = purple_roomlist_set_property; - g_object_class_install_property(obj_class, PROP_ACCOUNT, - g_param_spec_object("account", "Account", + properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", "The account for the room list.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_ACCOUNT, + properties[PROP_ACCOUNT]); - g_object_class_install_property(obj_class, PROP_FIELDS, - g_param_spec_pointer("fields", "Fields", + properties[PROP_FIELDS] = g_param_spec_pointer("fields", "Fields", "The list of fields for a roomlist.", - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_FIELDS, + properties[PROP_FIELDS]); + properties[PROP_IN_PROGRESS] = g_param_spec_boolean("in-progress", + "In progress", + "Whether the room list is being fetched.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_IN_PROGRESS, - g_param_spec_boolean("in-progress", "In progress", - "Whether the room list is being fetched.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + properties[PROP_IN_PROGRESS]); g_type_class_add_private(klass, sizeof(PurpleRoomlistPrivate)); } @@ -482,7 +485,7 @@ break; } - g_object_notify(G_OBJECT(list), "fields"); + g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); } void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room)
--- a/libpurple/status.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/status.c Sun Nov 24 00:33:47 2013 +0530 @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" +#include "glibcompat.h" + #include "buddylist.h" #include "core.h" #include "dbus-maybe.h" @@ -96,6 +98,7 @@ } PurpleStatusBuddyKey; static GObjectClass *parent_class; +static GParamSpec *properties[PROP_LAST]; static int primitive_scores[] = { @@ -592,14 +595,15 @@ old_status = purple_presence_get_active_status(presence); if (old_status != NULL && (old_status != status)) { PURPLE_STATUS_GET_PRIVATE(old_status)->active = FALSE; - g_object_notify(G_OBJECT(old_status), "active"); + g_object_notify_by_pspec(G_OBJECT(old_status), + properties[PROP_ACTIVE]); } } else old_status = NULL; g_object_set(presence, "active-status", status, NULL); - g_object_notify(G_OBJECT(status), "active"); + g_object_notify_by_pspec(G_OBJECT(status), properties[PROP_ACTIVE]); notify_status_update(presence, old_status, status); } @@ -1226,25 +1230,27 @@ obj_class->get_property = purple_status_get_property; obj_class->set_property = purple_status_set_property; - g_object_class_install_property(obj_class, PROP_STATUS_TYPE, - g_param_spec_pointer("status-type", "Status type", + properties[PROP_STATUS_TYPE] = g_param_spec_pointer("status-type", + "Status type", "The PurpleStatusType of the status.", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_STATUS_TYPE, + properties[PROP_STATUS_TYPE]); - g_object_class_install_property(obj_class, PROP_PRESENCE, - g_param_spec_object("presence", "Presence", - "The presence that the status belongs to.", PURPLE_TYPE_PRESENCE, + properties[PROP_PRESENCE] = g_param_spec_object("presence", "Presence", + "The presence that the status belongs to.", + PURPLE_TYPE_PRESENCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_PRESENCE, + properties[PROP_PRESENCE]); + properties[PROP_ACTIVE] = g_param_spec_boolean("active", "Active", + "Whether the status is active or not.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_ACTIVE, - g_param_spec_boolean("active", "Active", - "Whether the status is active or not.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + properties[PROP_ACTIVE]); g_type_class_add_private(klass, sizeof(PurpleStatusPrivate)); }
--- a/libpurple/whiteboard.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/whiteboard.c Sun Nov 24 00:33:47 2013 +0530 @@ -22,6 +22,7 @@ */ #include "internal.h" +#include "glibcompat.h" #include "whiteboard.h" #include "prpl.h" @@ -63,6 +64,7 @@ * Globals *****************************************************************************/ static GObjectClass *parent_class; +static GParamSpec *properties[PROP_LAST]; static PurpleWhiteboardUiOps *whiteboard_ui_ops = NULL; /* static PurpleWhiteboardPrplOps *whiteboard_prpl_ops = NULL; */ @@ -114,7 +116,7 @@ priv->state = state; - g_object_notify(G_OBJECT(wb), "state"); + g_object_notify_by_pspec(G_OBJECT(wb), properties[PROP_STATE]); } int purple_whiteboard_get_state(const PurpleWhiteboard *wb) @@ -286,7 +288,7 @@ priv->draw_list = draw_list; - g_object_notify(G_OBJECT(wb), "draw-list"); + g_object_notify_by_pspec(G_OBJECT(wb), properties[PROP_DRAW_LIST]); } void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data) @@ -438,32 +440,32 @@ obj_class->get_property = purple_whiteboard_get_property; obj_class->set_property = purple_whiteboard_set_property; - g_object_class_install_property(obj_class, PROP_STATE, - g_param_spec_int("state", "State", + properties[PROP_STATE] = g_param_spec_int("state", "State", "State of the whiteboard.", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_STATE, + properties[PROP_STATE]); - g_object_class_install_property(obj_class, PROP_ACCOUNT, - g_param_spec_object("account", "Account", + properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", "The whiteboard's account.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_ACCOUNT, + properties[PROP_ACCOUNT]); - g_object_class_install_property(obj_class, PROP_WHO, - g_param_spec_string("who", "Who", + properties[PROP_WHO] = g_param_spec_string("who", "Who", "Who you're drawing with.", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_WHO, + properties[PROP_WHO]); + properties[PROP_DRAW_LIST] = g_param_spec_pointer("draw-list", "Draw list", + "A list of points to draw to the buddy.", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_DRAW_LIST, - g_param_spec_pointer("draw-list", "Draw list", - "A list of points to draw to the buddy.", - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + properties[PROP_DRAW_LIST]); g_type_class_add_private(klass, sizeof(PurpleWhiteboardPrivate)); }
--- a/libpurple/xfer.c Sat Nov 23 23:27:26 2013 +0530 +++ b/libpurple/xfer.c Sun Nov 24 00:33:47 2013 +0530 @@ -23,6 +23,8 @@ * */ #include "internal.h" +#include "glibcompat.h" + #include "dbus-maybe.h" #include "enums.h" #include "xfer.h" @@ -145,6 +147,7 @@ }; static GObjectClass *parent_class; +static GParamSpec *properties[PROP_LAST]; static int purple_xfer_choose_file(PurpleXfer *xfer); @@ -189,7 +192,7 @@ priv->status = status; - g_object_notify(G_OBJECT(xfer), "status"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_STATUS]); if(priv->type == PURPLE_XFER_TYPE_SEND) { switch(status) { @@ -741,7 +744,7 @@ g_free(priv->who); priv->who = g_strdup(who); - g_object_notify(G_OBJECT(xfer), "remote-user"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_REMOTE_USER]); } const char * @@ -904,7 +907,7 @@ priv->fd = fd; - g_object_notify(G_OBJECT(xfer), "fd"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_FD]); } void purple_xfer_set_watcher(PurpleXfer *xfer, int watcher) @@ -915,7 +918,7 @@ priv->watcher = watcher; - g_object_notify(G_OBJECT(xfer), "watcher"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_WATCHER]); } void @@ -976,7 +979,7 @@ g_free(priv->message); priv->message = g_strdup(message); - g_object_notify(G_OBJECT(xfer), "message"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_MESSAGE]); } const char * @@ -999,7 +1002,7 @@ g_free(priv->filename); priv->filename = g_strdup(filename); - g_object_notify(G_OBJECT(xfer), "filename"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_FILENAME]); } void @@ -1012,7 +1015,7 @@ g_free(priv->local_filename); priv->local_filename = g_strdup(filename); - g_object_notify(G_OBJECT(xfer), "local-filename"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_LOCAL_FILENAME]); } void @@ -1025,7 +1028,7 @@ priv->size = size; priv->bytes_remaining = priv->size - purple_xfer_get_bytes_sent(xfer); - g_object_notify(G_OBJECT(xfer), "file-size"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_FILE_SIZE]); } void @@ -1037,7 +1040,7 @@ priv->local_port = local_port; - g_object_notify(G_OBJECT(xfer), "local-port"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_LOCAL_PORT]); } void @@ -1052,7 +1055,7 @@ if (purple_xfer_get_size(xfer) > 0) priv->bytes_remaining = purple_xfer_get_size(xfer) - bytes_sent; - g_object_notify(G_OBJECT(xfer), "bytes-sent"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_BYTES_SENT]); } PurpleXferUiOps * @@ -1516,7 +1519,7 @@ priv->start_time = time(NULL); - g_object_notify(G_OBJECT(xfer), "start-time"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_START_TIME]); if (priv->ops.start != NULL) priv->ops.start(xfer); @@ -1615,8 +1618,8 @@ obj = G_OBJECT(xfer); g_object_freeze_notify(obj); - g_object_notify(obj, "remote-ip"); - g_object_notify(obj, "remote-port"); + g_object_notify_by_pspec(obj, properties[PROP_REMOTE_IP]); + g_object_notify_by_pspec(obj, properties[PROP_REMOTE_PORT]); g_object_thaw_notify(obj); /* Establish a file descriptor. */ @@ -1653,7 +1656,7 @@ priv->end_time = time(NULL); - g_object_notify(G_OBJECT(xfer), "end-time"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_END_TIME]); if (priv->ops.end != NULL) priv->ops.end(xfer); @@ -1713,7 +1716,7 @@ purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); priv->end_time = time(NULL); - g_object_notify(G_OBJECT(xfer), "end-time"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_END_TIME]); if (purple_xfer_get_filename(xfer) != NULL) { @@ -1776,7 +1779,7 @@ purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); priv->end_time = time(NULL); - g_object_notify(G_OBJECT(xfer), "end-time"); + g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_END_TIME]); account = purple_xfer_get_account(xfer); buddy = purple_blist_find_buddy(account, priv->who); @@ -2178,99 +2181,102 @@ obj_class->get_property = purple_xfer_get_property; obj_class->set_property = purple_xfer_set_property; - g_object_class_install_property(obj_class, PROP_TYPE, - g_param_spec_enum("type", "Transfer type", + properties[PROP_TYPE] = g_param_spec_enum("type", "Transfer type", "The type of file transfer.", PURPLE_TYPE_XFER_TYPE, PURPLE_XFER_TYPE_UNKNOWN, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_ACCOUNT, - g_param_spec_object("account", "Account", + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_TYPE, + properties[PROP_TYPE]); + + properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", "The account sending or receiving the file.", PURPLE_TYPE_ACCOUNT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_REMOTE_USER, - g_param_spec_string("remote-user", "Remote user", + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_ACCOUNT, + properties[PROP_ACCOUNT]); + + properties[PROP_REMOTE_USER] = g_param_spec_string("remote-user", + "Remote user", "The name of the remote user.", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_MESSAGE, - g_param_spec_string("message", "Message", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_REMOTE_USER, + properties[PROP_REMOTE_USER]); + + properties[PROP_MESSAGE] = g_param_spec_string("message", "Message", "The message for the file transfer.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_FILENAME, - g_param_spec_string("filename", "Filename", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_MESSAGE, + properties[PROP_MESSAGE]); + + properties[PROP_FILENAME] = g_param_spec_string("filename", "Filename", "The filename for the file transfer.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_LOCAL_FILENAME, - g_param_spec_string("local-filename", "Local filename", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_FILENAME, + properties[PROP_FILENAME]); + + properties[PROP_LOCAL_FILENAME] = g_param_spec_string("local-filename", + "Local filename", "The local filename for the file transfer.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_FILE_SIZE, - g_param_spec_int64("file-size", "File size", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_LOCAL_FILENAME, + properties[PROP_LOCAL_FILENAME]); + + properties[PROP_FILE_SIZE] = g_param_spec_int64("file-size", "File size", "Size of the file in a file transfer.", G_MININT64, G_MAXINT64, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_REMOTE_IP, - g_param_spec_string("remote-ip", "Remote IP", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_FILE_SIZE, + properties[PROP_FILE_SIZE]); + + properties[PROP_REMOTE_IP] = g_param_spec_string("remote-ip", "Remote IP", "The remote IP address in the file transfer.", NULL, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_LOCAL_PORT, - g_param_spec_int("local-port", "Local port", + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_REMOTE_IP, + properties[PROP_REMOTE_IP]); + + properties[PROP_LOCAL_PORT] = g_param_spec_int("local-port", "Local port", "The local port number in the file transfer.", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_REMOTE_PORT, - g_param_spec_int("remote-port", "Remote port", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_LOCAL_PORT, + properties[PROP_LOCAL_PORT]); + + properties[PROP_REMOTE_PORT] = g_param_spec_int("remote-port", + "Remote port", "The remote port number in the file transfer.", G_MININT, G_MAXINT, 0, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_FD, - g_param_spec_int("fd", "Socket FD", + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_REMOTE_PORT, + properties[PROP_REMOTE_PORT]); + + properties[PROP_FD] = g_param_spec_int("fd", "Socket FD", "The socket file descriptor.", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_WATCHER, - g_param_spec_int("watcher", "Watcher", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_FD, + properties[PROP_FD]); + + properties[PROP_WATCHER] = g_param_spec_int("watcher", "Watcher", "The watcher for the file transfer.", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_BYTES_SENT, - g_param_spec_int64("bytes-sent", "Bytes sent", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_WATCHER, + properties[PROP_WATCHER]); + + properties[PROP_BYTES_SENT] = g_param_spec_int64("bytes-sent", "Bytes sent", "The number of bytes sent (or received) so far.", G_MININT64, G_MAXINT64, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_START_TIME, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_BYTES_SENT, + properties[PROP_BYTES_SENT]); + + properties[PROP_START_TIME] = #if SIZEOF_TIME_T == 4 - g_param_spec_int + g_param_spec_int #elif SIZEOF_TIME_T == 8 - g_param_spec_int64 + g_param_spec_int64 #else #error Unknown size of time_t #endif @@ -2283,14 +2289,15 @@ #else #error Unknown size of time_t #endif - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_END_TIME, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_START_TIME, + properties[PROP_START_TIME]); + + properties[PROP_END_TIME] = #if SIZEOF_TIME_T == 4 - g_param_spec_int + g_param_spec_int #elif SIZEOF_TIME_T == 8 - g_param_spec_int64 + g_param_spec_int64 #else #error Unknown size of time_t #endif @@ -2303,15 +2310,16 @@ #else #error Unknown size of time_t #endif - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) - ); - - g_object_class_install_property(obj_class, PROP_STATUS, - g_param_spec_enum("status", "Status", + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_END_TIME, + properties[PROP_END_TIME]); + + properties[PROP_STATUS] = g_param_spec_enum("status", "Status", "The current status for the file transfer.", PURPLE_TYPE_XFER_STATUS, PURPLE_XFER_STATUS_UNKNOWN, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) - ); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(obj_class, PROP_STATUS, + properties[PROP_STATUS]); g_type_class_add_private(klass, sizeof(PurpleXferPrivate)); }