[polari] chatView: Activate the correct room when clicking a notification
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatView: Activate the correct room when clicking a notification
- Date: Fri, 25 Oct 2013 10:19:22 +0000 (UTC)
commit 7733408509ed6b0d90c4b3fe3072208df8fa7703
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Oct 25 11:48:56 2013 +0200
chatView: Activate the correct room when clicking a notification
Clicking a notification should not only activate Polari, but also
switch to the room where the mention was made. Implement this
using an appropriate default action.
https://bugzilla.gnome.org/show_bug.cgi?id=710811
src/chatView.js | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 79efec7..bf9242a 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -11,6 +11,7 @@ const Utils = imports.utils;
const MAX_NICK_CHARS = 8;
const IGNORE_STATUS_TIME = 5;
+const TP_CURRENT_TIME = GLib.MAXUINT32;
// Workaround for GtkTextView growing horizontally over time when
// added to a GtkScrolledWindow with horizontal scrolling disabled
@@ -385,6 +386,18 @@ const ChatView = new Lang.Class({
if (!this._toplevelFocus) {
let summary = '%s %s'.format(this._room.display_name, nick);
let notification = new Notify.Notification(summary, text);
+
+ let account = this._room.channel.connection.get_account();
+ let param = GLib.Variant.new('(ssu)',
+ [ account.get_object_path(),
+ this._room.channel.identifier,
+ TP_CURRENT_TIME ]);
+ notification.addAction('default', 'default');
+ notification.connect('action-invoked', function() {
+ let app = Gio.Application.get_default();
+ let action = app.lookup_action('join-room');
+ action.activate(param);
+ });
notification.show();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]