[polari/wip/kunaljain/bug-fixes: 2/2] chatView: Use unicode arrows
- From: Kunal Jain <kunaljain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/kunaljain/bug-fixes: 2/2] chatView: Use unicode arrows
- Date: Mon, 28 Dec 2015 07:25:06 +0000 (UTC)
commit 2d9da05d928f6e8ca7ba9d9e6963cce31e911f40
Author: Kunaal Jain <kunaalus gmail com>
Date: Mon Dec 28 12:54:30 2015 +0530
chatView: Use unicode arrows
src/chatView.js | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 6cbf99a..d50ba29 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -23,7 +23,7 @@ const TIMESTAMP_INTERVAL = 300; // seconds of inactivity after which to
const INACTIVITY_THRESHOLD = 300; // a threshold in seconds used to control
// the visibility of status messages
-const STATUS_NOISE_MAXIMUM = 4;
+const STATUS_NOISE_MAXIMUM = 0;
const NUM_INITIAL_LOG_EVENTS = 50; // number of log events to fetch on start
const NUM_LOG_EVENTS = 10; // number of log events to fetch when requesting more
@@ -859,19 +859,27 @@ const ChatView = new Lang.Class({
let headerMark = buffer.get_mark('idle-status-start');
let headerTagName = 'status-compressed' + this._state.lastStatusGroup;
+ let headerArrowRightTagName = 'status-arrow-right' + this._state.lastStatusGroup;
+ let headerArrowDownTagName = 'status-arrow-down' + this._state.lastStatusGroup;
let groupTagName = 'status' + this._state.lastStatusGroup;
- let headerTag, groupTag;
+ let headerTag, groupTag, headerArrowDownTag, headerArrowRightTag;
if (!headerMark) {
// we are starting a new group
headerTag = new ButtonTag({ name: headerTagName, invisible: true });
groupTag = new Gtk.TextTag({ name: groupTagName });
+ headerArrowDownTag = new Gtk.TextTag({ name: headerArrowDownTagName, invisible: true });
+ headerArrowRightTag = new Gtk.TextTag({ name: headerArrowRightTagName, invisible: true });
buffer.tag_table.add(headerTag);
buffer.tag_table.add(groupTag);
+ buffer.tag_table.add(headerArrowDownTag);
+ buffer.tag_table.add(headerArrowRightTag);
headerTag.connect('clicked',
function() {
groupTag.invisible = !groupTag.invisible;
+ headerArrowDownTag.invisible = !headerArrowDownTag.invisible;
+ headerArrowRightTag.invisible = !headerArrowRightTag.invisible;
});
headerTag.connect('notify::hover', Lang.bind(this,
@@ -884,6 +892,8 @@ const ChatView = new Lang.Class({
} else {
headerTag = this._lookupTag(headerTagName);
groupTag = this._lookupTag(groupTagName);
+ headerArrowDownTag = this._lookupTag(headerArrowDownTagName);
+ headerArrowRightTag = this._lookupTag(headerArrowRightTagName);
let start = buffer.get_iter_at_mark(headerMark);
let end = start.copy();
@@ -894,6 +904,7 @@ const ChatView = new Lang.Class({
// we passed the threshold, show the header and collapse the group
if (this._statusCount.total > STATUS_NOISE_MAXIMUM && headerTag.invisible) {
headerTag.invisible = false;
+ headerArrowRightTag.invisible = false;
groupTag.invisible = true;
}
@@ -904,9 +915,16 @@ const ChatView = new Lang.Class({
if (this._statusCount.left > 0)
stats.push(ngettext("%d user left",
"%d users left", this._statusCount.left).format(this._statusCount.left));
- this._insertWithTags(buffer.get_iter_at_mark(headerMark),
- stats.join(", ") + ' (\u2026)',
+ let iter = buffer.get_iter_at_mark(headerMark);
+ this._insertWithTags(iter,
+ stats.join(", "),
[this._lookupTag('status'), headerTag]);
+ this._insertWithTags(iter,
+ ' \u25B6',
+ [this._lookupTag('status'), headerTag, headerArrowRightTag]);
+ this._insertWithTags(iter,
+ ' \u25BC',
+ [this._lookupTag('status'), headerTag, headerArrowDownTag]);
},
_insertStatus: function(text, member, type) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]