[gnome-contacts] Set chat button icon based on presence
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Set chat button icon based on presence
- Date: Tue, 20 Dec 2011 22:04:11 +0000 (UTC)
commit 617263082d1ce84d9d0c07c275c91dd15c858d9b
Author: Alexander Larsson <alexl redhat com>
Date: Tue Dec 20 23:02:19 2011 +0100
Set chat button icon based on presence
See bug #666520
src/contacts-contact-pane.vala | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index e8a7665..49bbdb4 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -1654,6 +1654,7 @@ public class Contacts.ContactPane : ScrolledWindow {
var im_keys = ims.get_keys ();
bool found_im = false;
bool callable = false;
+ PresenceType max_presence = 0;
foreach (var protocol in im_keys) {
foreach (var id in ims[protocol]) {
var im_persona = contact.find_im_persona (protocol, id.value);
@@ -1661,8 +1662,11 @@ public class Contacts.ContactPane : ScrolledWindow {
var type = im_persona.presence_type;
if (type != PresenceType.UNSET &&
type != PresenceType.ERROR &&
- type != PresenceType.OFFLINE)
+ type != PresenceType.OFFLINE) {
found_im = true;
+ if (type > max_presence)
+ max_presence = type;
+ }
}
if (contact.is_callable (protocol, id.value) != null)
@@ -1676,6 +1680,12 @@ public class Contacts.ContactPane : ScrolledWindow {
callable = true;
}
+ string icon;
+ if (found_im)
+ icon = Contact.presence_to_icon_symbolic (max_presence);
+ else
+ icon = "user-available-symbolic";
+ (chat_button.get_child () as Image).set_from_icon_name (icon, IconSize.MENU);
chat_button.set_sensitive (found_im);
if (callable)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]