[empathy] individual-widget: don't display unknown presence
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] individual-widget: don't display unknown presence
- Date: Fri, 6 Jul 2012 09:33:25 +0000 (UTC)
commit 20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Jun 29 14:35:45 2012 +0200
individual-widget: don't display unknown presence
Best to to not show anything than showing we don't know.
https://bugzilla.gnome.org/show_bug.cgi?id=679136
libempathy-gtk/empathy-individual-widget.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c
index e103eff..a5eb3c9 100644
--- a/libempathy-gtk/empathy-individual-widget.c
+++ b/libempathy-gtk/empathy-individual-widget.c
@@ -1214,6 +1214,8 @@ notify_presence_cb (gpointer folks_object,
GtkWidget *status_label, *state_image;
const gchar *message;
gchar *markup_text = NULL;
+ FolksPresenceType presence;
+ gboolean visible = TRUE;
if (FOLKS_IS_INDIVIDUAL (folks_object))
grid = G_OBJECT (priv->individual_grid);
@@ -1228,14 +1230,22 @@ notify_presence_cb (gpointer folks_object,
status_label = g_object_get_data (grid, "status-label");
state_image = g_object_get_data (grid, "state-image");
+ presence = folks_presence_details_get_presence_type (
+ FOLKS_PRESENCE_DETAILS (folks_object));
+ if (presence == FOLKS_PRESENCE_TYPE_UNKNOWN ||
+ presence == FOLKS_PRESENCE_TYPE_ERROR)
+ {
+ /* Don't display anything if we don't know the presence */
+ visible = FALSE;
+ goto out;
+ }
+
/* FIXME: Default messages should be moved into libfolks (bgo#627403) */
message = folks_presence_details_get_presence_message (
FOLKS_PRESENCE_DETAILS (folks_object));
if (EMP_STR_EMPTY (message))
{
- message = empathy_presence_get_default_message (
- folks_presence_details_get_presence_type (
- FOLKS_PRESENCE_DETAILS (folks_object)));
+ message = empathy_presence_get_default_message (presence);
}
if (message != NULL)
@@ -1244,11 +1254,12 @@ notify_presence_cb (gpointer folks_object,
g_free (markup_text);
gtk_image_set_from_icon_name (GTK_IMAGE (state_image),
- empathy_icon_name_for_presence (
- folks_presence_details_get_presence_type (
- FOLKS_PRESENCE_DETAILS (folks_object))),
+ empathy_icon_name_for_presence (presence),
GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (state_image);
+
+out:
+ gtk_widget_set_visible (status_label, visible);
+ gtk_widget_set_visible (state_image, visible);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]