telephatyIdle: Time stamps next conversation line

To give more context to the chat notification bubble, put the
time stamp next to the last conversation line instead of
a new line.

https://bugzilla.gnome.org/show_bug.cgi?id=708031
This commit is contained in:
Carlos Soriano 2013-09-13 14:55:07 +02:00
parent bec57a6cee
commit fff2ca6f26
2 changed files with 22 additions and 19 deletions

View File

@ -1648,8 +1648,8 @@ StScrollBar StButton#vhandle:active {
color: #888888; color: #888888;
} }
.chat-group-sent, .chat-group-meta { .chat-empty-line {
padding: 8px 0; font-size: 4px;
} }
.chat-received { .chat-received {
@ -1674,6 +1674,7 @@ StScrollBar StButton#vhandle:active {
.chat-meta-message { .chat-meta-message {
padding-left: 4px; padding-left: 4px;
font-size: 9pt; font-size: 9pt;
font-weight: bold;
color: #bbbbbb; color: #bbbbbb;
} }

View File

@ -1,5 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio; const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib; const GLib = imports.gi.GLib;
const Lang = imports.lang; const Lang = imports.lang;
@ -905,14 +906,14 @@ const ChatNotification = new Lang.Class({
let group = props.group; let group = props.group;
if (group != this._lastGroup) { if (group != this._lastGroup) {
let style = 'chat-group-' + group;
this._lastGroup = group; this._lastGroup = group;
this._lastGroupActor = new St.BoxLayout({ style_class: style, let emptyLine = new St.Label({ style_class: 'chat-empty-line' });
vertical: true }); this.addActor(emptyLine);
this.addActor(this._lastGroupActor);
} }
this._lastGroupActor.add(body, props.childProps); this._lastMessageBox = new St.BoxLayout({ vertical: false });
this._lastMessageBox.add(body, props.childProps);
this.addActor(this._lastMessageBox);
this.updated(); this.updated();
@ -943,28 +944,28 @@ const ChatNotification = new Lang.Class({
// Show only the hour if date is on today // Show only the hour if date is on today
if(daysAgo < 1){ if(daysAgo < 1){
format = "<b>%H:%M</b>"; format = _("%H:%M");
} }
// Show the word "Yesterday" and time if date is on yesterday // Show the word "Yesterday" and time if date is on yesterday
else if(daysAgo <2){ else if(daysAgo <2){
/* Translators: this is the word "Yesterday" followed by a time string. i.e. "Yesterday, 14:30"*/ /* Translators: this is the word "Yesterday" followed by a time string. i.e. "Yesterday, 14:30"*/
// xgettext:no-c-format // xgettext:no-c-format
format = _("<b>Yesterday</b>, <b>%H:%M</b>"); format = _("Yesterday, %H:%M");
} }
// Show a week day and time if date is in the last week // Show a week day and time if date is in the last week
else if (daysAgo < 7) { else if (daysAgo < 7) {
/* Translators: this is the week day name followed by a time string. i.e. "Monday, 14:30*/ /* Translators: this is the week day name followed by a time string. i.e. "Monday, 14:30*/
// xgettext:no-c-format // xgettext:no-c-format
format = _("<b>%A</b>, <b>%H:%M</b>"); format = _("%A, %H:%M");
} else if (date.getYear() == now.getYear()) { } else if (date.getYear() == now.getYear()) {
/* Translators: this is the month name and day number followed by a time string. i.e. "May 25, 14:30"*/ /* Translators: this is the month name and day number followed by a time string. i.e. "May 25, 14:30"*/
// xgettext:no-c-format // xgettext:no-c-format
format = _("<b>%B</b> <b>%d</b>, <b>%H:%M</b>"); format = _("%B %d, %H:%M");
} else { } else {
/* Translators: this is the month name, day number, year number followed by a time string. i.e. "May 25 2012, 14:30"*/ /* Translators: this is the month name, day number, year number followed by a time string. i.e. "May 25 2012, 14:30"*/
// xgettext:no-c-format // xgettext:no-c-format
format = _("<b>%B</b> <b>%d</b> <b>%Y</b>, <b>%H:%M</b> "); format = _("%B %d %Y, %H:%M");
} }
return date.toLocaleFormat(format); return date.toLocaleFormat(format);
@ -976,13 +977,14 @@ const ChatNotification = new Lang.Class({
let lastMessageTime = this._history[0].time; let lastMessageTime = this._history[0].time;
let lastMessageDate = new Date(lastMessageTime * 1000); let lastMessageDate = new Date(lastMessageTime * 1000);
let timeLabel = this._append({ body: this._formatTimestamp(lastMessageDate), let timeLabel = new St.Label({ text: this._formatTimestamp(lastMessageDate),
group: 'meta', style_class: 'chat-meta-message',
styles: ['chat-meta-message'], x_expand: true,
childProps: { expand: true, x_fill: false, y_expand: true,
x_align: St.Align.END }, x_align: Clutter.ActorAlign.END,
noTimestamp: true, y_align: Clutter.ActorAlign.END });
timestamp: lastMessageTime });
this._lastMessageBox.add_actor(timeLabel);
this._filterMessages(); this._filterMessages();