empathy r755 - in trunk: libempathy libempathy-gtk
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r755 - in trunk: libempathy libempathy-gtk
- Date: Tue, 11 Mar 2008 12:22:38 +0000 (GMT)
Author: xclaesse
Date: Tue Mar 11 12:22:37 2008
New Revision: 755
URL: http://svn.gnome.org/viewvc/empathy?rev=755&view=rev
Log:
Make sure we don't expect contact id and handle to be directly ready. Add some _run_until_ready.
Modified:
trunk/libempathy-gtk/empathy-chat-view.c
trunk/libempathy-gtk/empathy-chat-window.c
trunk/libempathy-gtk/empathy-chat.c
trunk/libempathy-gtk/empathy-contact-dialogs.c
trunk/libempathy-gtk/empathy-contact-list-store.c
trunk/libempathy-gtk/empathy-contact-list-view.c
trunk/libempathy-gtk/empathy-contact-widget.c
trunk/libempathy-gtk/empathy-main-window.c
trunk/libempathy-gtk/empathy-private-chat.c
trunk/libempathy-gtk/empathy-status-icon.c
trunk/libempathy-gtk/empathy-theme-boxes.c
trunk/libempathy/empathy-debug.c
trunk/libempathy/empathy-tp-call.c
trunk/libempathy/empathy-tp-chatroom.c
trunk/libempathy/empathy-tp-contact-factory.c
trunk/libempathy/empathy-tp-contact-list.c
trunk/libempathy/empathy-utils.c
Modified: trunk/libempathy-gtk/empathy-chat-view.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat-view.c (original)
+++ trunk/libempathy-gtk/empathy-chat-view.c Tue Mar 11 12:22:37 2008
@@ -715,31 +715,19 @@
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 @@
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;
}
Modified: trunk/libempathy-gtk/empathy-chat-window.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat-window.c (original)
+++ trunk/libempathy-gtk/empathy-chat-window.c Tue Mar 11 12:22:37 2008
@@ -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>
Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c (original)
+++ trunk/libempathy-gtk/empathy-chat.c Tue Mar 11 12:22:37 2008
@@ -1211,7 +1211,7 @@
/* 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;
}
}
Modified: trunk/libempathy-gtk/empathy-contact-dialogs.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-dialogs.c (original)
+++ trunk/libempathy-gtk/empathy-contact-dialogs.c Tue Mar 11 12:22:37 2008
@@ -53,7 +53,7 @@
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;
}
/*
Modified: trunk/libempathy-gtk/empathy-contact-list-store.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-list-store.c (original)
+++ trunk/libempathy-gtk/empathy-contact-list-store.c Tue Mar 11 12:22:37 2008
@@ -880,7 +880,8 @@
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 @@
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;
}
Modified: trunk/libempathy-gtk/empathy-contact-list-view.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-list-view.c (original)
+++ trunk/libempathy-gtk/empathy-contact-list-view.c Tue Mar 11 12:22:37 2008
@@ -774,6 +774,10 @@
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. */
Modified: trunk/libempathy-gtk/empathy-contact-widget.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-widget.c (original)
+++ trunk/libempathy-gtk/empathy-contact-widget.c Tue Mar 11 12:22:37 2008
@@ -306,9 +306,7 @@
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 @@
}
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);
}
Modified: trunk/libempathy-gtk/empathy-main-window.c
==============================================================================
--- trunk/libempathy-gtk/empathy-main-window.c (original)
+++ trunk/libempathy-gtk/empathy-main-window.c Tue Mar 11 12:22:37 2008
@@ -669,9 +669,15 @@
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);
Modified: trunk/libempathy-gtk/empathy-private-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-private-chat.c (original)
+++ trunk/libempathy-gtk/empathy-private-chat.c Tue Mar 11 12:22:37 2008
@@ -105,6 +105,10 @@
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));
Modified: trunk/libempathy-gtk/empathy-status-icon.c
==============================================================================
--- trunk/libempathy-gtk/empathy-status-icon.c (original)
+++ trunk/libempathy-gtk/empathy-status-icon.c Tue Mar 11 12:22:37 2008
@@ -418,6 +418,10 @@
/* 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 @@
EmpathyStatusIconPriv *priv;
StatusIconEvent *event;
GString *str;
- GList *l;
priv = GET_PRIV (icon);
@@ -717,11 +720,9 @@
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"),
Modified: trunk/libempathy-gtk/empathy-theme-boxes.c
==============================================================================
--- trunk/libempathy-gtk/empathy-theme-boxes.c (original)
+++ trunk/libempathy-gtk/empathy-theme-boxes.c Tue Mar 11 12:22:37 2008
@@ -573,7 +573,7 @@
}
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;
}
Modified: trunk/libempathy/empathy-debug.c
==============================================================================
--- trunk/libempathy/empathy-debug.c (original)
+++ trunk/libempathy/empathy-debug.c Tue Mar 11 12:22:37 2008
@@ -54,9 +54,11 @@
const gchar *env;
gint i;
- env = g_getenv ("EMPATHY_DEBUG");
+ env = g_getenv ("TELEPATHY_GLIB_DEBUG");
tp_debug_set_flags (env);
+ env = g_getenv ("EMPATHY_DEBUG");
+
if (env) {
debug_strv = g_strsplit_set (env, ":, ", 0);
} else {
Modified: trunk/libempathy/empathy-tp-call.c
==============================================================================
--- trunk/libempathy/empathy-tp-call.c (original)
+++ trunk/libempathy/empathy-tp-call.c Tue Mar 11 12:22:37 2008
@@ -392,7 +392,6 @@
tp_call_is_ready (EmpathyTpCall *call)
{
EmpathyTpCallPriv *priv = GET_PRIV (call);
- EmpathyContact *self_contact;
GList *members;
GList *local_pendings;
GList *remote_pendings;
@@ -404,13 +403,11 @@
if (!members)
return;
- self_contact = empathy_tp_group_get_self_contact (priv->group);
local_pendings = empathy_tp_group_get_local_pendings (priv->group);
remote_pendings = empathy_tp_group_get_remote_pendings (priv->group);
if (local_pendings &&
- empathy_contact_equal (EMPATHY_CONTACT (((EmpathyPendingInfo *)
- local_pendings->data)->member), self_contact))
+ empathy_contact_is_user (((EmpathyPendingInfo *) local_pendings->data)->member))
{
empathy_debug (DEBUG_DOMAIN,
"Incoming call is ready - %p",
@@ -418,8 +415,7 @@
priv->is_incoming = TRUE;
priv->contact = g_object_ref (members->data);
}
- else if (remote_pendings &&
- empathy_contact_equal (EMPATHY_CONTACT (members->data), self_contact))
+ else if (remote_pendings && empathy_contact_is_user (members->data))
{
empathy_debug (DEBUG_DOMAIN,
"Outgoing call is ready - %p", remote_pendings->data);
@@ -428,7 +424,6 @@
tp_call_request_streams (call);
}
- g_object_unref (self_contact);
g_list_foreach (members, (GFunc) g_object_unref, NULL);
g_list_free (members);
g_list_foreach (local_pendings, (GFunc) empathy_pending_info_free, NULL);
@@ -458,10 +453,8 @@
if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING)
{
- if ((priv->is_incoming &&
- !empathy_contact_equal (contact, priv->contact))
- || (!priv->is_incoming &&
- empathy_contact_equal (contact, priv->contact)))
+ if ((priv->is_incoming && contact != priv->contact) ||
+ (!priv->is_incoming && contact == priv->contact))
{
priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
g_signal_emit (call, signals[STATUS_CHANGED_SIGNAL], 0);
@@ -831,17 +824,13 @@
empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
{
EmpathyTpCallPriv *priv = GET_PRIV (call);
- GList *local_pendings;
+ EmpathyContact *self_contact;
empathy_debug (DEBUG_DOMAIN, "Accepting incoming call");
- local_pendings = empathy_tp_group_get_local_pendings (priv->group);
-
- empathy_tp_group_add_member (priv->group, EMPATHY_CONTACT
- (((EmpathyPendingInfo *) local_pendings->data)->member), NULL);
-
- g_list_foreach (local_pendings, (GFunc) empathy_pending_info_free, NULL);
- g_list_free (local_pendings);
+ self_contact = empathy_tp_group_get_self_contact (priv->group);
+ empathy_tp_group_add_member (priv->group, self_contact, NULL);
+ g_object_unref (self_contact);
}
void
Modified: trunk/libempathy/empathy-tp-chatroom.c
==============================================================================
--- trunk/libempathy/empathy-tp-chatroom.c (original)
+++ trunk/libempathy/empathy-tp-chatroom.c Tue Mar 11 12:22:37 2008
@@ -46,18 +46,6 @@
static void tp_chatroom_iface_init (EmpathyContactListIface *iface);
static void empathy_tp_chatroom_init (EmpathyTpChatroom *chatroom);
static void tp_chatroom_finalize (GObject *object);
-static void tp_chatroom_member_added_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom);
-static void tp_chatroom_member_removed_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom);
static void tp_chatroom_add (EmpathyContactList *list,
EmpathyContact *contact,
const gchar *message);
@@ -114,14 +102,59 @@
G_OBJECT_CLASS (empathy_tp_chatroom_parent_class)->finalize (object);
}
+static void
+tp_chatroom_member_added_cb (EmpathyTpGroup *group,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ const gchar *message,
+ EmpathyTpChatroom *chatroom)
+{
+ g_signal_emit_by_name (chatroom, "members-changed",
+ contact, actor, reason, message,
+ TRUE);
+}
+
+static void
+tp_chatroom_member_removed_cb (EmpathyTpGroup *group,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ const gchar *message,
+ EmpathyTpChatroom *chatroom)
+{
+ g_signal_emit_by_name (chatroom, "members-changed",
+ contact, actor, reason, message,
+ FALSE);
+}
+static void
+tp_chatroom_local_pending_cb (EmpathyTpGroup *group,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ const gchar *message,
+ EmpathyTpChatroom *chatroom)
+{
+ EmpathyTpChatroomPriv *priv = GET_PRIV (chatroom);
+
+ if (empathy_contact_is_user (contact)) {
+ priv->invitor = g_object_ref (actor);
+ priv->invit_message = g_strdup (message);
+ priv->is_invited = TRUE;
+
+ empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s (%d): %s",
+ empathy_contact_get_id (priv->invitor),
+ empathy_contact_get_handle (priv->invitor),
+ priv->invit_message);
+ }
+}
+
EmpathyTpChatroom *
empathy_tp_chatroom_new (McAccount *account,
TpChan *tp_chan)
{
EmpathyTpChatroomPriv *priv;
EmpathyTpChatroom *chatroom;
- GList *members, *l;
- EmpathyContact *user;
g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL);
@@ -142,32 +175,9 @@
g_signal_connect (priv->group, "member-removed",
G_CALLBACK (tp_chatroom_member_removed_cb),
chatroom);
-
- /* Check if we are invited to join the chat */
- user = empathy_tp_group_get_self_contact (priv->group);
- members = empathy_tp_group_get_local_pendings (priv->group);
- for (l = members; l; l = l->next) {
- EmpathyPendingInfo *info;
-
- info = l->data;
-
- if (!empathy_contact_equal (user, info->member)) {
- continue;
- }
-
- priv->invitor = g_object_ref (info->actor);
- priv->invit_message = g_strdup (info->message);
- priv->is_invited = TRUE;
-
- empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s (%d): %s",
- empathy_contact_get_id (priv->invitor),
- empathy_contact_get_handle (priv->invitor),
- priv->invit_message);
- }
-
- g_list_foreach (members, (GFunc) empathy_pending_info_free, NULL);
- g_list_free (members);
- g_object_unref (user);
+ g_signal_connect (priv->group, "local-pending",
+ G_CALLBACK (tp_chatroom_local_pending_cb),
+ chatroom);
return chatroom;
}
@@ -230,32 +240,6 @@
}
static void
-tp_chatroom_member_added_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom)
-{
- g_signal_emit_by_name (chatroom, "members-changed",
- contact, actor, reason, message,
- TRUE);
-}
-
-static void
-tp_chatroom_member_removed_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom)
-{
- g_signal_emit_by_name (chatroom, "members-changed",
- contact, actor, reason, message,
- FALSE);
-}
-
-static void
tp_chatroom_add (EmpathyContactList *list,
EmpathyContact *contact,
const gchar *message)
Modified: trunk/libempathy/empathy-tp-contact-factory.c
==============================================================================
--- trunk/libempathy/empathy-tp-contact-factory.c (original)
+++ trunk/libempathy/empathy-tp-contact-factory.c Tue Mar 11 12:22:37 2008
@@ -731,6 +731,8 @@
return;
}
+ empathy_debug (DEBUG_DOMAIN, "Connection ready");
+
empathy_contact_set_handle (priv->user, handle);
priv->ready = TRUE;
Modified: trunk/libempathy/empathy-tp-contact-list.c
==============================================================================
--- trunk/libempathy/empathy-tp-contact-list.c (original)
+++ trunk/libempathy/empathy-tp-contact-list.c Tue Mar 11 12:22:37 2008
@@ -710,8 +710,8 @@
priv->tp_conn = tp_conn;
priv->account = g_object_ref (account);
priv->mc = mc;
- priv->contacts_groups = g_hash_table_new_full (empathy_contact_hash,
- empathy_contact_equal,
+ priv->contacts_groups = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
(GDestroyNotify) g_object_unref,
(GDestroyNotify) tp_contact_list_group_list_free);
Modified: trunk/libempathy/empathy-utils.c
==============================================================================
--- trunk/libempathy/empathy-utils.c (original)
+++ trunk/libempathy/empathy-utils.c Tue Mar 11 12:22:37 2008
@@ -452,6 +452,10 @@
group = empathy_tp_group_new (account, new_chan);
factory = empathy_contact_factory_new ();
self_contact = empathy_contact_factory_get_user (factory, account);
+ empathy_contact_run_until_ready (self_contact,
+ EMPATHY_CONTACT_READY_HANDLE,
+ NULL);
+
empathy_tp_group_add_member (group, contact, "");
empathy_tp_group_add_member (group, self_contact, "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]