models: add activeBufferChanged signal

When the active buffer is changed on the model, the model
now emits a signal on the rootScope
This commit is contained in:
David Cormier 2013-10-12 16:07:46 -04:00
parent 824e86774c
commit fb0ce21fc5

View file

@ -4,7 +4,7 @@
*/ */
var models = angular.module('weechatModels', []); var models = angular.module('weechatModels', []);
models.service('models', ['colors', function(colors) { models.service('models', ['$rootScope', 'colors', function($rootScope, colors) {
/* /*
* Buffer class * Buffer class
*/ */
@ -84,7 +84,7 @@ models.service('models', ['colors', function(colors) {
rtext = content[0]['text']; rtext = content[0]['text'];
} }
return { return {
prefix: prefix, prefix: prefix,
content: content, content: content,
date: date, date: date,
@ -160,9 +160,12 @@ models.service('models', ['colors', function(colors) {
return buffer; return buffer;
} }
}); });
activeBuffer.notification = false; activeBuffer.notification = false;
activeBuffer.active = true; activeBuffer.active = true;
activeBuffer.unread = ''; activeBuffer.unread = '';
$rootScope.$emit('activeBufferChanged');
} }
/* /*