[polari/wip/bastianilso/status-hiding: 2/2] chatView: Click to expand functionality on status summaries
- From: Bastian Ilsø Hougaard <bastianilso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/bastianilso/status-hiding: 2/2] chatView: Click to expand functionality on status summaries
- Date: Fri, 26 Jun 2015 19:34:53 +0000 (UTC)
commit 1740836e2f2e7d4c3391e1e149bfb216c9916857
Author: Bastian Ilsø <bastianilso src gnome org>
Date: Fri Jun 26 19:57:01 2015 +0200
chatView: Click to expand functionality on status summaries
Makes it possible to expand status summaries, should one
desire to do so.
https://bugzilla.gnome.org/show_bug.cgi?id=711542
src/chatView.js | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 51e684f..a3a5bbd 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -184,6 +184,8 @@ const ChatView = new Lang.Class({
left_margin: MARGIN },
{ name: 'url',
underline: Pango.Underline.SINGLE },
+ { name: 'expandable',
+ underline: Pango.Underline.SINGLE },
{ name: 'loading',
justification: Gtk.Justification.CENTER }
];
@@ -484,6 +486,7 @@ const ChatView = new Lang.Class({
let tags = iter.get_tags();
for (let i = 0; i < tags.length; i++) {
let url = tags[i]._url;
+ let statusTexts = tags[i]._statusTexts
if (url) {
if (url.indexOf(':') == -1)
url = 'http://' + url;
@@ -499,6 +502,19 @@ const ChatView = new Lang.Class({
return Gdk.EVENT_STOP;
}
break;
+ } else if (statusTexts) {
+ let buffer = this._view.get_buffer();
+ let startIter = buffer.get_iter_at_line(iter.get_line());
+ let startMark = buffer.create_mark(null, iter, true);
+ let endMark = buffer.create_mark(null, iter, false);
+ iter.forward_to_line_end();
+ buffer.delete(startIter, iter);
+ statusTexts.forEach(Lang.bind(this, function(statusText) {
+ buffer.insert(buffer.get_iter_at_mark(startMark), statusText + '\n', -1);
+ let startIter = buffer.get_iter_at_mark(startMark);
+ let endIter = buffer.get_iter_at_mark(endMark);
+ buffer.apply_tag(this._lookupTag('status'), startIter, endIter);
+ }));
}
}
return Gdk.EVENT_PROPAGATE;
@@ -512,7 +528,7 @@ const ChatView = new Lang.Class({
let tags = iter.get_tags();
let hovering = false;
for (let i = 0; i < tags.length && !hovering; i++)
- if (tags[i]._url)
+ if (tags[i]._url || tags[i]._statusTexts)
hovering = true;
if (this._hoveringLink != hovering) {
@@ -782,7 +798,16 @@ const ChatView = new Lang.Class({
let startIter = buffer.get_iter_at_line(markIter.get_line());
let endIter = buffer.get_end_iter();
buffer.delete(startIter, endIter);
- this._insertStatus(compressedText);
+
+ let tags = [this._lookupTag('status')];
+ this._state.lastNick = null;
+ this._ensureNewLine();
+ this._insertWithTags(endIter, compressedText + ' ( ', tags);
+ let tag = new Gtk.TextTag();
+ tag._statusTexts = this._statusTexts;
+ this._view.get_buffer().tag_table.add(tag);
+ this._insertWithTags(endIter, '\u2026', tags.concat(this._lookupTag('expandable'), tag));
+ this._insertWithTags(endIter, ' ) ', tags);
} else {
this._insertStatus(statusText);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]