[gnome-contacts] Quick hack to launch chat if clicked
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Quick hack to launch chat if clicked
- Date: Thu, 19 May 2011 14:31:01 +0000 (UTC)
commit 972afba7e5b0d68e4e46456d59927ed0e05b7dc5
Author: Alexander Larsson <alexl redhat com>
Date: Thu May 19 16:29:33 2011 +0200
Quick hack to launch chat if clicked
src/contacts-app.vala | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index bb5cf24..9e40752 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -299,6 +299,26 @@ public class Contacts.App : Window {
presence.set_hexpand (true);
row.grid.add (presence);
}
+
+ var im_persona = contact.find_im_persona (protocol, id);
+
+ if (im_persona != null) {
+ row.clickable.clicked.connect ( () => {
+ try {
+ var account = (im_persona.store as Tpf.PersonaStore).account;
+ var request_dict = new HashTable<weak string,GLib.Value?>(str_hash, str_equal);
+ request_dict.insert (TelepathyGLib.PROP_CHANNEL_CHANNEL_TYPE, TelepathyGLib.IFACE_CHANNEL_TYPE_TEXT);
+ request_dict.insert (TelepathyGLib.PROP_CHANNEL_TARGET_HANDLE_TYPE, (int) TelepathyGLib.HandleType.CONTACT);
+ request_dict.insert (TelepathyGLib.PROP_CHANNEL_TARGET_ID, id);
+
+ // TODO: Should really use the event time like:
+ // tp_user_action_time_from_x11(gtk_get_current_event_time())
+ var request = new TelepathyGLib.AccountChannelRequest(account, request_dict, int64.MAX);
+ request.ensure_channel_async.begin ("org.freedesktop.Telepathy.Client.Empathy.Chat", null);
+ } catch {
+ }
+ });
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]