gobjectification: c8c2d3fd: Fixed some perl bindings and made privat...
aluink at soc.pidgin.im
aluink at soc.pidgin.im
Thu Jul 2 14:40:36 EDT 2009
-----------------------------------------------------------------
Revision: c8c2d3fd12403d62c5188a1d554cd55bd42ab3e8
Ancestor: 3391666d57387c90af083b39a9f67b0b9baba5c0
Author: aluink at soc.pidgin.im
Date: 2009-07-02T18:35:28
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/c8c2d3fd12403d62c5188a1d554cd55bd42ab3e8
Modified files:
finch/finch.h finch/gntblist.c finch/gntconv.c
libpurple/blist-node.c libpurple/blist-node.h
libpurple/buddy.c libpurple/chat.c libpurple/contact.c
libpurple/conversation.c libpurple/conversation.h
libpurple/group.c libpurple/plugins/perl/common/BuddyList.xs
libpurple/plugins/perl/common/module.h pidgin/gtkblist.c
ChangeLog:
Fixed some perl bindings and made privates for PurpleBlistNode
-------------- next part --------------
============================================================
--- finch/finch.h f0061186ee99a03eb6c56f0cf45ef01cf9c58965
+++ finch/finch.h 4bde0d8e305a4faee236ebfc51a3a6d5d0eec446
@@ -30,6 +30,6 @@
#define FINCH_PREFS_ROOT "/finch"
-#define FINCH_GET_DATA(obj) (obj)->ui_data
-#define FINCH_SET_DATA(obj, data) (obj)->ui_data = data
+#define FINCH_GET_DATA(obj) ((obj)->ui_data)
+#define FINCH_SET_DATA(obj, data) ((obj)->ui_data = data)
============================================================
--- finch/gntblist.c 2bcfd9719a474215dae679902df765d105d41bc6
+++ finch/gntblist.c f65580c10f8e366ed41a375d98da75625fce571d
@@ -168,7 +168,7 @@ static gboolean default_can_add_node(Pur
if (PURPLE_IS_BUDDY(node)) {
PurpleBuddy *buddy = (PurpleBuddy*)node;
- FinchBlistNode *fnode = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_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))
@@ -322,11 +322,11 @@ create_finch_blist_node(PurpleBlistNode
static FinchBlistNode *
create_finch_blist_node(PurpleBlistNode *node, gpointer row)
{
- FinchBlistNode *fnode = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
if (!fnode) {
fnode = g_new0(FinchBlistNode, 1);
fnode->signed_timer = 0;
- FINCH_SET_DATA(node, fnode);
+ purple_blist_node_set_ui_data(node, fnode);
}
fnode->row = row;
return fnode;
@@ -335,13 +335,13 @@ reset_blist_node_ui_data(PurpleBlistNode
static void
reset_blist_node_ui_data(PurpleBlistNode *node)
{
- FinchBlistNode *fnode = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
if (fnode == NULL)
return;
if (fnode->signed_timer)
purple_timeout_remove(fnode->signed_timer);
g_free(fnode);
- FINCH_SET_DATA(node, NULL);
+ purple_blist_node_set_ui_data(node, NULL);
}
static int
@@ -374,7 +374,7 @@ get_blist_node_flag(PurpleBlistNode *nod
get_blist_node_flag(PurpleBlistNode *node)
{
GntTextFormatFlags flag = 0;
- FinchBlistNode *fnode = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
if (ggblist->tagged && g_list_find(ggblist->tagged, node))
flag |= GNT_TEXT_FLAG_BOLD;
@@ -383,7 +383,7 @@ get_blist_node_flag(PurpleBlistNode *nod
flag |= GNT_TEXT_FLAG_BLINK;
else if (PURPLE_IS_CONTACT(node)) {
node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)));
- fnode = FINCH_GET_DATA(node);
+ fnode = purple_blist_node_get_ui_data(node);
if (fnode && fnode->signed_timer)
flag |= GNT_TEXT_FLAG_BLINK;
} else if (PURPLE_IS_GROUP(node)) {
@@ -399,7 +399,7 @@ get_blist_node_flag(PurpleBlistNode *nod
node = purple_blist_node_get_sibling_next(node)) {
PurpleBlistNode *pnode;
pnode = purple_contact_get_priority_buddy((PurpleContact*)node);
- fnode = FINCH_GET_DATA(node);
+ fnode = purple_blist_node_get_ui_data(node);
if (fnode && fnode->signed_timer) {
flag |= GNT_TEXT_FLAG_BLINK;
break;
@@ -426,7 +426,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 = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) ||
(fnode && fnode->signed_timer))
return TRUE;
@@ -458,7 +458,7 @@ add_node(PurpleBlistNode *node, FinchBli
static void
add_node(PurpleBlistNode *node, FinchBlist *ggblist)
{
- if (FINCH_GET_DATA(node))
+ if (purple_blist_node_get_ui_data(node))
return;
if (!ggblist->manager->can_add_node(node))
@@ -495,7 +495,7 @@ node_remove(PurpleBuddyList *list, Purpl
FinchBlist *ggblist = purple_blist_get_ui_data();
PurpleBlistNode *parent;
- if (ggblist == NULL || FINCH_GET_DATA(node) == NULL)
+ if (ggblist == NULL || purple_blist_node_get_ui_data(node) == NULL)
return;
if (PURPLE_IS_GROUP(node) && ggblist->new_group) {
@@ -536,7 +536,7 @@ node_update(PurpleBuddyList *list, Purpl
if (ggblist->window == NULL)
return;
- if (FINCH_GET_DATA(node)!= NULL) {
+ if (purple_blist_node_get_ui_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);
@@ -553,7 +553,7 @@ node_update(PurpleBuddyList *list, Purpl
} else if (PURPLE_IS_CHAT(node)) {
add_node(node, purple_blist_get_ui_data());
} else if (PURPLE_IS_CONTACT(node)) {
- if (FINCH_GET_DATA(node)== NULL) {
+ if (purple_blist_node_get_ui_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, purple_blist_get_ui_data());
@@ -818,7 +818,7 @@ add_group_cb(gpointer null, const char *
/* Select the group */
if (ggblist->tree) {
- FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data((PurpleBlistNode*)grp);
if (!fnode)
add_node((PurpleBlistNode*)grp, ggblist);
gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp);
@@ -866,7 +866,7 @@ add_group(PurpleGroup *group, FinchBlist
{
gpointer parent;
PurpleBlistNode *node = (PurpleBlistNode *)group;
- if (FINCH_GET_DATA(node))
+ if (purple_blist_node_get_ui_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,
@@ -939,7 +939,7 @@ add_chat(PurpleChat *chat, FinchBlist *g
{
gpointer parent;
PurpleBlistNode *node = (PurpleBlistNode *)chat;
- if (FINCH_GET_DATA(node))
+ if (purple_blist_node_get_ui_data(node))
return;
if (!purple_account_is_connected(purple_chat_get_account(chat)))
return;
@@ -958,7 +958,7 @@ add_contact(PurpleContact *contact, Finc
PurpleBlistNode *node = (PurpleBlistNode*)contact;
const char *name;
- if (FINCH_GET_DATA(node))
+ if (purple_blist_node_get_ui_data(node))
return;
name = get_display_name(node);
@@ -981,7 +981,7 @@ add_buddy(PurpleBuddy *buddy, FinchBlist
PurpleBlistNode *node = (PurpleBlistNode *)buddy;
PurpleContact *contact;
- if (FINCH_GET_DATA(node))
+ if (purple_blist_node_get_ui_data(node))
return;
contact = purple_buddy_get_contact(buddy);
@@ -1039,7 +1039,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 = purple_conversation_get_ui_data(conv);
gnt_window_present(ggconv->window);
}
finch_conversation_set_active(conv);
@@ -2503,7 +2503,7 @@ buddy_recent_signed_on_off(gpointer data
buddy_recent_signed_on_off(gpointer data)
{
PurpleBlistNode *node = data;
- FinchBlistNode *fnode = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
purple_timeout_remove(fnode->signed_timer);
fnode->signed_timer = 0;
@@ -2523,7 +2523,7 @@ buddy_signed_on_off_cb(gpointer data)
buddy_signed_on_off_cb(gpointer data)
{
PurpleBlistNode *node = data;
- FinchBlistNode *fnode = FINCH_GET_DATA(node);
+ FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
if (!ggblist || !fnode)
return FALSE;
============================================================
--- finch/gntconv.c be7f68e84dd2aa7ff6ec3ef7c630c28aab41bcf1
+++ finch/gntconv.c f4ab88bbb2a3e348fdb257b2c54d09f77394df7f
@@ -284,7 +284,7 @@ update_buddy_typing(PurpleAccount *accou
return;
im = PURPLE_CONV_IM(conv);
- ggc = FINCH_GET_DATA(conv);
+ ggc = purple_conversation_get_ui_data(conv);
if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
int scroll;
@@ -323,7 +323,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(purple_conversation_get_ui_data(conv));
}
static void
@@ -335,7 +335,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(purple_conversation_get_ui_data(cc));
list = list->next;
}
@@ -704,7 +704,7 @@ finch_create_conversation(PurpleConversa
static void
finch_create_conversation(PurpleConversation *conv)
{
- FinchConv *ggc = FINCH_GET_DATA(conv);
+ FinchConv *ggc = purple_conversation_get_ui_data(conv);
char *title;
PurpleConversationType type;
PurpleConversation *cc;
@@ -718,8 +718,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 && purple_conversation_get_ui_data(cc))
+ ggc = purple_conversation_get_ui_data(cc);
else
ggc = g_new0(FinchConv, 1);
@@ -731,9 +731,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 && purple_conversation_get_ui_data(cc) && cc != conv) {
finch_conversation_set_active(conv);
return;
}
@@ -840,7 +840,7 @@ finch_destroy_conversation(PurpleConvers
finch_destroy_conversation(PurpleConversation *conv)
{
/* do stuff here */
- FinchConv *ggc = FINCH_GET_DATA(conv);
+ FinchConv *ggc = purple_conversation_get_ui_data(conv);
ggc->list = g_list_remove(ggc->list, conv);
if (ggc->list && conv == ggc->active_conv) {
ggc->active_conv = ggc->list->data;
@@ -860,7 +860,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 = purple_conversation_get_ui_data(conv);
char *strip, *newline;
GntTextFormatFlags fl = 0;
int pos;
@@ -1021,7 +1021,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 = purple_conversation_get_ui_data(conv);
GntEntry *entry = GNT_ENTRY(ggc->entry);
if (!new_arrivals)
@@ -1063,7 +1063,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 = purple_conversation_get_ui_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);
@@ -1081,7 +1081,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 = purple_conversation_get_ui_data(conv);
GntEntry *entry = GNT_ENTRY(ggc->entry);
for (; list; list = list->next) {
GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
@@ -1094,7 +1094,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 = purple_conversation_get_ui_data(conv);
gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags));
}
@@ -1203,7 +1203,7 @@ clear_command_cb(PurpleConversation *con
clear_command_cb(PurpleConversation *conv,
const char *cmd, char **args, char **error, void *data)
{
- FinchConv *ggconv = FINCH_GET_DATA(conv);
+ FinchConv *ggconv = purple_conversation_get_ui_data(conv);
gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv));
purple_conversation_clear_message_history(conv);
return PURPLE_CMD_STATUS_OK;
@@ -1303,7 +1303,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 = purple_conversation_get_ui_data(conv);
FinchConvChat *ch;
if (!fc)
return PURPLE_CMD_STATUS_FAILED;
@@ -1419,7 +1419,7 @@ void finch_conversation_set_active(Purpl
void finch_conversation_set_active(PurpleConversation *conv)
{
- FinchConv *ggconv = FINCH_GET_DATA(conv);
+ FinchConv *ggconv = purple_conversation_get_ui_data(conv);
PurpleAccount *account;
char *title;
@@ -1438,7 +1438,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 = purple_conversation_get_ui_data(conv);
int height, width;
gnt_box_remove_all(GNT_BOX(fc->info));
============================================================
--- libpurple/blist-node.c 77ad35eeadce5ab613c629217b4092b871c84507
+++ libpurple/blist-node.c 235981fa31a0347b6426691dbc02e3d8ae4655d2
@@ -31,6 +31,16 @@
#include "signals.h"
#include "xmlnode.h"
+struct _PurpleBlistNodePrivate {
+ GHashTable *settings; /**< per-node settings; keys are
+ <tt>gchar *</tt>, values are
+ slice-allocated
+ <tt>GValue</tt>. */
+
+ void *ui_data; /**< The UI can put data here. */
+ PurpleBlistNodeFlags flags; /**< The buddy flags */
+};
+
PurpleBlistNode *
purple_blist_get_last_sibling(PurpleBlistNode *node)
{
@@ -126,16 +136,23 @@ purple_blist_node_get_ui_data(const Purp
void *
purple_blist_node_get_ui_data(const PurpleBlistNode *node)
{
+ PurpleBlistNodePrivate *priv;
+
g_return_val_if_fail(node, NULL);
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
- return node->ui_data;
+ return priv->ui_data;
}
void
purple_blist_node_set_ui_data(PurpleBlistNode *node, void *ui_data) {
+ PurpleBlistNodePrivate *priv;
+
g_return_if_fail(node);
- node->ui_data = ui_data;
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ priv->ui_data = ui_data;
}
void
@@ -196,20 +213,27 @@ void purple_blist_node_initialize_settin
void purple_blist_node_initialize_settings(PurpleBlistNode *node)
{
- if (node->settings)
+ PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ if (priv->settings)
return;
- node->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+ priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
(GDestroyNotify)purple_g_value_slice_free);
}
void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key)
{
+ PurpleBlistNodePrivate *priv;
+
g_return_if_fail(node != NULL);
- g_return_if_fail(node->settings != NULL);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
- g_hash_table_remove(node->settings, key);
+ g_hash_table_remove(priv->settings, key);
purple_blist_schedule_save();
}
@@ -217,43 +241,56 @@ purple_blist_node_set_flags(PurpleBlistN
void
purple_blist_node_set_flags(PurpleBlistNode *node, PurpleBlistNodeFlags flags)
{
+ PurpleBlistNodePrivate *priv;
g_return_if_fail(node != NULL);
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
- node->flags = flags;
+ priv->flags = flags;
}
PurpleBlistNodeFlags
purple_blist_node_get_flags(PurpleBlistNode *node)
{
+ PurpleBlistNodePrivate *priv;
g_return_val_if_fail(node != NULL, 0);
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
- return node->flags;
+ return priv->flags;
}
gboolean
purple_blist_node_has_setting(PurpleBlistNode *node,
const char *key)
{
+ PurpleBlistNodePrivate *priv;
+
g_return_val_if_fail(node != NULL, FALSE);
- g_return_val_if_fail(node->settings != NULL, FALSE);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_val_if_fail(priv->settings != NULL, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
- return (g_hash_table_lookup(node->settings, key) != NULL);
+ return (g_hash_table_lookup(priv->settings, key) != NULL);
}
void
purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data)
{
GValue *value;
+ PurpleBlistNodePrivate *priv;
g_return_if_fail(node != NULL);
- g_return_if_fail(node->settings != NULL);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
value = purple_g_value_slice_new(G_TYPE_BOOLEAN);
g_value_set_boolean(value, data);
- g_hash_table_replace(node->settings, g_strdup(key), value);
+ g_hash_table_replace(priv->settings, g_strdup(key), value);
purple_blist_schedule_save();
}
@@ -262,12 +299,16 @@ purple_blist_node_get_bool(PurpleBlistNo
purple_blist_node_get_bool(PurpleBlistNode* node, const char *key)
{
GValue *value;
+ PurpleBlistNodePrivate *priv;
g_return_val_if_fail(node != NULL, FALSE);
- g_return_val_if_fail(node->settings != NULL, FALSE);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_val_if_fail(priv->settings != NULL, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
- value = g_hash_table_lookup(node->settings, key);
+ value = g_hash_table_lookup(priv->settings, key);
if (value == NULL)
return FALSE;
@@ -281,15 +322,19 @@ purple_blist_node_set_int(PurpleBlistNod
purple_blist_node_set_int(PurpleBlistNode* node, const char *key, int data)
{
GValue *value;
+ PurpleBlistNodePrivate *priv;
g_return_if_fail(node != NULL);
- g_return_if_fail(node->settings != NULL);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
value = purple_g_value_slice_new(G_TYPE_INT);
g_value_set_int(value, data);
- g_hash_table_replace(node->settings, g_strdup(key), value);
+ g_hash_table_replace(priv->settings, g_strdup(key), value);
purple_blist_schedule_save();
}
@@ -298,12 +343,16 @@ purple_blist_node_get_int(PurpleBlistNod
purple_blist_node_get_int(PurpleBlistNode* node, const char *key)
{
GValue *value;
+ PurpleBlistNodePrivate *priv;
g_return_val_if_fail(node != NULL, 0);
- g_return_val_if_fail(node->settings != NULL, 0);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_val_if_fail(priv->settings != NULL, 0);
g_return_val_if_fail(key != NULL, 0);
- value = g_hash_table_lookup(node->settings, key);
+ value = g_hash_table_lookup(priv->settings, key);
if (value == NULL)
return 0;
@@ -317,29 +366,48 @@ purple_blist_node_set_string(PurpleBlist
purple_blist_node_set_string(PurpleBlistNode* node, const char *key, const char *data)
{
GValue *value;
+ PurpleBlistNodePrivate *priv;
g_return_if_fail(node != NULL);
- g_return_if_fail(node->settings != NULL);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
value = purple_g_value_slice_new(G_TYPE_STRING);
g_value_set_string(value, data);
- g_hash_table_replace(node->settings, g_strdup(key), value);
+ g_hash_table_replace(priv->settings, g_strdup(key), value);
purple_blist_schedule_save();
}
+GHashTable *
+purple_blist_node_get_settings(PurpleBlistNode *node)
+{
+ PurpleBlistNodePrivate *priv;
+ g_return_val_if_fail(node != NULL, NULL);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ return priv->settings;
+}
+
const char *
purple_blist_node_get_string(PurpleBlistNode* node, const char *key)
{
GValue *value;
+ PurpleBlistNodePrivate *priv;
g_return_val_if_fail(node != NULL, NULL);
- g_return_val_if_fail(node->settings != NULL, NULL);
+
+ priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
+
+ g_return_val_if_fail(priv->settings != NULL, NULL);
g_return_val_if_fail(key != NULL, NULL);
- value = g_hash_table_lookup(node->settings, key);
+ value = g_hash_table_lookup(priv->settings, key);
if (value == NULL)
return NULL;
@@ -372,6 +440,7 @@ purple_blist_node_finalize(GObject *obje
purple_blist_node_finalize(GObject *object)
{
PurpleBlistNode *node = PURPLE_BLIST_NODE(object);
+ PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
PurpleBlistUiOps *ui_ops;
PurpleBlistNode *child, *next_child;
@@ -388,6 +457,9 @@ purple_blist_node_finalize(GObject *obje
node->child = NULL;
node->next = NULL;
node->prev = NULL;
+
+ g_hash_table_destroy(priv->settings);
+
if (ui_ops && ui_ops->remove)
ui_ops->remove(purplebuddylist, node);
@@ -410,12 +482,14 @@ purple_blist_node_class_init(PurpleBlist
parent_class = g_type_class_peek_parent(klass);
obj_class->finalize = purple_blist_node_finalize;
+
+ g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate));
}
static void
purple_blist_node_init(GTypeInstance *instance, gpointer class)
{
- purple_blist_node_initialize_settings((PurpleBlistNode *)contact);
+ purple_blist_node_initialize_settings(PURPLE_BLIST_NODE(instance));
}
GType
============================================================
--- libpurple/blist-node.h 7941548f61d359ebc5e83864a14e92e7f3037c55
+++ libpurple/blist-node.h 933fa4444f3647002eb3de7375f051d97646c5cf
@@ -46,9 +46,6 @@ typedef enum
#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f))
#define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE))
-/*#define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \
- purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL)*/
-
/** @copydoc _PurpleBlistNode */
typedef struct _PurpleBlistNode PurpleBlistNode;
typedef struct _PurpleBlistNodePrivate PurpleBlistNodePrivate;
@@ -73,13 +70,7 @@ struct _PurpleBlistNode {
PurpleBlistNode *parent; /**< The parent of this node */
PurpleBlistNode *child; /**< The child of this node */
- GHashTable *settings; /**< per-node settings; keys are
- <tt>gchar *</tt>, values are
- slice-allocated
- <tt>GValue</tt>. */
-
- void *ui_data; /**< The UI can put data here. */
- PurpleBlistNodeFlags flags; /**< The buddy flags */
+ PurpleBlistNodePrivate *priv; /**< The private members */
};
struct _PurpleBlistNodeClass {
@@ -210,6 +201,15 @@ void purple_blist_node_set_int(PurpleBli
void purple_blist_node_set_int(PurpleBlistNode *node, const char *key, int value);
/**
+ * Return the settings table
+ *
+ * @param node The node
+ *
+ * @return the hash table
+ */
+GHashTable *purple_blist_node_get_settings(PurpleBlistNode *node);
+
+/**
* Retrieves a named integer setting from a node in the buddy list
*
* @param node The node to retrieve the data from
============================================================
--- libpurple/buddy.c a7848e6814078189a125da2da1fc63f08e0fc3fe
+++ libpurple/buddy.c ed06e344cfc20065425ce5e9074a4ca869fbcbb7
@@ -403,7 +403,7 @@ buddy_to_xmlnode(PurpleBlistNode *bnode)
}
/* Write buddy settings */
- g_hash_table_foreach(buddy->node.settings, value_to_xmlnode, node);
+ g_hash_table_foreach(purple_blist_node_get_settings(PURPLE_BLIST_NODE(buddy)), value_to_xmlnode, node);
return node;
}
@@ -471,7 +471,6 @@ purple_buddy_finalize(GObject *object)
/* Delete the node */
purple_buddy_icon_unref(buddy->icon);
- g_hash_table_destroy(buddy->node.settings);
purple_presence_destroy(buddy->presence);
g_free(buddy->name);
g_free(buddy->alias);
============================================================
--- libpurple/chat.c 8d716443b3bffeba4a46fa7e1ca5961acb6be40d
+++ libpurple/chat.c aa22eac2976ee860b6ee0bbfd7136babf200961a
@@ -71,7 +71,7 @@ chat_to_xmlnode(PurpleBlistNode *cnode)
g_hash_table_foreach(chat->components, chat_component_to_xmlnode, node);
/* Write chat settings */
- g_hash_table_foreach(chat->node.settings, value_to_xmlnode, node);
+ g_hash_table_foreach(purple_blist_node_get_settings(PURPLE_BLIST_NODE(chat)), value_to_xmlnode, node);
return node;
}
@@ -262,7 +262,6 @@ purple_chat_finalize(GObject *object)
{
PurpleChat *chat = PURPLE_CHAT(object);
g_hash_table_destroy(chat->components);
- g_hash_table_destroy(chat->node.settings);
g_free(chat->alias);
PURPLE_DBUS_UNREGISTER_POINTER(chat);
parent_class->finalize(object);
============================================================
--- libpurple/contact.c 1fe1a5505fd75860d5165a587b9ad8bb657acd77
+++ libpurple/contact.c d289e42c9fb5fe825e0b1f489c730f58f6f10abc
@@ -60,7 +60,7 @@ contact_to_xmlnode(PurpleBlistNode *cnod
}
/* Write contact settings */
- g_hash_table_foreach(cnode->settings, value_to_xmlnode, node);
+ g_hash_table_foreach(purple_blist_node_get_settings(cnode), value_to_xmlnode, node);
return node;
}
@@ -270,7 +270,6 @@ purple_contact_finalize(GObject *object)
purple_contact_finalize(GObject *object)
{
PurpleContact *contact = PURPLE_CONTACT(object);
- g_hash_table_destroy(contact->node.settings);
g_free(contact->alias);
PURPLE_DBUS_UNREGISTER_POINTER(contact);
parent_class->finalize(object);
============================================================
--- libpurple/conversation.c fcb3da4fca1f976565b8a65a6028d036185262d8
+++ libpurple/conversation.c 91afa9a62765f8f4fb1df66687d7d36d8308215e
@@ -582,6 +582,20 @@ purple_conversation_set_ui_ops(PurpleCon
conv->ui_ops = ops;
}
+void *
+purple_conversation_get_ui_data(PurpleConversation *conv)
+{
+ g_return_val_if_fail(conv != NULL, NULL);
+ return conv->ui_data;
+}
+
+void
+purple_conversation_set_ui_data(PurpleConversation *conv, void *data)
+{
+ g_return_if_fail(conv);
+ conv->ui_data = data;
+}
+
PurpleConversationUiOps *
purple_conversation_get_ui_ops(const PurpleConversation *conv)
{
============================================================
--- libpurple/conversation.h 769452aaf88fa90cbeee16647d00cc617a2cf6b1
+++ libpurple/conversation.h 7493e35c9a95f57dbd77df88f8c67830ef4c5a2c
@@ -432,6 +432,23 @@ PurpleConversationUiOps *purple_conversa
const PurpleConversation *conv);
/**
+ * Returns the ui_data for this conversation
+ *
+ * @param conv The conversation
+ *
+ * @return the ui_data
+ */
+void *purple_conversation_get_ui_data(PurpleConversation *conv);
+
+/**
+ * Sets the ui_data for this conversation
+ *
+ * @param conv The conversation
+ * @param data The ui_data
+ */
+void purple_conversation_set_ui_data(PurpleConversation *conv, void *data);
+
+/**
* Sets the specified conversation's purple_account.
*
* This purple_account represents the user using purple, not the person the user
============================================================
--- libpurple/group.c 3b40e9fd2c263c62ef3810577ed2163bb0e3a28c
+++ libpurple/group.c 3a2e36917ff791bf5bf1350e956f9cd8943291f7
@@ -44,7 +44,7 @@ group_to_xmlnode(PurpleBlistNode *gnode)
xmlnode_set_attrib(node, "name", group->name);
/* Write settings */
- g_hash_table_foreach(group->node.settings, value_to_xmlnode, node);
+ g_hash_table_foreach(purple_blist_node_get_settings(PURPLE_BLIST_NODE(group)), value_to_xmlnode, node);
/* Write contacts and chats */
for (cnode = gnode->child; cnode != NULL; cnode = cnode->next)
@@ -308,7 +308,6 @@ purple_group_finalize(GObject *object)
purple_group_finalize(GObject *object)
{
PurpleGroup *group = PURPLE_GROUP(object);
- g_hash_table_destroy(group->node.settings);
g_free(group->name);
PURPLE_DBUS_UNREGISTER_POINTER(group);
parent_class->finalize(object);
============================================================
--- libpurple/plugins/perl/common/BuddyList.xs 376288f3605593bd6e58b308091f79f9fcb2a5cf
+++ libpurple/plugins/perl/common/BuddyList.xs 1598fdf5276bdc99bb8a6c767cd3e874e6f94511
@@ -10,13 +10,6 @@ BOOT:
HV *stash = gv_stashpv("Purple::BuddyList::Node", 1);
static const constiv *civ, const_iv[] = {
-#define const_iv(name) {#name, (IV)PURPLE_BLIST_##name##_NODE}
- const_iv(GROUP),
- const_iv(CONTACT),
- const_iv(BUDDY),
- const_iv(CHAT),
- const_iv(OTHER),
-#undef const_iv
#define const_iv(name) {#name, (IV)PURPLE_BLIST_NODE_FLAG_##name}
const_iv(NO_SAVE),
};
@@ -28,10 +21,6 @@ purple_get_blist()
Purple::BuddyList
purple_get_blist()
-void
-purple_set_blist(blist)
- Purple::BuddyList blist
-
MODULE = Purple::BuddyList PACKAGE = Purple::Find PREFIX = purple_find_
PROTOTYPES: ENABLE
@@ -75,11 +64,6 @@ purple_contact_get_priority_buddy(contac
purple_contact_get_priority_buddy(contact)
Purple::BuddyList::Contact contact
-void
-purple_contact_set_alias(contact, alias)
- Purple::BuddyList::Contact contact
- const char * alias
-
const char *
purple_contact_get_alias(contact)
Purple::BuddyList::Contact contact
@@ -202,7 +186,7 @@ void
const char * name
void
-purple_blist_alias_buddy(buddy, alias)
+purple_buddy_set_alias(buddy, alias)
Purple::BuddyList::Buddy buddy
const char * alias
@@ -212,7 +196,7 @@ void
const char * alias
void
-purple_blist_alias_chat(chat, alias)
+purple_chat_set_alias(chat, alias)
Purple::BuddyList::Chat chat
const char * alias
@@ -311,10 +295,6 @@ purple_blist_node_get_flags(node)
purple_blist_node_get_flags(node)
Purple::BuddyList::Node node
-Purple::BuddyList::NodeType
-purple_blist_node_get_type(node)
- Purple::BuddyList::Node node
-
Purple::BuddyList::Node
purple_blist_node_next(node, offline)
Purple::BuddyList::Node node
============================================================
--- libpurple/plugins/perl/common/module.h 673d632e08ca454ecd1753624dbf0b4672b0c80b
+++ libpurple/plugins/perl/common/module.h 6ed24f8678ca798b1262113f518ee6730c07dad1
@@ -80,7 +80,6 @@ typedef PurpleBlistNodeFlags Purple__Bu
/* blist.h */
typedef PurpleBlistNode * Purple__BuddyList__Node;
typedef PurpleBlistNodeFlags Purple__BuddyList__NodeFlags;
-typedef PurpleBlistNodeType Purple__BuddyList__NodeType;
typedef PurpleBuddyList * Purple__BuddyList;
typedef PurpleBuddy * Purple__BuddyList__Buddy;
typedef PurpleChat * Purple__BuddyList__Chat;
============================================================
--- pidgin/gtkblist.c af8885e45078cac80dd31d936fde07183c02a28e
+++ pidgin/gtkblist.c 0897dba15b18a23e983920dcde24e56856470520
@@ -1209,7 +1209,7 @@ static void gtk_blist_row_collapsed_cb(G
for(cnode = node->child; cnode; cnode = cnode->next) {
if (PURPLE_IS_CONTACT(cnode)) {
- gtknode = cnode->ui_data;
+ gtknode = purple_blist_node_get_ui_data(cnode);
if (!gtknode->contact_expanded)
continue;
gtknode->contact_expanded = FALSE;
@@ -1339,7 +1339,7 @@ pidgin_blist_expand_contact_cb(GtkWidget
if(!PURPLE_IS_CONTACT(node))
return;
- gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
gtknode->contact_expanded = TRUE;
@@ -1372,7 +1372,7 @@ pidgin_blist_collapse_contact_cb(GtkWidg
if(!PURPLE_IS_CONTACT(node))
return;
- gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
gtknode->contact_expanded = FALSE;
@@ -1496,7 +1496,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *
contact = purple_buddy_get_contact(buddy);
if (contact) {
- contact_expanded = ((struct _pidgin_blist_node *)(((PurpleBlistNode*)contact)->ui_data))->contact_expanded;
+ contact_expanded = ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(contact)))->contact_expanded;
}
if (prpl_info && prpl_info->get_info) {
@@ -1820,7 +1820,7 @@ create_buddy_menu(PurpleBlistNode *node,
static GtkWidget *
create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b)
{
- struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
GtkWidget *menu;
GtkWidget *menuitem;
gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies");
@@ -1892,7 +1892,7 @@ pidgin_blist_show_context_menu(PurpleBli
GtkWidget *menu = NULL;
gboolean handled = FALSE;
- gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
/* Create a menu based on the thing we right-clicked on */
if (PURPLE_IS_GROUP(node)) {
@@ -1958,7 +1958,7 @@ gtk_blist_button_press_cb(GtkWidget *tv,
val.g_type = 0;
gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
node = g_value_get_pointer(&val);
- gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
/* Right click draws a context menu */
if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
@@ -2389,7 +2389,7 @@ static void pidgin_blist_drag_data_rcv_c
gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
&iter, NODE_COLUMN, &val);
node = g_value_get_pointer(&val);
- gtknode = node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
if (PURPLE_IS_CONTACT(n)) {
PurpleContact *c = (PurpleContact*)n;
@@ -3241,7 +3241,7 @@ static gboolean pidgin_blist_expand_time
return FALSE;
}
- gtknode = node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
if (!gtknode->contact_expanded) {
GtkTreeIter i;
@@ -3270,7 +3270,7 @@ static gboolean buddy_is_displayable(Pur
if(!buddy)
return FALSE;
- gtknode = ((PurpleBlistNode*)buddy)->ui_data;
+ gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
return (purple_account_is_connected(buddy->account) &&
(purple_presence_is_online(buddy->presence) ||
@@ -3473,7 +3473,7 @@ static char *pidgin_get_tooltip_text(Pur
struct proto_chat_entry *pce;
char *name, *value;
PurpleConversation *conv;
- PidginBlistNode *bnode = node->ui_data;
+ PidginBlistNode *bnode = purple_blist_node_get_ui_data(node);
chat = (PurpleChat *)node;
prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account));
@@ -3637,7 +3637,7 @@ static char *pidgin_get_tooltip_text(Pur
/* Last Seen */
if (full && c && !PURPLE_BUDDY_IS_ONLINE(b))
{
- struct _pidgin_blist_node *gtknode = ((PurpleBlistNode *)c)->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(c));
PurpleBlistNode *bnode;
int lastseen = 0;
@@ -3773,7 +3773,7 @@ pidgin_blist_get_emblem(PurpleBlistNode
pidgin_blist_get_emblem(PurpleBlistNode *node)
{
PurpleBuddy *buddy = NULL;
- struct _pidgin_blist_node *gtknode = node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
struct _pidgin_blist_node *gtkbuddynode = NULL;
PurplePlugin *prpl;
PurplePluginProtocolInfo *prpl_info;
@@ -3785,11 +3785,11 @@ pidgin_blist_get_emblem(PurpleBlistNode
if(PURPLE_IS_CONTACT(node)) {
if(!gtknode->contact_expanded) {
buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
- gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
+ gtkbuddynode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
}
} else if(PURPLE_IS_BUDDY(node)) {
buddy = (PurpleBuddy*)node;
- gtkbuddynode = node->ui_data;
+ gtkbuddynode = purple_blist_node_get_ui_data(node);
p = purple_buddy_get_presence(buddy);
if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems",
@@ -3797,7 +3797,7 @@ pidgin_blist_get_emblem(PurpleBlistNode
return _pidgin_blist_get_cached_emblem(path);
}
- if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded) {
+ if (((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node->parent))->contact_expanded) {
if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"))
return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL);
}
@@ -3864,7 +3864,7 @@ pidgin_blist_get_status_icon(PurpleBlist
GdkPixbuf *ret;
const char *protoname = NULL;
const char *icon = NULL;
- struct _pidgin_blist_node *gtknode = node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
struct _pidgin_blist_node *gtkbuddynode = NULL;
PurpleBuddy *buddy = NULL;
PurpleChat *chat = NULL;
@@ -3875,11 +3875,11 @@ pidgin_blist_get_status_icon(PurpleBlist
if(!gtknode->contact_expanded) {
buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
if (buddy != NULL)
- gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
+ gtkbuddynode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
}
} else if(PURPLE_IS_BUDDY(node)) {
buddy = (PurpleBuddy*)node;
- gtkbuddynode = node->ui_data;
+ gtkbuddynode = purple_blist_node_get_ui_data(node);
} else if(PURPLE_IS_CHAT(node)) {
chat = (PurpleChat*)node;
} else {
@@ -3915,7 +3915,7 @@ pidgin_blist_get_status_icon(PurpleBlist
if(conv != NULL) {
PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) {
- PidginBlistNode *ui = buddy->node.ui_data;
+ PidginBlistNode *ui = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE))
return gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview),
PIDGIN_STOCK_STATUS_MESSAGE, icon_size, "GtkTreeView");
@@ -3999,7 +3999,7 @@ pidgin_blist_get_name_markup(PurpleBuddy
PidginBlistTheme *theme;
if (conv != NULL) {
- PidginBlistNode *ui = b->node.ui_data;
+ PidginBlistNode *ui = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(b));
if (ui) {
if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)
hidden_conv = TRUE;
@@ -4258,7 +4258,7 @@ static void pidgin_blist_hide_node(Purpl
static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update)
{
- struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
GtkTreeIter iter;
if (!gtknode || !gtknode->row || !gtkblist)
@@ -4497,7 +4497,7 @@ written_msg_update_ui_cb(PurpleAccount *
written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message,
PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node)
{
- PidginBlistNode *ui = node->ui_data;
+ PidginBlistNode *ui = purple_blist_node_get_ui_data(node);
if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) ||
!(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)))
return;
@@ -4513,7 +4513,7 @@ displayed_msg_update_ui_cb(PidginConvers
static void
displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node)
{
- PidginBlistNode *ui = node->ui_data;
+ PidginBlistNode *ui = purple_blist_node_get_ui_data(node);
if (ui->conv.conv != gtkconv->active_conv)
return;
ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE |
@@ -4530,7 +4530,7 @@ conversation_created_cb(PurpleConversati
GSList *buddies = purple_find_buddies(conv->account, conv->name);
while (buddies) {
PurpleBlistNode *buddy = buddies->data;
- struct _pidgin_blist_node *ui = buddy->ui_data;
+ struct _pidgin_blist_node *ui = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
buddies = g_slist_delete_link(buddies, buddies);
if (!ui)
continue;
@@ -4552,7 +4552,7 @@ conversation_created_cb(PurpleConversati
struct _pidgin_blist_node *ui;
if (!chat)
break;
- ui = chat->node.ui_data;
+ ui = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(chat));
if (!ui)
break;
ui->conv.conv = conv;
@@ -4589,7 +4589,7 @@ static void pidgin_blist_new_node(Purple
static void pidgin_blist_new_node(PurpleBlistNode *node)
{
- node->ui_data = g_new0(struct _pidgin_blist_node, 1);
+ purple_blist_node_set_ui_data(node, g_new0(struct _pidgin_blist_node, 1));
}
gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node)
@@ -4602,7 +4602,7 @@ gboolean pidgin_blist_node_is_contact_ex
g_return_val_if_fail(PURPLE_IS_CONTACT(node), FALSE);
- return ((struct _pidgin_blist_node *)node->ui_data)->contact_expanded;
+ return ((struct _pidgin_blist_node*)purple_blist_node_get_ui_data(node))->contact_expanded;
}
enum {
@@ -4654,7 +4654,7 @@ static void _prefs_change_redo_list(cons
struct _pidgin_blist_node *gtknode;
GtkTreePath *path;
- gtknode = node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
if (gtknode && gtknode->row)
{
path = gtk_tree_row_reference_get_path(gtknode->row);
@@ -5993,7 +5993,7 @@ static gboolean get_iter_from_node(Purpl
}
static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) {
- struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
GtkTreePath *path;
if (!gtknode) {
@@ -6022,7 +6022,7 @@ static void pidgin_blist_remove(PurpleBu
static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node)
{
- struct _pidgin_blist_node *gtknode = node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
purple_request_close_with_handle(node);
@@ -6044,9 +6044,9 @@ static void pidgin_blist_remove(PurpleBu
if(gtknode->recent_signonoff_timer > 0)
purple_timeout_remove(gtknode->recent_signonoff_timer);
- purple_signals_disconnect_by_handle(node->ui_data);
- g_free(node->ui_data);
- node->ui_data = NULL;
+ purple_signals_disconnect_by_handle(purple_blist_node_get_ui_data(node));
+ g_free(purple_blist_node_get_ui_data(node));
+ purple_blist_node_set_ui_data(node, NULL);
}
}
@@ -6091,7 +6091,7 @@ static gboolean insert_node(PurpleBuddyL
static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter)
{
GtkTreeIter parent_iter, cur, *curptr = NULL;
- struct _pidgin_blist_node *gtknode = node->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
GtkTreePath *newpath;
if(!iter)
@@ -6113,7 +6113,7 @@ static gboolean insert_node(PurpleBuddyL
gtk_tree_row_reference_free(gtknode->row);
} else {
pidgin_blist_new_node(node);
- gtknode = (struct _pidgin_blist_node *)node->ui_data;
+ gtknode = purple_blist_node_get_ui_data(node);
}
newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
@@ -6131,7 +6131,7 @@ static gboolean insert_node(PurpleBuddyL
if(node->parent) {
GtkTreePath *expand = NULL;
- struct _pidgin_blist_node *gtkparentnode = node->parent->ui_data;
+ struct _pidgin_blist_node *gtkparentnode = purple_blist_node_get_ui_data(node);
if(PURPLE_IS_GROUP(node->parent)) {
if(!purple_blist_node_get_bool(node->parent, "collapsed"))
@@ -6318,7 +6318,7 @@ static void buddy_node(PurpleBuddy *budd
GdkColor *color = NULL;
char *mark;
char *idle = NULL;
- gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded;
+ gboolean expanded = ((struct _pidgin_blist_node*)purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(node->parent)))->contact_expanded;
gboolean selected = (gtkblist->selected_node == node);
gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
PidginBlistTheme *theme;
@@ -6451,7 +6451,7 @@ static void pidgin_blist_update_contact(
if(!insert_node(list, cnode, &iter))
return;
- gtknode = (struct _pidgin_blist_node *)cnode->ui_data;
+ gtknode = purple_blist_node_get_ui_data(cnode);
if(gtknode->contact_expanded) {
GdkPixbuf *status;
@@ -6528,7 +6528,7 @@ static void pidgin_blist_update_buddy(Pu
/* First things first, update the contact */
pidgin_blist_update_contact(list, node);
- gtkparentnode = (struct _pidgin_blist_node *)node->parent->ui_data;
+ gtkparentnode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(node->parent));
if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy))
{
@@ -6578,7 +6578,7 @@ static void pidgin_blist_update_chat(Pur
if (!insert_node(list, node, &iter))
return;
- ui = node->ui_data;
+ ui = purple_blist_node_get_ui_data(node);
conv = ui->conv.conv;
if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) {
hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE);
@@ -6664,7 +6664,7 @@ static void pidgin_blist_update(PurpleBu
if(!gtkblist || !gtkblist->treeview || !node)
return;
- if (node->ui_data == NULL)
+ if (purple_blist_node_get_ui_data(node) == NULL)
pidgin_blist_new_node(node);
if (PURPLE_IS_GROUP(node)){
@@ -7254,7 +7254,7 @@ static gboolean buddy_signonoff_timeout_
static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy)
{
- struct _pidgin_blist_node *gtknode = ((PurpleBlistNode*)buddy)->ui_data;
+ struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
gtknode->recent_signonoff = FALSE;
gtknode->recent_signonoff_timer = 0;
@@ -7268,11 +7268,11 @@ static void buddy_signonoff_cb(PurpleBud
{
struct _pidgin_blist_node *gtknode;
- if(!((PurpleBlistNode*)buddy)->ui_data) {
+ if(!purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy))) {
pidgin_blist_new_node((PurpleBlistNode*)buddy);
}
- gtknode = ((PurpleBlistNode*)buddy)->ui_data;
+ gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
gtknode->recent_signonoff = TRUE;
More information about the Commits
mailing list