aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:25:51 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:25:51 +0800
commitbb72ecfe92b2bb7e064e5329824d93b5398d896d (patch)
treeab05b4bae9c12ea059d5e9bf68289904cbd55ee6
parent0acfe96c871769588618423e547ffbf5b64556a7 (diff)
downloadgsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.tar
gsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.tar.gz
gsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.tar.bz2
gsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.tar.lz
gsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.tar.xz
gsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.tar.zst
gsoc2013-empathy-bb72ecfe92b2bb7e064e5329824d93b5398d896d.zip
EmpathyTpContactFactory: get avatar requirements before becoming ready.
svn path=/trunk/; revision=1672
-rw-r--r--libempathy/empathy-tp-contact-factory.c63
1 files changed, 54 insertions, 9 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index 85921d0b2..91295ee18 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -44,7 +44,7 @@ typedef struct {
EmpathyContact *user;
gpointer token;
- const gchar **avatar_mime_types;
+ gchar **avatar_mime_types;
guint avatar_min_width;
guint avatar_min_height;
guint avatar_max_width;
@@ -61,7 +61,17 @@ enum {
};
/* Prototypes */
-static void tp_contact_factory_maybe_ready (EmpathyTpContactFactory *tp_factory);
+static void tp_contact_factory_got_avatar_requirements_cb (TpConnection *proxy,
+ const gchar **mime_types,
+ guint min_width,
+ guint min_height,
+ guint max_width,
+ guint max_height,
+ guint max_size,
+ const GError *error,
+ gpointer user_data,
+ GObject *tp_factory);
+static void tp_contact_factory_ready (EmpathyTpContactFactory *tp_factory);
static EmpathyContact *
@@ -739,11 +749,51 @@ tp_contact_factory_got_self_handle_cb (TpConnection *proxy,
empathy_contact_set_handle (priv->user, handle);
- tp_contact_factory_maybe_ready (EMPATHY_TP_CONTACT_FACTORY (tp_factory));
+ /* Get avatar requirements for this connection */
+ tp_cli_connection_interface_avatars_call_get_avatar_requirements (
+ priv->connection,
+ -1,
+ tp_contact_factory_got_avatar_requirements_cb,
+ NULL, NULL,
+ tp_factory);
}
+
+static void
+tp_contact_factory_got_avatar_requirements_cb (TpConnection *proxy,
+ const gchar **mime_types,
+ guint min_width,
+ guint min_height,
+ guint max_width,
+ guint max_height,
+ guint max_size,
+ const GError *error,
+ gpointer user_data,
+ GObject *tp_factory)
+{
+ EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
+
+ if (error) {
+ DEBUG ("Failed to get avatar requirements: %s", error->message);
+ /* We'll just leave avatar_mime_types as NULL; the
+ * avatar-setting code can use this as a signal that you can't
+ * set avatars.
+ */
+ } else {
+ priv->avatar_mime_types = g_strdupv ((gchar **)mime_types);
+ priv->avatar_min_width = min_width;
+ priv->avatar_min_height = min_height;
+ priv->avatar_max_width = max_width;
+ priv->avatar_max_height = max_height;
+ priv->avatar_max_size = max_size;
+ }
+
+ tp_contact_factory_ready (EMPATHY_TP_CONTACT_FACTORY (tp_factory));
+}
+
+
static void
-tp_contact_factory_maybe_ready (EmpathyTpContactFactory *tp_factory)
+tp_contact_factory_ready (EmpathyTpContactFactory *tp_factory)
{
EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
GList *l;
@@ -752,11 +802,6 @@ tp_contact_factory_maybe_ready (EmpathyTpContactFactory *tp_factory)
GList *handle_needed_contacts = NULL;
GList *id_needed_contacts = NULL;
- if (empathy_contact_get_handle (priv->user) == 0) {
- DEBUG ("Connection not ready: still waiting for self handle");
- return;
- }
-
DEBUG ("Connection ready");
priv->ready = TRUE;