aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <treitter@gmail.com>2010-07-08 10:46:05 +0800
committerTravis Reitter <treitter@gmail.com>2010-07-21 07:12:36 +0800
commit980fc7fda64a1c2e5a9de44858362e7211aa7a32 (patch)
tree01437a83891e3e01ff9573f768d576e77ab0ece0
parentbd01a33901d5b12a07630e2b3e862838baa0369c (diff)
downloadgsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.tar
gsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.tar.gz
gsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.tar.bz2
gsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.tar.lz
gsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.tar.xz
gsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.tar.zst
gsoc2013-empathy-980fc7fda64a1c2e5a9de44858362e7211aa7a32.zip
Create a constructor for PixbufAvatarFromIndividualClosure.
-rw-r--r--libempathy-gtk/empathy-ui-utils.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 83fbc636e..0b947243e 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -527,6 +527,27 @@ typedef struct {
guint height;
} PixbufAvatarFromIndividualClosure;
+static PixbufAvatarFromIndividualClosure *
+pixbuf_avatar_from_individual_closure_new (FolksIndividual *individual,
+ gint width,
+ gint height,
+ EmpathyPixbufAvatarFromIndividualCb callback,
+ gpointer user_data)
+{
+ PixbufAvatarFromIndividualClosure *closure;
+
+ g_return_val_if_fail (FOLKS_IS_INDIVIDUAL (individual), NULL);
+
+ closure = g_new0 (PixbufAvatarFromIndividualClosure, 1);
+ closure->individual = g_object_ref (individual);
+ closure->callback = callback;
+ closure->user_data = user_data;
+ closure->width = width;
+ closure->height = height;
+
+ return closure;
+}
+
static void
pixbuf_avatar_from_individual_closure_free (
PixbufAvatarFromIndividualClosure *closure)
@@ -601,22 +622,16 @@ empathy_pixbuf_avatar_from_individual_scaled_async (FolksIndividual
GFile *avatar_file;
PixbufAvatarFromIndividualClosure *closure;
- if (!FOLKS_IS_INDIVIDUAL (individual)) {
- DEBUG ("failed assertion: FOLKS_IS_INDIVIDUAL (individual)");
- goto out;
- }
-
avatar_file = folks_avatar_get_avatar (FOLKS_AVATAR (individual));
if (avatar_file == NULL) {
goto out;
}
- closure = g_new0 (PixbufAvatarFromIndividualClosure, 1);
- closure->individual = g_object_ref (individual);
- closure->callback = callback;
- closure->user_data = user_data;
- closure->width = width;
- closure->height = height;
+ closure = pixbuf_avatar_from_individual_closure_new (individual, width,
+ height, callback,
+ user_data);
+ if (closure == NULL)
+ goto out;
g_file_load_contents_async (avatar_file, NULL,
avatar_file_load_contents_cb, closure);