aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat-view.c19
-rw-r--r--libempathy-gtk/empathy-chat-window.c1
-rw-r--r--libempathy-gtk/empathy-chat.c2
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c2
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c14
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c4
-rw-r--r--libempathy-gtk/empathy-contact-widget.c8
-rw-r--r--libempathy-gtk/empathy-main-window.c6
-rw-r--r--libempathy-gtk/empathy-private-chat.c4
-rw-r--r--libempathy-gtk/empathy-status-icon.c13
-rw-r--r--libempathy-gtk/empathy-theme-boxes.c2
11 files changed, 39 insertions, 36 deletions
diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c
index f4ad7f316..af523180d 100644
--- a/libempathy-gtk/empathy-chat-view.c
+++ b/libempathy-gtk/empathy-chat-view.c
@@ -715,31 +715,19 @@ chat_view_avatar_cache_data_free (gpointer ptr)
GdkPixbuf *
empathy_chat_view_get_avatar_pixbuf_with_cache (EmpathyContact *contact)
{
- static GHashTable *avatar_cache = NULL;
AvatarData *data;
EmpathyAvatar *avatar;
GdkPixbuf *tmp_pixbuf;
GdkPixbuf *pixbuf = NULL;
- /* Init avatar cache */
- if (!avatar_cache) {
- avatar_cache = g_hash_table_new_full (empathy_contact_hash,
- empathy_contact_equal,
- g_object_unref,
- chat_view_avatar_cache_data_free);
- }
-
/* Check if avatar is in cache and if it's up to date */
avatar = empathy_contact_get_avatar (contact);
- data = g_hash_table_lookup (avatar_cache, contact);
+ data = g_object_get_data (G_OBJECT (contact), "chat-view-avatar-cache");
if (data) {
if (avatar && !tp_strdiff (avatar->token, data->token)) {
/* We have the avatar in cache */
return data->pixbuf;
}
-
- /* The cache is outdate */
- g_hash_table_remove (avatar_cache, contact);
}
/* Avatar not in cache, create pixbuf */
@@ -757,9 +745,8 @@ empathy_chat_view_get_avatar_pixbuf_with_cache (EmpathyContact *contact)
data->token = g_strdup (avatar->token);
data->pixbuf = pixbuf;
- g_hash_table_insert (avatar_cache,
- g_object_ref (contact),
- data);
+ g_object_set_data_full (G_OBJECT (contact), "chat-view-avatar-cache",
+ data, chat_view_avatar_cache_data_free);
return data->pixbuf;
}
diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c
index 5c3946e98..bbf66fbcf 100644
--- a/libempathy-gtk/empathy-chat-window.c
+++ b/libempathy-gtk/empathy-chat-window.c
@@ -37,7 +37,6 @@
#include <libmissioncontrol/mission-control.h>
#include <libempathy/empathy-contact-factory.h>
-#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-log-manager.h>
#include <libempathy/empathy-chatroom-manager.h>
#include <libempathy/empathy-contact.h>
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 3494b02fd..1b2fcccb2 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1211,7 +1211,7 @@ chat_state_changed_cb (EmpathyTpChat *tp_chat,
/* Find the contact in the list. After that l is the list elem or NULL */
for (l = priv->compositors; l; l = l->next) {
- if (empathy_contact_equal (contact, l->data)) {
+ if (contact == l->data) {
break;
}
}
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index e0785c3ce..1805213a6 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -53,7 +53,7 @@ contact_dialogs_find (GtkDialog *dialog,
contact_widget = g_object_get_data (G_OBJECT (dialog), "contact_widget");
this_contact = empathy_contact_widget_get_contact (contact_widget);
- return !empathy_contact_equal (contact, this_contact);
+ return contact != this_contact;
}
/*
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index 46fa99474..84c7223ff 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -880,7 +880,8 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
priv = GET_PRIV (store);
- if (!priv->show_offline && !empathy_contact_is_online (contact)) {
+ if (!(empathy_contact_get_ready (contact) & EMPATHY_CONTACT_READY_ID) ||
+ (!priv->show_offline && !empathy_contact_is_online (contact))) {
return;
}
@@ -1488,15 +1489,14 @@ contact_list_store_find_contact_foreach (GtkTreeModel *model,
EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
-1);
- if (!contact) {
- return FALSE;
- }
-
- if (empathy_contact_equal (contact, fc->contact)) {
+ if (contact == fc->contact) {
fc->found = TRUE;
fc->iters = g_list_append (fc->iters, gtk_tree_iter_copy (iter));
}
- g_object_unref (contact);
+
+ if (contact) {
+ g_object_unref (contact);
+ }
return FALSE;
}
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index b12387419..24174c8b7 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -774,6 +774,10 @@ contact_list_view_drag_data_received (GtkWidget *widget,
return;
}
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_HANDLE,
+ NULL);
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
/* Get source group information. */
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 0c3f40dc1..c0b4596de 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -306,9 +306,7 @@ static void
contact_widget_set_contact (EmpathyContactWidget *information,
EmpathyContact *contact)
{
- if (contact == information->contact ||
- (contact && information->contact &&
- empathy_contact_equal (contact, information->contact))) {
+ if (contact == information->contact) {
return;
}
@@ -512,6 +510,10 @@ contact_widget_change_contact (EmpathyContactWidget *information)
}
if (contact) {
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_HANDLE |
+ EMPATHY_CONTACT_READY_ID,
+ NULL);
contact_widget_set_contact (information, contact);
g_object_unref (contact);
}
diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c
index ca8a16abf..c447c473d 100644
--- a/libempathy-gtk/empathy-main-window.c
+++ b/libempathy-gtk/empathy-main-window.c
@@ -669,9 +669,15 @@ main_window_edit_personal_information_cb (GtkWidget *widget,
account = accounts->data;
factory = empathy_contact_factory_new ();
contact = empathy_contact_factory_get_user (factory, account);
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_HANDLE |
+ EMPATHY_CONTACT_READY_ID,
+ NULL);
+
empathy_contact_information_dialog_show (contact,
GTK_WINDOW (window->window),
TRUE, TRUE);
+
g_slist_foreach (accounts, (GFunc) g_object_unref, NULL);
g_slist_free (accounts);
g_object_unref (factory);
diff --git a/libempathy-gtk/empathy-private-chat.c b/libempathy-gtk/empathy-private-chat.c
index 4ee02e467..a8b2941aa 100644
--- a/libempathy-gtk/empathy-private-chat.c
+++ b/libempathy-gtk/empathy-private-chat.c
@@ -105,6 +105,10 @@ private_chat_constructor (GType type,
priv->contact = empathy_contact_factory_get_from_handle (priv->factory,
account,
tp_chan->handle);
+ empathy_contact_run_until_ready (priv->contact,
+ EMPATHY_CONTACT_READY_ID |
+ EMPATHY_CONTACT_READY_NAME,
+ NULL);
priv->name = g_strdup (empathy_contact_get_name (priv->contact));
diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c
index 9f10bd37e..241a2841f 100644
--- a/libempathy-gtk/empathy-status-icon.c
+++ b/libempathy-gtk/empathy-status-icon.c
@@ -418,6 +418,10 @@ status_icon_call_local_pending_cb (EmpathyTpGroup *group,
/* We are local pending, it's an incoming call, we need to ask
* the user if he wants to accept the call. */
+ empathy_contact_run_until_ready (member,
+ EMPATHY_CONTACT_READY_NAME,
+ NULL);
+
empathy_debug (DEBUG_DOMAIN, "INCOMING call, add event");
msg = g_strdup_printf (_("Incoming call from %s:\n%s"),
@@ -708,7 +712,6 @@ status_icon_pendings_changed_cb (EmpathyContactManager *manager,
EmpathyStatusIconPriv *priv;
StatusIconEvent *event;
GString *str;
- GList *l;
priv = GET_PRIV (icon);
@@ -717,11 +720,9 @@ status_icon_pendings_changed_cb (EmpathyContactManager *manager,
return;
}
- for (l = priv->events; l; l = l->next) {
- if (empathy_contact_equal (contact, ((StatusIconEvent*)l->data)->user_data)) {
- return;
- }
- }
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_NAME,
+ NULL);
str = g_string_new (NULL);
g_string_printf (str, _("Subscription requested by %s"),
diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c
index 7285a9e9e..4e6a272c0 100644
--- a/libempathy-gtk/empathy-theme-boxes.c
+++ b/libempathy-gtk/empathy-theme-boxes.c
@@ -573,7 +573,7 @@ theme_boxes_maybe_append_header (EmpathyTheme *theme,
}
else if (!from_self &&
(!empathy_chat_view_get_last_contact (view) ||
- !empathy_contact_equal (contact, empathy_chat_view_get_last_contact (view)))) {
+ !(contact == empathy_chat_view_get_last_contact (view)))) {
header = TRUE;
}