Support close buffer

This commit is contained in:
David Cormier 2013-10-08 10:13:48 -04:00
parent 1404c04590
commit 019f1ce585
2 changed files with 5 additions and 9 deletions

View file

@ -48,9 +48,10 @@ models.service('models', ['colors', function(colors) {
}
this.closeBuffer = function(bufferId) {
delete(BufferList[bufferId]);
var firstBuffer = _.keys(BufferList)[0];
activeBuffer = firstBuffer;
delete(this.model['buffers'][bufferId.id]);
var firstBuffer = _.keys(this.model['buffers'])[0];
this.setActiveBuffer(firstBuffer);
}
this.Buffer = function(message) {

View file

@ -196,7 +196,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'pluginManager',
var handleBufferClosing = function(message) {
var bufferMessage = message['objects'][0]['content'][0];
var buffer = new models.Buffer(bufferMessage);
$rootScope.closeBuffer(buffer.id);
models.closeBuffer(buffer);
}
var handleBufferLineAdded = function(message) {
@ -388,11 +388,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', 'models', '
// TODO checkbox for saving password or not?
// $scope.password = "";
$rootScope.closeBuffer = function(buffer_pointer) {
// delete($rootScope.buffers[buffer_pointer]);
// var first_buffer = _.keys($rootScope.buffers)[0];
// $scope.setActiveBuffer(first_buffer);
}
$scope.setActiveBuffer = function(key) {
console.log(key);