summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-05-15 11:12:46 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-05-15 11:12:46 +0200
commitc6cd0c450c594e7c09372c9b052d7d9ec1c94191 (patch)
tree82fbd5ad7ba2e51a1dbc5fafe60ff1653088e60b
parent3771e3f6e1ce13690e6fa075a796f6ed466615d2 (diff)
base-protocol: get_avatar_details() now return a boolean
This allows Haze to indicate that it doesn't actually support avatars for some protocols. Fix https://bugs.freedesktop.org/show_bug.cgi?id=78381
-rw-r--r--examples/cm/echo-message-parts/protocol.c4
-rw-r--r--telepathy-glib/base-protocol.c9
-rw-r--r--telepathy-glib/base-protocol.h2
3 files changed, 9 insertions, 6 deletions
diff --git a/examples/cm/echo-message-parts/protocol.c b/examples/cm/echo-message-parts/protocol.c
index d18f8a431..5c1c294cf 100644
--- a/examples/cm/echo-message-parts/protocol.c
+++ b/examples/cm/echo-message-parts/protocol.c
@@ -165,7 +165,7 @@ get_connection_details (TpBaseProtocol *self G_GNUC_UNUSED,
}
}
-static void
+static gboolean
get_avatar_details (TpBaseProtocol *self,
GStrv *supported_mime_types,
guint *min_height,
@@ -199,6 +199,8 @@ get_avatar_details (TpBaseProtocol *self,
if (max_bytes != NULL)
*max_bytes = 37748736;
+
+ return TRUE;
}
static GStrv
diff --git a/telepathy-glib/base-protocol.c b/telepathy-glib/base-protocol.c
index e18507d78..23f50b466 100644
--- a/telepathy-glib/base-protocol.c
+++ b/telepathy-glib/base-protocol.c
@@ -404,6 +404,8 @@ tp_cm_param_filter_string_nonempty (const TpCMParamSpec *paramspec,
* Signature of a virtual method to get the supported avatar details for the
* protocol implemented by @self.
*
+ * Returns: %TRUE if @self actually supports avatars and all the variables
+ * have been to set a meaningful value, %FALSE otherwise
* Since: 0.13.7
*/
@@ -682,8 +684,7 @@ tp_base_protocol_constructed (GObject *object)
self->priv->vcard_field = g_strdup ("");
}
- if (cls->get_avatar_details != NULL)
- {
+ if (cls->get_avatar_details != NULL &&
(cls->get_avatar_details) (self,
&self->priv->avatar_specs.supported_mime_types,
&self->priv->avatar_specs.min_height,
@@ -692,8 +693,8 @@ tp_base_protocol_constructed (GObject *object)
&self->priv->avatar_specs.rec_width,
&self->priv->avatar_specs.max_height,
&self->priv->avatar_specs.max_width,
- &self->priv->avatar_specs.max_bytes);
-
+ &self->priv->avatar_specs.max_bytes))
+ {
object_skeleton_take_svc_interface (skel,
TP_TYPE_SVC_PROTOCOL_INTERFACE_AVATARS1);
}
diff --git a/telepathy-glib/base-protocol.h b/telepathy-glib/base-protocol.h
index e77ea0809..c00701d91 100644
--- a/telepathy-glib/base-protocol.h
+++ b/telepathy-glib/base-protocol.h
@@ -127,7 +127,7 @@ typedef void (*TpBaseProtocolGetConnectionDetailsFunc) (TpBaseProtocol *self,
gchar **english_name,
gchar **vcard_field);
-typedef void (*TpBaseProtocolGetAvatarDetailsFunc) (TpBaseProtocol *self,
+typedef gboolean (*TpBaseProtocolGetAvatarDetailsFunc) (TpBaseProtocol *self,
GStrv *supported_mime_types,
guint *min_height,
guint *min_width,