/soc/2013/ankitkv/gobjectification: da607046d658: Backed out cha...
Ankit Vani
a at nevitus.org
Fri Jul 19 12:29:30 EDT 2013
Changeset: da607046d658abd7219cb9be96d68528998f1ccb
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-19 21:52 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/da607046d658
Description:
Backed out changeset d9b286af48ba
diffstat:
libpurple/blistnodetypes.c | 17 ++++++++++-------
libpurple/conversationtypes.c | 19 +++++++++++--------
libpurple/plugins/perl/common/BuddyIcon.xs | 8 ++++++++
pidgin/gtkblist.c | 2 +-
4 files changed, 30 insertions(+), 16 deletions(-)
diffs (154 lines):
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -155,8 +155,8 @@ purple_buddy_set_icon(PurpleBuddy *buddy
if (priv->icon != icon)
{
- g_object_unref(priv->icon);
- priv->icon = (icon != NULL ? g_object_ref(icon) : NULL);
+ purple_buddy_icon_unref(priv->icon);
+ priv->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL);
}
purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy);
@@ -549,7 +549,8 @@ purple_buddy_set_property(GObject *obj,
purple_buddy_set_server_alias(buddy, g_value_get_string(value));
break;
case BUDDY_PROP_ICON:
- purple_buddy_set_icon(buddy, g_value_get_object(value));
+#warning TODO: change get_pointer to get_object when PurpleBuddyIcon is a GObject
+ purple_buddy_set_icon(buddy, g_value_get_pointer(value));
break;
case BUDDY_PROP_ACCOUNT:
priv->account = g_value_get_object(value);
@@ -581,7 +582,8 @@ purple_buddy_get_property(GObject *obj,
g_value_set_string(value, purple_buddy_get_server_alias(buddy));
break;
case BUDDY_PROP_ICON:
- g_value_set_object(value, purple_buddy_get_icon(buddy));
+#warning TODO: change set_pointer to set_object when PurpleBuddyIcon is a GObject
+ g_value_set_pointer(value, purple_buddy_get_icon(buddy));
break;
case BUDDY_PROP_ACCOUNT:
g_value_set_object(value, purple_buddy_get_account(buddy));
@@ -644,7 +646,7 @@ purple_buddy_dispose(GObject *object)
}
/* Delete the node */
- g_object_unref(priv->icon);
+ purple_buddy_icon_unref(priv->icon);
purple_presence_destroy(priv->presence);
PURPLE_DBUS_UNREGISTER_POINTER(buddy);
@@ -698,9 +700,10 @@ static void purple_buddy_class_init(Purp
G_PARAM_READWRITE)
);
+#warning TODO: change spec_pointer to spec_object when PurpleBuddyIcon is a GObject
g_object_class_install_property(obj_class, BUDDY_PROP_ICON,
- g_param_spec_object(BUDDY_PROP_ICON_S, _("Buddy icon"),
- _("The icon for the buddy."), PURPLE_TYPE_BUDDY_ICON,
+ g_param_spec_pointer(BUDDY_PROP_ICON_S, _("Buddy icon"),
+ _("The icon for the buddy."),
G_PARAM_READWRITE)
);
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -179,9 +179,9 @@ purple_im_conversation_set_icon(PurpleIM
if (priv->icon != icon)
{
- g_object_unref(priv->icon);
+ purple_buddy_icon_unref(priv->icon);
- priv->icon = (icon == NULL ? NULL : g_object_ref(icon));
+ priv->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon));
}
purple_conversation_update(PURPLE_CONVERSATION(im),
@@ -390,8 +390,9 @@ purple_im_conversation_set_property(GObj
case IM_PROP_TYPING_STATE:
purple_im_conversation_set_typing_state(im, g_value_get_enum(value));
break;
+#warning TODO: change get_pointer to get_object when PurpleBuddyIcon is a GObject
case IM_PROP_ICON:
- purple_im_conversation_set_icon(im, g_value_get_object(value));
+ purple_im_conversation_set_icon(im, g_value_get_pointer(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -410,8 +411,9 @@ purple_im_conversation_get_property(GObj
case IM_PROP_TYPING_STATE:
g_value_set_enum(value, purple_im_conversation_get_typing_state(im));
break;
+#warning TODO: change set_pointer to set_object when PurpleBuddyIcon is a GObject
case IM_PROP_ICON:
- g_value_set_object(value, purple_im_conversation_get_icon(im));
+ g_value_set_pointer(value, purple_im_conversation_get_icon(im));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -439,7 +441,7 @@ purple_im_conversation_constructed(GObje
{
purple_im_conversation_set_icon(im, icon);
/* purple_im_conversation_set_icon refs the icon. */
- g_object_unref(icon);
+ purple_buddy_icon_unref(icon);
}
if (purple_prefs_get_bool("/purple/logging/log_ims"))
@@ -482,7 +484,7 @@ purple_im_conversation_finalize(GObject
PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object);
PurpleIMConversationPrivate *priv = PURPLE_IM_CONVERSATION_GET_PRIVATE(im);
- g_object_unref(priv->icon);
+ purple_buddy_icon_unref(priv->icon);
priv->icon = NULL;
G_OBJECT_CLASS(parent_class)->finalize(object);
@@ -513,9 +515,10 @@ static void purple_im_conversation_class
G_PARAM_READWRITE)
);
+#warning TODO: change spec_pointer to spec_object when PurpleBuddyIcon is a GObject
g_object_class_install_property(obj_class, IM_PROP_ICON,
- g_param_spec_object(IM_PROP_ICON_S, _("Buddy icon"),
- _("The buddy icon for the IM."), PURPLE_TYPE_BUDDY_ICON,
+ g_param_spec_pointer(IM_PROP_ICON_S, _("Buddy icon"),
+ _("The buddy icon for the IM."),
G_PARAM_READWRITE)
);
diff --git a/libpurple/plugins/perl/common/BuddyIcon.xs b/libpurple/plugins/perl/common/BuddyIcon.xs
--- a/libpurple/plugins/perl/common/BuddyIcon.xs
+++ b/libpurple/plugins/perl/common/BuddyIcon.xs
@@ -3,6 +3,14 @@
MODULE = Purple::Buddy::Icon PACKAGE = Purple::Buddy::Icon PREFIX = purple_buddy_icon_
PROTOTYPES: ENABLE
+Purple::Buddy::Icon
+purple_buddy_icon_ref(icon)
+ Purple::Buddy::Icon icon
+
+void
+purple_buddy_icon_unref(icon)
+ Purple::Buddy::Icon icon
+
void
purple_buddy_icon_update(icon)
Purple::Buddy::Icon icon
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -2731,7 +2731,7 @@ static GdkPixbuf *pidgin_blist_get_buddy
}
buf = pidgin_pixbuf_from_data(data, len);
- g_object_unref(icon);
+ purple_buddy_icon_unref(icon);
if (!buf) {
purple_debug_warning("gtkblist", "Couldn't load buddy icon "
"on account %s (%s) buddyname=%s "
More information about the Commits
mailing list