diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-29 20:35:45 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-06 17:31:00 +0800 |
commit | 20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa (patch) | |
tree | eae11a074a702404b22e87a3639c10e838dac787 | |
parent | 7615fb3d04356ebb2155a8e335db6eb995dac66d (diff) | |
download | gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.tar gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.tar.gz gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.tar.bz2 gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.tar.lz gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.tar.xz gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.tar.zst gsoc2013-empathy-20a4ffc16a3eaf4ea5859ccd3d2f8c1d364441aa.zip |
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
-rw-r--r-- | 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 e103eff6d..a5eb3c99e 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 |