static GdkPixbuf * get_persona_status_icon (EmpathyPersonaStore *self, FolksPersona *persona) { EmpathyPersonaStorePriv *priv = GET_PRIV (self); EmpathyContact *contact; const gchar *protocol_name = NULL; gchar *icon_name = NULL; GdkPixbuf *pixbuf_status = NULL; const gchar *status_icon_name = NULL; contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact ( TPF_PERSONA (persona))); status_icon_name = empathy_icon_name_for_contact (contact); if (status_icon_name == NULL) { g_object_unref (contact); return NULL; } if (priv->show_protocols) { protocol_name = empathy_protocol_name_for_contact (contact); icon_name = g_strdup_printf ("%s-%s", status_icon_name, protocol_name); } else { icon_name = g_strdup_printf ("%s", status_icon_name); } pixbuf_status = g_hash_table_lookup (priv->status_icons, icon_name); if (pixbuf_status == NULL) { pixbuf_status = empathy_pixbuf_contact_status_icon_with_icon_name ( contact, status_icon_name, priv->show_protocols); if (pixbuf_status != NULL) { g_hash_table_insert (priv->status_icons, g_strdup (icon_name), pixbuf_status); } } g_object_unref (contact); g_free (icon_name); return pixbuf_status; }
GdkPixbuf * empathy_pixbuf_contact_status_icon (EmpathyContact *contact, gboolean show_protocol) { const gchar *icon_name; g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); icon_name = empathy_icon_name_for_contact (contact); if (icon_name == NULL) return NULL; return empathy_pixbuf_contact_status_icon_with_icon_name (contact, icon_name, show_protocol); }