pidgin: 9f78d43f: Use the new accessor functions.

andrew.victor at mxit.com andrew.victor at mxit.com
Fri Aug 26 17:31:03 EDT 2011


----------------------------------------------------------------------
Revision: 9f78d43fc430627c3810b8ec389a5e7d0d354dd2
Parent:   7e210cba3741f80537f99775f9b0676666fcf41c
Author:   andrew.victor at mxit.com
Date:     08/26/11 17:09:27
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9f78d43fc430627c3810b8ec389a5e7d0d354dd2

Changelog: 

Use the new accessor functions.
FINCH_GET_DATA() and FINCH_CONV() were both used to do the same thing
 for a PurpleConversation, so standardize on FINCH_CONV().


Changes against parent 7e210cba3741f80537f99775f9b0676666fcf41c

  patched  finch/gntblist.c
  patched  finch/gntconv.c
  patched  finch/gntconv.h
  patched  finch/plugins/gntgf.c
  patched  finch/plugins/lastlog.c

-------------- next part --------------
============================================================
--- finch/gntblist.c	31b88d14b2571e126fffb572f157242e2553d18d
+++ finch/gntblist.c	483ab5c2a24b0f337670d51577741dfc6ec6c4df
@@ -1060,7 +1060,7 @@ selection_activate(GntWidget *widget, Fi
 						purple_buddy_get_account(buddy),
 						purple_buddy_get_name(buddy));
 		} else {
-			FinchConv *ggconv = FINCH_GET_DATA(conv);
+			FinchConv *ggconv = FINCH_CONV(conv);
 			gnt_window_present(ggconv->window);
 		}
 		finch_conversation_set_active(conv);
============================================================
--- finch/gntconv.c	311404c18dc02e5c09fecb58d100c6006530cdfa
+++ finch/gntconv.c	b425f1c8d2bbd6eeb4b57fdf07a5e9a6bdc875e9
@@ -282,7 +282,7 @@ update_buddy_typing(PurpleAccount *accou
 		return;
 
 	im = PURPLE_CONV_IM(conv);
-	ggc = FINCH_GET_DATA(conv);
+	ggc = FINCH_CONV(conv);
 
 	if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
 		int scroll;
@@ -321,7 +321,7 @@ buddy_signed_on_off(PurpleBuddy *buddy, 
 	PurpleConversation *conv = find_conv_with_contact(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
 	if (conv == NULL)
 		return;
-	generate_send_to_menu(FINCH_GET_DATA(conv));
+	generate_send_to_menu(FINCH_CONV(conv));
 }
 
 static void
@@ -333,7 +333,7 @@ account_signed_on_off(PurpleConnection *
 		PurpleConversation *cc = find_conv_with_contact(
 				purple_conversation_get_account(conv), purple_conversation_get_name(conv));
 		if (cc)
-			generate_send_to_menu(FINCH_GET_DATA(cc));
+			generate_send_to_menu(FINCH_CONV(cc));
 		list = list->next;
 	}
 
@@ -398,7 +398,7 @@ cleared_message_history_cb(PurpleConvers
 static void
 cleared_message_history_cb(PurpleConversation *conv, gpointer data)
 {
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	if (ggc)
 		gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv));
 }
@@ -749,7 +749,7 @@ finch_create_conversation(PurpleConversa
 static void
 finch_create_conversation(PurpleConversation *conv)
 {
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	char *title;
 	PurpleConversationType type;
 	PurpleConversation *cc;
@@ -763,8 +763,8 @@ finch_create_conversation(PurpleConversa
 
 	account = purple_conversation_get_account(conv);
 	cc = find_conv_with_contact(account, purple_conversation_get_name(conv));
-	if (cc && FINCH_GET_DATA(cc))
-		ggc = FINCH_GET_DATA(cc);
+	if (cc && FINCH_CONV(cc))
+		ggc = FINCH_CONV(cc);
 	else
 		ggc = g_new0(FinchConv, 1);
 
@@ -776,9 +776,9 @@ finch_create_conversation(PurpleConversa
 
 	ggc->list = g_list_prepend(ggc->list, conv);
 	ggc->active_conv = conv;
-	FINCH_SET_DATA(conv, ggc);
+	purple_conversation_set_ui_data(conv, ggc);
 
-	if (cc && FINCH_GET_DATA(cc) && cc != conv) {
+	if (cc && FINCH_CONV(cc) && cc != conv) {
 		finch_conversation_set_active(conv);
 		return;
 	}
@@ -885,7 +885,7 @@ finch_destroy_conversation(PurpleConvers
 finch_destroy_conversation(PurpleConversation *conv)
 {
 	/* do stuff here */
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	ggc->list = g_list_remove(ggc->list, conv);
 	if (ggc->list && conv == ggc->active_conv) {
 		ggc->active_conv = ggc->list->data;
@@ -905,7 +905,7 @@ finch_write_common(PurpleConversation *c
 finch_write_common(PurpleConversation *conv, const char *who, const char *message,
 		PurpleMessageFlags flags, time_t mtime)
 {
-	FinchConv *ggconv = FINCH_GET_DATA(conv);
+	FinchConv *ggconv = FINCH_CONV(conv);
 	char *strip, *newline;
 	GntTextFormatFlags fl = 0;
 	int pos;
@@ -1069,7 +1069,7 @@ finch_chat_add_users(PurpleConversation 
 static void
 finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arrivals)
 {
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	GntEntry *entry = GNT_ENTRY(ggc->entry);
 
 	if (!new_arrivals)
@@ -1111,7 +1111,7 @@ finch_chat_rename_user(PurpleConversatio
 finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a)
 {
 	/* Update the name for string completion */
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	GntEntry *entry = GNT_ENTRY(ggc->entry);
 	GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
 	PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), new_n);
@@ -1129,7 +1129,7 @@ finch_chat_remove_users(PurpleConversati
 finch_chat_remove_users(PurpleConversation *conv, GList *list)
 {
 	/* Remove the name from string completion */
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	GntEntry *entry = GNT_ENTRY(ggc->entry);
 	for (; list; list = list->next) {
 		GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
@@ -1142,7 +1142,7 @@ finch_chat_update_user(PurpleConversatio
 finch_chat_update_user(PurpleConversation *conv, const char *user)
 {
 	PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user);
-	FinchConv *ggc = FINCH_GET_DATA(conv);
+	FinchConv *ggc = FINCH_CONV(conv);
 	gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags));
 }
 
@@ -1368,7 +1368,7 @@ users_command_cb(PurpleConversation *con
 static PurpleCmdRet
 users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data)
 {
-	FinchConv *fc = FINCH_GET_DATA(conv);
+	FinchConv *fc = FINCH_CONV(conv);
 	FinchConvChat *ch;
 	if (!fc)
 		return PURPLE_CMD_RET_FAILED;
@@ -1494,7 +1494,7 @@ void finch_conversation_set_active(Purpl
 
 void finch_conversation_set_active(PurpleConversation *conv)
 {
-	FinchConv *ggconv = FINCH_GET_DATA(conv);
+	FinchConv *ggconv = FINCH_CONV(conv);
 	PurpleAccount *account;
 	char *title;
 
@@ -1513,7 +1513,7 @@ void finch_conversation_set_info_widget(
 
 void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget)
 {
-	FinchConv *fc = FINCH_GET_DATA(conv);
+	FinchConv *fc = FINCH_CONV(conv);
 	int height, width;
 
 	gnt_box_remove_all(GNT_BOX(fc->info));
============================================================
--- finch/gntconv.h	e984893c5c04f0d20fea57943e945c475ce755a6
+++ finch/gntconv.h	810181081f79c10bcb1ca1792013a70b4150a778
@@ -33,7 +33,7 @@
 #include "conversation.h"
 
 /* Grabs the conv out of a PurpleConverstation */
-#define FINCH_CONV(conv) ((FinchConv *)(conv)->ui_data)
+#define FINCH_CONV(conv) ((FinchConv *)purple_conversation_get_ui_data(conv))
 
 /***************************************************************************
  * @name GNT Conversations API
============================================================
--- finch/plugins/gntgf.c	fa5f65ff1d57f6c8b481b70d4ba43366b2b5236a
+++ finch/plugins/gntgf.c	f14b3bb901aa57f2ddc811e2174aa3c632bda0c4
@@ -168,7 +168,7 @@ notify(PurpleConversation *conv, const c
 		beep();
 
 	if (conv != NULL) {
-		FinchConv *fc = conv->ui_data;
+		FinchConv *fc = FINCH_CONV(conv);
 		if (gnt_widget_has_focus(fc->window))
 			return;
 	}
============================================================
--- finch/plugins/lastlog.c	41065a9a8c4cf003e63eface0094670ea996a996
+++ finch/plugins/lastlog.c	80586774594a10ab75c819027a5210ddea0adb3b
@@ -60,7 +60,7 @@ lastlog_cb(PurpleConversation *conv, con
 static PurpleCmdRet
 lastlog_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer null)
 {
-	FinchConv *ggconv = conv->ui_data;
+	FinchConv *ggconv = FINCH_CONV(conv);
 	char **strings = g_strsplit(GNT_TEXT_VIEW(ggconv->tv)->string->str, "\n", 0);
 	GntWidget *win, *tv;
 	int i, j;


More information about the Commits mailing list