summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-02 20:05:32 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-02 20:05:32 +0100
commit6137a5a2350bdb61c3d850bb14c3ab5448ea906a (patch)
treeea895ea1ff63fece0ad2bc6325398ac7669322b2
parentfd88c773e6c538b54e71b88bd8d1bdd6ac759d9b (diff)
parent96cfbd0e8401ab06b729cfa5b092d5939899dc6b (diff)
Merge branch 'telepathy-glib-0.22' into next
For simplicity I just left out the NEWS update. We'll get that along with the merge of 0.23. Conflicts: NEWS configure.ac telepathy-glib/contact.c
-rw-r--r--telepathy-glib/contact.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index c205027c7..f56f9fc44 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -42,6 +42,15 @@
#include "telepathy-glib/util-internal.h"
#include "telepathy-glib/variant-util-internal.h"
+static const gchar *
+nonnull (const gchar *s)
+{
+ if (s == NULL)
+ return "(null)";
+
+ return s;
+}
+
/**
* SECTION:contact
* @title: TpContact
@@ -2117,18 +2126,28 @@ mime_file_written (GObject *source_object,
self = g_weak_ref_get (&avatar_data->contact);
- if (self != NULL)
+ if (self == NULL)
+ {
+ DEBUG ("No relevant TpContact");
+ }
+ else if (tp_strdiff (avatar_data->token, self->priv->avatar_token))
+ {
+ DEBUG ("Contact's avatar token has changed from %s to %s, "
+ "this avatar is no longer relevant",
+ avatar_data->token, nonnull (self->priv->avatar_token));
+ }
+ else
{
+ DEBUG ("Saved avatar '%s' of MIME type '%s' still used by '%s' to '%s'",
+ avatar_data->token, avatar_data->mime_type,
+ self->priv->identifier,
+ g_file_get_path (avatar_data->file));
g_clear_object (&self->priv->avatar_file);
self->priv->avatar_file = g_object_ref (avatar_data->file);
g_free (self->priv->avatar_mime_type);
self->priv->avatar_mime_type = g_strdup (avatar_data->mime_type);
- /* Update the avatar token if a newer one is given
- * (this emits notify::avatar-token if needed) */
- contact_set_avatar_token (self, avatar_data->token, FALSE);
-
/* Notify both property changes together once both files have been
* written */
g_object_notify ((GObject *) self, "avatar-mime-type");
@@ -2184,6 +2203,13 @@ contact_avatar_retrieved (TpConnection *connection,
gchar *mime_filename;
WriteAvatarData *avatar_data;
+ if (self != NULL)
+ {
+ /* Update the avatar token if a newer one is given
+ * (this emits notify::avatar-token if needed) */
+ contact_set_avatar_token (self, token, FALSE);
+ }
+
if (!build_avatar_filename (connection, token, TRUE, &filename,
&mime_filename))
return;