[gnome-contacts] Show im_addresses of the Contact.
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Show im_addresses of the Contact.
- Date: Tue, 18 Dec 2012 21:25:08 +0000 (UTC)
commit 319b854f5119a785235fe1fb17cb09a0eb28fe7c
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Mon Dec 17 15:34:06 2012 -0500
Show im_addresses of the Contact.
src/contacts-contact-pane.vala | 38 --------------------------------------
src/contacts-contact-sheet.vala | 24 +++++++++++++++++++++++-
2 files changed, 23 insertions(+), 39 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index c4d50bc..75fc9b1 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -207,44 +207,6 @@ public class Contacts.ContactPane : Grid {
update_sheet ();
}
- struct ImValue {
- string protocol;
- string id;
- string name;
- }
-
- public void start_chat () {
- var ims = contact.individual.im_addresses;
- var im_keys = ims.get_keys ();
- var online_personas = new ArrayList<ImValue?>();
- if (contact != null) {
- foreach (var protocol in im_keys) {
- foreach (var id in ims[protocol]) {
- var im_persona = contact.find_im_persona (protocol, id.value);
- if (im_persona != null) {
- var type = im_persona.presence_type;
- if (type != PresenceType.UNSET &&
- type != PresenceType.ERROR &&
- type != PresenceType.OFFLINE &&
- type != PresenceType.UNKNOWN) {
- ImValue? value = { protocol, id.value, Contact.format_im_name (im_persona, protocol, id.value) };
- online_personas.add (value);
- }
- }
- }
- }
- }
-
- if (online_personas.is_empty)
- return;
-
- if (online_personas.size == 1) {
- foreach (var value in online_personas) {
- Utils.start_chat (contact, value.protocol, value.id);
- }
- }
- }
-
public ContactPane (Store contacts_store) {
this.set_orientation (Orientation.VERTICAL);
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index a96bcbe..6a91502 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -117,7 +117,6 @@ public class Contacts.ContactSheet : Grid {
last_store_position = ++i;
}
- /* FIXME: add all of these: postal-addresses */
var details = p as EmailDetails;
if (details != null) {
var emails = Contact.sort_fields<EmailFieldDetails>(details.email_addresses);
@@ -144,6 +143,29 @@ public class Contacts.ContactSheet : Grid {
}
}
+ var im_details = p as ImDetails;
+ if (im_details != null) {
+ foreach (var protocol in im_details.im_addresses.get_keys ()) {
+ foreach (var id in im_details.im_addresses[protocol]) {
+ if (p is Tpf.Persona) {
+ var button = add_row_with_button (ref i, Contact.format_im_service (protocol, null), id.value);
+ button.clicked.connect (() => {
+ var im_persona = c.find_im_persona (protocol, id.value);
+ if (im_persona != null) {
+ var type = im_persona.presence_type;
+ if (type != PresenceType.UNSET &&
+ type != PresenceType.ERROR &&
+ type != PresenceType.OFFLINE &&
+ type != PresenceType.UNKNOWN) {
+ Utils.start_chat (c, protocol, id.value);
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+
var url_details = p as UrlDetails;
if (url_details != null) {
foreach (var url in url_details.urls) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]