/soc/2013/ankitkv/gobjectification: 313dd8fa6b2f: Removed purple...

Ankit Vani a at nevitus.org
Sat Jun 29 10:42:20 EDT 2013


Changeset: 313dd8fa6b2f04c9a3a67c5010b7b2e06d04086b
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-29 20:12 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/313dd8fa6b2f

Description:

Removed purple_chat_user_[set,get]_ui_data(). Used g_object_[set,get]_data() instead.
Removed ui_data member of PurpleChatUserPrivate.

diffstat:

 libpurple/conversationtypes.c |  25 -------------------------
 libpurple/conversationtypes.h |  19 -------------------
 pidgin/gtkconv.c              |  20 ++++++++++----------
 3 files changed, 10 insertions(+), 54 deletions(-)

diffs (141 lines):

diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -133,9 +133,6 @@ struct _PurpleChatUserPrivate
 	 * user\@host, etc.
 	 */
 	GHashTable *attributes;
-
-	/** The UI can put whatever it wants here. */
-	gpointer ui_data;
 };
 
 /* Chat User Property enums */
@@ -1851,28 +1848,6 @@ purple_chat_user_set_attributes(PurpleCh
 }
 
 void
-purple_chat_user_set_ui_data(PurpleChatUser *cb, gpointer ui_data)
-{
-	PurpleChatUserPrivate *priv;
-	priv = PURPLE_CHAT_USER_GET_PRIVATE(cb);
-
-	g_return_if_fail(priv != NULL);
-
-	priv->ui_data = ui_data;
-}
-
-gpointer
-purple_chat_user_get_ui_data(const PurpleChatUser *cb)
-{
-	PurpleChatUserPrivate *priv;
-	priv = PURPLE_CHAT_USER_GET_PRIVATE(cb);
-
-	g_return_val_if_fail(priv != NULL, NULL);
-
-	return priv->ui_data;
-}
-
-void
 purple_chat_user_set_chat(PurpleChatUser *cb,
 		PurpleChatConversation *chat)
 {
diff --git a/libpurple/conversationtypes.h b/libpurple/conversationtypes.h
--- a/libpurple/conversationtypes.h
+++ b/libpurple/conversationtypes.h
@@ -681,25 +681,6 @@ PurpleChatUser *purple_chat_user_new(Pur
 		const char *name, const char *alias, PurpleChatUserFlags flags);
 
 /**
- * Set the UI data associated with this chat user.
- *
- * @param cb			The chat user
- * @param ui_data		A pointer to associate with this chat user.
- */
-void purple_chat_user_set_ui_data(PurpleChatUser *cb, gpointer ui_data);
-
-/**
- * Get the UI data associated with this chat user.
- *
- * @param cb			The chat user.
- *
- * @return The UI data associated with this chat user.  This is a
- *         convenience field provided to the UIs--it is not
- *         used by the libpurple core.
- */
-gpointer purple_chat_user_get_ui_data(const PurpleChatUser *cb);
-
-/**
  * Get the alias of a chat user
  *
  * @param cb    The chat user.
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -4119,11 +4119,11 @@ get_chat_user_status_icon(PurpleChatConv
 static void
 deleting_chat_user_cb(PurpleChatUser *cb)
 {
-	GtkTreeRowReference *ref = purple_chat_user_get_ui_data(cb);
+	GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(cb), "gtk-row");
 
 	if (ref) {
 		gtk_tree_row_reference_free(ref);
-		purple_chat_user_set_ui_data(cb, NULL);
+		g_object_set_data(G_OBJECT(cb), "gtk-row", NULL);
 	}
 }
 
@@ -4208,13 +4208,13 @@ add_chat_user_common(PurpleChatConversat
 			CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
 			-1);
 
-	if (purple_chat_user_get_ui_data(cb)) {
-		GtkTreeRowReference *ref = purple_chat_user_get_ui_data(cb);
+	if (g_object_get_data(G_OBJECT(cb), "gtk-row")) {
+		GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(cb), "gtk-row");
 		gtk_tree_row_reference_free(ref);
 	}
 
 	newpath = gtk_tree_model_get_path(tm, &iter);
-	purple_chat_user_set_ui_data(cb, gtk_tree_row_reference_new(tm, newpath));
+	g_object_set_data(G_OBJECT(cb), "gtk-row", gtk_tree_row_reference_new(tm, newpath));
 	gtk_tree_path_free(newpath);
 
 	if (is_me && color)
@@ -6763,7 +6763,7 @@ static gboolean get_iter_from_chatuser(P
 
 	g_return_val_if_fail(cb != NULL, FALSE);
 
-	ref = purple_chat_user_get_ui_data(cb);
+	ref = g_object_get_data(G_OBJECT(cb), "gtk-row");
 	if (!ref)
 		return FALSE;
 
@@ -6850,11 +6850,11 @@ pidgin_conv_chat_rename_user(PurpleChatC
 		return;
 
 	if (get_iter_from_chatuser(old_chatuser, &iter)) {
-		GtkTreeRowReference *ref = purple_chat_user_get_ui_data(old_chatuser);
+		GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(old_chatuser), "gtk-row");
 
 		gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 		gtk_tree_row_reference_free(ref);
-		purple_chat_user_set_ui_data(old_chatuser, NULL);
+		g_object_set_data(G_OBJECT(old_chatuser), "gtk-row", NULL);
 	}
 
 	g_return_if_fail(new_alias != NULL);
@@ -6939,10 +6939,10 @@ pidgin_conv_chat_update_user(PurpleChatU
 		return;
 
 	if (get_iter_from_chatuser(chatuser, &iter)) {
-		GtkTreeRowReference *ref = purple_chat_user_get_ui_data(chatuser);
+		GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(chatuser), "gtk-row");
 		gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 		gtk_tree_row_reference_free(ref);
-		purple_chat_user_set_ui_data(chatuser, NULL);
+		g_object_set_data(G_OBJECT(chatuser), "gtk-row", NULL);
 	}
 
 	if (chatuser)



More information about the Commits mailing list