diff finch/gntconv.c @ 22217:ad357ca94de9

We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 26 Jan 2008 22:33:08 +0000
parents 07c2b8fa7bb4
children 797230b3e48e
line wrap: on
line diff
--- a/finch/gntconv.c	Sat Jan 26 21:58:51 2008 +0000
+++ b/finch/gntconv.c	Sat Jan 26 22:33:08 2008 +0000
@@ -282,7 +282,7 @@
 		return;
 
 	im = PURPLE_CONV_IM(conv);
-	ggc = conv->ui_data;
+	ggc = FINCH_GET_DATA(conv);
 
 	if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
 		int scroll;
@@ -321,7 +321,7 @@
 	PurpleConversation *conv = find_conv_with_contact(buddy->account, buddy->name);
 	if (conv == NULL)
 		return;
-	generate_send_to_menu(conv->ui_data);
+	generate_send_to_menu(FINCH_GET_DATA(conv));
 }
 
 static void
@@ -333,7 +333,7 @@
 		PurpleConversation *cc = find_conv_with_contact(
 				purple_conversation_get_account(conv), purple_conversation_get_name(conv));
 		if (cc)
-			generate_send_to_menu(cc->ui_data);
+			generate_send_to_menu(FINCH_GET_DATA(cc));
 		list = list->next;
 	}
 
@@ -610,7 +610,7 @@
 static void
 finch_create_conversation(PurpleConversation *conv)
 {
-	FinchConv *ggc = conv->ui_data;
+	FinchConv *ggc = FINCH_GET_DATA(conv);
 	char *title;
 	PurpleConversationType type;
 	PurpleConversation *cc;
@@ -622,8 +622,8 @@
 
 	account = purple_conversation_get_account(conv);
 	cc = find_conv_with_contact(account, purple_conversation_get_name(conv));
-	if (cc && cc->ui_data)
-		ggc = cc->ui_data;
+	if (cc && FINCH_GET_DATA(cc))
+		ggc = FINCH_GET_DATA(cc);
 	else
 		ggc = g_new0(FinchConv, 1);
 
@@ -635,9 +635,9 @@
 
 	ggc->list = g_list_prepend(ggc->list, conv);
 	ggc->active_conv = conv;
-	conv->ui_data = ggc;
+	FINCH_SET_DATA(conv, ggc);
 
-	if (cc && cc->ui_data) {
+	if (cc && FINCH_GET_DATA(cc)) {
 		finch_conversation_set_active(conv);
 		return;
 	}
@@ -738,7 +738,7 @@
 finch_destroy_conversation(PurpleConversation *conv)
 {
 	/* do stuff here */
-	FinchConv *ggc = conv->ui_data;
+	FinchConv *ggc = FINCH_GET_DATA(conv);
 	ggc->list = g_list_remove(ggc->list, conv);
 	if (ggc->list && conv == ggc->active_conv)
 		ggc->active_conv = ggc->list->data;
@@ -755,7 +755,7 @@
 finch_write_common(PurpleConversation *conv, const char *who, const char *message,
 		PurpleMessageFlags flags, time_t mtime)
 {
-	FinchConv *ggconv = conv->ui_data;
+	FinchConv *ggconv = FINCH_GET_DATA(conv);
 	char *strip, *newline;
 	GntTextFormatFlags fl = 0;
 	int pos;
@@ -908,7 +908,7 @@
 static void
 finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arrivals)
 {
-	FinchConv *ggc = conv->ui_data;
+	FinchConv *ggc = FINCH_GET_DATA(conv);
 	GntEntry *entry = GNT_ENTRY(ggc->entry);
 
 	if (!new_arrivals)
@@ -947,7 +947,7 @@
 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 = conv->ui_data;
+	FinchConv *ggc = FINCH_GET_DATA(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);
@@ -965,7 +965,7 @@
 finch_chat_remove_users(PurpleConversation *conv, GList *list)
 {
 	/* Remove the name from string completion */
-	FinchConv *ggc = conv->ui_data;
+	FinchConv *ggc = FINCH_GET_DATA(conv);
 	GntEntry *entry = GNT_ENTRY(ggc->entry);
 	for (; list; list = list->next) {
 		GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
@@ -978,7 +978,7 @@
 finch_chat_update_user(PurpleConversation *conv, const char *user)
 {
 	PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user);
-	FinchConv *ggc = conv->ui_data;
+	FinchConv *ggc = FINCH_GET_DATA(conv);
 	gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags));
 }
 
@@ -1087,7 +1087,7 @@
 clear_command_cb(PurpleConversation *conv,
                  const char *cmd, char **args, char **error, void *data)
 {
-	FinchConv *ggconv = conv->ui_data;
+	FinchConv *ggconv = FINCH_GET_DATA(conv);
 	gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv));
 	purple_conversation_clear_message_history(conv);
 	return PURPLE_CMD_STATUS_OK;
@@ -1144,7 +1144,7 @@
 static PurpleCmdRet
 users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data)
 {
-	FinchConv *fc = conv->ui_data;
+	FinchConv *fc = FINCH_GET_DATA(conv);
 	FinchConvChat *ch;
 	if (!fc)
 		return PURPLE_CMD_STATUS_FAILED;
@@ -1248,7 +1248,7 @@
 
 void finch_conversation_set_active(PurpleConversation *conv)
 {
-	FinchConv *ggconv = conv->ui_data;
+	FinchConv *ggconv = FINCH_GET_DATA(conv);
 	PurpleAccount *account;
 	char *title;
 
@@ -1264,7 +1264,7 @@
 
 void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget)
 {
-	FinchConv *fc = conv->ui_data;
+	FinchConv *fc = FINCH_GET_DATA(conv);
 	int height, width;
 
 	gnt_box_remove_all(GNT_BOX(fc->info));