im.pidgin.pidgin: 9c853a2a1aebad6b032788dd18ee9ef325617e34
sadrul at pidgin.im
sadrul at pidgin.im
Sat Jan 26 17:40:39 EST 2008
-----------------------------------------------------------------
Revision: 9c853a2a1aebad6b032788dd18ee9ef325617e34
Ancestor: 1314c686e3e02d3e53344d942dcd42afce582014
Author: sadrul at pidgin.im
Date: 2008-01-26T22:33:08
Branch: im.pidgin.pidgin
Modified files:
finch/finch.h finch/gntblist.c finch/gntconv.c finch/gntft.c
finch/gntrequest.c finch/gntroomlist.c
ChangeLog:
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
-------------- next part --------------
============================================================
--- finch/finch.h 5c03f18580ab6f0cc4d38e924e675b8ab9ba0fda
+++ finch/finch.h f0061186ee99a03eb6c56f0cf45ef01cf9c58965
@@ -29,3 +29,7 @@
#define FINCH_UI "gnt-purple"
#define FINCH_PREFS_ROOT "/finch"
+
+#define FINCH_GET_DATA(obj) (obj)->ui_data
+#define FINCH_SET_DATA(obj, data) (obj)->ui_data = data
+
============================================================
--- finch/gntblist.c ea20044d5881f50ddd73af7b770b74f26959616a
+++ finch/gntblist.c a8ada6ebaa3db1f92e2ce4c9e02b27d4cfad11b1
@@ -156,7 +156,7 @@ static gboolean default_can_add_node(Pur
if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
PurpleBuddy *buddy = (PurpleBuddy*)node;
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
if (!purple_buddy_get_contact(buddy))
return FALSE; /* When a new buddy is added and show-offline is set */
if (PURPLE_BUDDY_IS_ONLINE(buddy))
@@ -313,11 +313,11 @@ create_finch_blist_node(PurpleBlistNode
static FinchBlistNode *
create_finch_blist_node(PurpleBlistNode *node, gpointer row)
{
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
if (!fnode) {
fnode = g_new0(FinchBlistNode, 1);
fnode->signed_timer = 0;
- node->ui_data = fnode;
+ FINCH_SET_DATA(node, fnode);
}
fnode->row = row;
return fnode;
@@ -326,13 +326,13 @@ reset_blist_node_ui_data(PurpleBlistNode
static void
reset_blist_node_ui_data(PurpleBlistNode *node)
{
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
if (fnode == NULL)
return;
if (fnode->signed_timer)
purple_timeout_remove(fnode->signed_timer);
g_free(fnode);
- node->ui_data = NULL;
+ FINCH_SET_DATA(node, NULL);
}
static int
@@ -365,7 +365,7 @@ get_blist_node_flag(PurpleBlistNode *nod
get_blist_node_flag(PurpleBlistNode *node)
{
GntTextFormatFlags flag = 0;
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
if (ggblist->tagged && g_list_find(ggblist->tagged, node))
flag |= GNT_TEXT_FLAG_BOLD;
@@ -374,7 +374,7 @@ get_blist_node_flag(PurpleBlistNode *nod
flag |= GNT_TEXT_FLAG_BLINK;
else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact *)node);
- fnode = node->ui_data;
+ fnode = FINCH_GET_DATA(node);
if (fnode && fnode->signed_timer)
flag |= GNT_TEXT_FLAG_BLINK;
}
@@ -396,7 +396,7 @@ is_contact_online(PurpleContact *contact
PurpleBlistNode *node;
for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node;
node = purple_blist_node_get_sibling_next(node)) {
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) ||
(fnode && fnode->signed_timer))
return TRUE;
@@ -428,7 +428,7 @@ add_node(PurpleBlistNode *node, FinchBli
static void
add_node(PurpleBlistNode *node, FinchBlist *ggblist)
{
- if (node->ui_data)
+ if (FINCH_GET_DATA(node))
return;
if (!ggblist->manager->can_add_node(node))
@@ -462,10 +462,10 @@ node_remove(PurpleBuddyList *list, Purpl
static void
node_remove(PurpleBuddyList *list, PurpleBlistNode *node)
{
- FinchBlist *ggblist = list->ui_data;
+ FinchBlist *ggblist = FINCH_GET_DATA(list);
PurpleBlistNode *parent;
- if (ggblist == NULL || node->ui_data == NULL)
+ if (ggblist == NULL || FINCH_GET_DATA(node)== NULL)
return;
gnt_tree_remove(GNT_TREE(ggblist->tree), node);
@@ -496,13 +496,13 @@ node_update(PurpleBuddyList *list, Purpl
happens, so maybe someone will figure it out. */
g_return_if_fail(node != NULL);
- if (list->ui_data == NULL)
+ if (FINCH_GET_DATA(list)== NULL)
return; /* XXX: this is probably the place to auto-join chats */
if (ggblist->window == NULL)
return;
- if (node->ui_data != NULL) {
+ if (FINCH_GET_DATA(node)!= NULL) {
gnt_tree_change_text(GNT_TREE(ggblist->tree), node,
0, get_display_name(node));
gnt_tree_sort_row(GNT_TREE(ggblist->tree), node);
@@ -514,21 +514,21 @@ node_update(PurpleBuddyList *list, Purpl
if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
PurpleBuddy *buddy = (PurpleBuddy*)node;
- add_node((PurpleBlistNode*)buddy, list->ui_data);
+ add_node((PurpleBlistNode*)buddy, FINCH_GET_DATA(list));
node_update(list, purple_blist_node_get_parent(node));
} else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
- add_node(node, list->ui_data);
+ add_node(node, FINCH_GET_DATA(list));
} else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
- if (node->ui_data == NULL) {
+ if (FINCH_GET_DATA(node)== NULL) {
/* The core seems to expect the UI to add the buddies. */
for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node))
- add_node(node, list->ui_data);
+ add_node(node, FINCH_GET_DATA(list));
}
} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
if (!ggblist->manager->can_add_node(node))
node_remove(list, node);
else
- add_node(node, list->ui_data);
+ add_node(node, FINCH_GET_DATA(list));
}
}
@@ -539,7 +539,7 @@ new_list(PurpleBuddyList *list)
return;
ggblist = g_new0(FinchBlist, 1);
- list->ui_data = ggblist;
+ FINCH_SET_DATA(list, ggblist);
ggblist->manager = finch_blist_manager_find(purple_prefs_get_string(PREF_ROOT "/grouping"));
if (!ggblist->manager)
ggblist->manager = &default_manager;
@@ -763,7 +763,7 @@ add_group(PurpleGroup *group, FinchBlist
{
gpointer parent;
PurpleBlistNode *node = (PurpleBlistNode *)group;
- if (node->ui_data)
+ if (FINCH_GET_DATA(node))
return;
parent = ggblist->manager->find_parent((PurpleBlistNode*)group);
create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group,
@@ -836,7 +836,7 @@ add_chat(PurpleChat *chat, FinchBlist *g
{
gpointer parent;
PurpleBlistNode *node = (PurpleBlistNode *)chat;
- if (node->ui_data)
+ if (FINCH_GET_DATA(node))
return;
if (!purple_account_is_connected(chat->account))
return;
@@ -855,7 +855,7 @@ add_contact(PurpleContact *contact, Finc
PurpleBlistNode *node = (PurpleBlistNode*)contact;
const char *name;
- if (node->ui_data)
+ if (FINCH_GET_DATA(node))
return;
name = get_display_name(node);
@@ -878,7 +878,7 @@ add_buddy(PurpleBuddy *buddy, FinchBlist
PurpleBlistNode *node = (PurpleBlistNode *)buddy;
PurpleContact *contact;
- if (node->ui_data)
+ if (FINCH_GET_DATA(node))
return;
contact = purple_buddy_get_contact(buddy);
@@ -936,7 +936,7 @@ selection_activate(GntWidget *widget, Fi
purple_buddy_get_account(buddy),
purple_buddy_get_name(buddy));
} else {
- FinchConv *ggconv = conv->ui_data;
+ FinchConv *ggconv = FINCH_GET_DATA(conv);
gnt_window_present(ggconv->window);
}
finch_conversation_set_active(conv);
@@ -1812,7 +1812,7 @@ reset_blist_window(GntWidget *window, gp
{
PurpleBlistNode *node;
purple_signals_disconnect_by_handle(finch_blist_get_handle());
- purple_get_blist()->ui_data = NULL;
+ FINCH_SET_DATA(purple_get_blist(), NULL);
node = purple_blist_get_root();
while (node) {
@@ -2324,7 +2324,7 @@ buddy_recent_signed_on_off(gpointer data
buddy_recent_signed_on_off(gpointer data)
{
PurpleBlistNode *node = data;
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
purple_timeout_remove(fnode->signed_timer);
fnode->signed_timer = 0;
@@ -2344,7 +2344,7 @@ buddy_signed_on_off_cb(gpointer data)
buddy_signed_on_off_cb(gpointer data)
{
PurpleBlistNode *node = data;
- FinchBlistNode *fnode = node->ui_data;
+ FinchBlistNode *fnode = FINCH_GET_DATA(node);
if (!ggblist || !fnode)
return FALSE;
============================================================
--- finch/gntconv.c 796043b91b98f0071b9b50e12862d8af29e57227
+++ finch/gntconv.c 14cd0b7187b120e71d0110368be59acfe8a0e8b4
@@ -282,7 +282,7 @@ update_buddy_typing(PurpleAccount *accou
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 @@ buddy_signed_on_off(PurpleBuddy *buddy,
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 @@ 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(cc->ui_data);
+ generate_send_to_menu(FINCH_GET_DATA(cc));
list = list->next;
}
@@ -610,7 +610,7 @@ finch_create_conversation(PurpleConversa
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 @@ finch_create_conversation(PurpleConversa
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 @@ finch_create_conversation(PurpleConversa
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(PurpleConvers
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 *c
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 @@ finch_chat_add_users(PurpleConversation
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(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 = 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(PurpleConversati
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(PurpleConversatio
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 *con
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 @@ users_command_cb(PurpleConversation *con
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(Purpl
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(
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));
============================================================
--- finch/gntft.c 66dfd3d28e03eb1434e7723e46da6eaa0c9315b6
+++ finch/gntft.c 72d6342dd659daa2abebc62c3393e03142cb0302
@@ -23,13 +23,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#include "finch.h"
+
#include <gnt.h>
#include <gntbox.h>
#include <gntbutton.h>
#include <gntcheckbox.h>
#include <gntlabel.h>
#include <gnttree.h>
-#include "internal.h"
#include "debug.h"
#include "notify.h"
@@ -41,7 +42,7 @@
#include "prefs.h"
#define FINCHXFER(xfer) \
- (PurpleGntXferUiData *)(xfer)->ui_data
+ (PurpleGntXferUiData *)FINCH_GET_DATA(xfer)
typedef struct
{
@@ -467,7 +468,7 @@ finch_xfer_new_xfer(PurpleXfer *xfer)
/* This is where we're setting xfer->ui_data for the first time. */
data = g_new0(PurpleGntXferUiData, 1);
- xfer->ui_data = data;
+ FINCH_SET_DATA(xfer, data);
}
static void
@@ -479,7 +480,7 @@ finch_xfer_destroy(PurpleXfer *xfer)
if (data) {
g_free(data->name);
g_free(data);
- xfer->ui_data = NULL;
+ FINCH_SET_DATA(xfer, NULL);
}
}
============================================================
--- finch/gntrequest.c c047f3dbf21bb39d63c61b6b30da6e59b61ab808
+++ finch/gntrequest.c b2aeec31cbf7c512a8410c5f899e6f9a6b51edcd
@@ -308,26 +308,26 @@ request_fields_cb(GntWidget *button, Pur
PurpleRequestFieldType type = purple_request_field_get_type(field);
if (type == PURPLE_REQUEST_FIELD_BOOLEAN)
{
- GntWidget *check = field->ui_data;
+ GntWidget *check = FINCH_GET_DATA(field);
gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check));
purple_request_field_bool_set_value(field, value);
}
else if (type == PURPLE_REQUEST_FIELD_STRING)
{
- GntWidget *entry = field->ui_data;
+ GntWidget *entry = FINCH_GET_DATA(field);
const char *text = gnt_entry_get_text(GNT_ENTRY(entry));
purple_request_field_string_set_value(field, (text && *text) ? text : NULL);
}
else if (type == PURPLE_REQUEST_FIELD_INTEGER)
{
- GntWidget *entry = field->ui_data;
+ GntWidget *entry = FINCH_GET_DATA(field);
const char *text = gnt_entry_get_text(GNT_ENTRY(entry));
int value = (text && *text) ? atoi(text) : 0;
purple_request_field_int_set_value(field, value);
}
else if (type == PURPLE_REQUEST_FIELD_CHOICE)
{
- GntWidget *combo = field->ui_data;
+ GntWidget *combo = FINCH_GET_DATA(field);
int id;
id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)));
purple_request_field_choice_set_value(field, id);
@@ -338,7 +338,7 @@ request_fields_cb(GntWidget *button, Pur
if (purple_request_field_list_get_multi_select(field))
{
GList *iter;
- GntWidget *tree = field->ui_data;
+ GntWidget *tree = FINCH_GET_DATA(field);
iter = purple_request_field_list_get_items(field);
for (; iter; iter = iter->next)
@@ -351,7 +351,7 @@ request_fields_cb(GntWidget *button, Pur
}
else
{
- GntWidget *combo = field->ui_data;
+ GntWidget *combo = FINCH_GET_DATA(field);
gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo));
list = g_list_append(list, data);
}
@@ -361,7 +361,7 @@ request_fields_cb(GntWidget *button, Pur
}
else if (type == PURPLE_REQUEST_FIELD_ACCOUNT)
{
- GntWidget *combo = field->ui_data;
+ GntWidget *combo = FINCH_GET_DATA(field);
PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo));
purple_request_field_account_set_value(field, acc);
}
@@ -594,35 +594,35 @@ finch_request_fields(const char *title,
if (type == PURPLE_REQUEST_FIELD_BOOLEAN)
{
- field->ui_data = create_boolean_field(field);
+ FINCH_SET_DATA(field, create_boolean_field(field));
}
else if (type == PURPLE_REQUEST_FIELD_STRING)
{
- field->ui_data = create_string_field(field, &screenname);
+ FINCH_SET_DATA(field, create_string_field(field, &screenname));
}
else if (type == PURPLE_REQUEST_FIELD_INTEGER)
{
- field->ui_data = create_integer_field(field);
+ FINCH_SET_DATA(field, create_integer_field(field));
}
else if (type == PURPLE_REQUEST_FIELD_CHOICE)
{
- field->ui_data = create_choice_field(field);
+ FINCH_SET_DATA(field, create_choice_field(field));
}
else if (type == PURPLE_REQUEST_FIELD_LIST)
{
- field->ui_data = create_list_field(field);
+ FINCH_SET_DATA(field, create_list_field(field));
}
else if (type == PURPLE_REQUEST_FIELD_ACCOUNT)
{
- accountlist = field->ui_data = create_account_field(field);
+ accountlist = FINCH_SET_DATA(field, create_account_field(field));
}
else
{
- field->ui_data = gnt_label_new_with_format(_("Not implemented yet."),
- GNT_TEXT_FLAG_BOLD);
+ FINCH_SET_DATA(field, gnt_label_new_with_format(_("Not implemented yet."),
+ GNT_TEXT_FLAG_BOLD));
}
gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID);
- gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(field->ui_data));
+ gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field)));
}
if (grlist->next)
gnt_box_add_widget(GNT_BOX(box), gnt_hline_new());
============================================================
--- finch/gntroomlist.c 1143715e85053bc25d4d629ad71678ec8da8ef0b
+++ finch/gntroomlist.c b95a84030822eb9b3082af8a41a6a10b9a4a0a0f
@@ -24,7 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#include"internal.h"
+#include "finch.h"
#include "gntrequest.h"
#include "gntroomlist.h"
@@ -341,7 +341,7 @@ fl_create(PurpleRoomlist *list)
static void
fl_create(PurpleRoomlist *list)
{
- list->ui_data = &froomlist;
+ FINCH_SET_DATA(list, &froomlist);
setup_roomlist(NULL);
update_roomlist(list);
}
More information about the Commits
mailing list