var SystrayController = function($scope, $interval, $translate) {
	DriveController.call(this, $scope, $translate);
	var self = this;
	// Set default status
	$scope.engine = null;
	$scope.current_actions = [];
	$scope.last_files = [];
	$scope.notifications = [];
	$scope.syncing_items = 0;
	$scope.autoUpdate = this.getAutoUpdate();
	$scope.app_update = this.getUpdateStatus();
	$scope.update_channel = ''
	$scope.confirmAppUpdateDialog = null;
	$scope.confirmAppUpdate = function(version) {
		$scope.updateChannel = $scope.betaChannel ? 'beta ' : '';
		$scope.confirmAppUpdateDialog = version;	
	}
	$scope.interval = null;

	// Set default action
	$scope.open_local = function(path) {
		self.openLocal($scope.engine.uid, path);
	}
	$scope.open_remote = function() {
		self.openRemote($scope.engine.uid);
	}
	$scope.show_metadata = function(path) {
		self.showMetadata($scope.engine.uid, path);
	}
	$scope.advanced_systray = this.advancedSystray;
	
	$scope.appUpdate = function() {
		self.appUpdate($scope.confirmAppUpdateDialog);
		$scope.app_update = ['updating', $scope.confirmAppUpdateDialog, 0];
		$scope.confirmAppUpdateDialog = null;
	}
	$scope.updateFiles = function() {
		self.getLastFiles($scope);
	}
	$scope.update = function() {
		$scope.app_update = angular.fromJson(drive.get_update_status());
		$scope.sync = drive.is_syncing($scope.engine.uid);
		if ($scope.sync == $scope.engine.syncing && $scope.sync != 'syncing') {
			// Nothing to update
			return;
		}
		$scope.engine.syncing = $scope.sync;
		if ($scope.engine.syncing == 'syncing') {
			$scope.engine.syncing_count = drive.get_syncing_items($scope.engine.uid);
			$scope.current_actions = angular.fromJson(drive.get_actions($scope.engine.uid));
		} else {
			$scope.engine.syncing_count = 0;
			$scope.current_actions = [];
		}
		$scope.updateFiles();
	}
	$scope.triggerNotification = function(notification) {
		drive.trigger_notification(notification.uid);
	}
	$scope.discardNotification = function(notification) {
		drive.discard_notification(notification.uid);
		$scope.notifications.splice($scope.notifications.indexOf(notification),1);
	}
	$scope.setEngine = function(engine) {
		$scope.engine = engine;
		$scope.engine.syncing_count = drive.get_syncing_items($scope.engine.uid);
		$scope.sync = drive.is_syncing($scope.engine.uid);
		notifications = [];
		notifs = angular.fromJson(drive.get_notifications($scope.engine.uid));
		for ( var i in notifs ) {
			if (notifs[i].systray && !notifs[i].discard) {
				notifications.push(notifs[i]);
			}
		}
		$scope.notifications = notifications;
		$scope.current_actions = angular.fromJson(drive.get_actions(engine.uid));
		$scope.updateFiles();
		if ($scope.interval == null) {
			$scope.interval = $interval($scope.update, 1000);
		}
	}
	self.init($scope);
	$scope.getEngineClass = function(engine) {
		if (engine == $scope.engine) {
			return "currentEngine";
		}
		return "";
	}
}
SystrayController.prototype = Object.create(DriveController.prototype);
SystrayController.prototype.constructor = SystrayController;
SystrayController.prototype.init = function($scope) {
	if ($scope.engines.length > 0) {
		$scope.bind = true;
		$scope.setEngine($scope.engines[0]);
	} else {
		$scope.bind = false;
		drive.resize(300, 280);
	}
}
SystrayController.prototype.showMetadata = function(uid, path) {
	drive.show_metadata(uid, path);
}
SystrayController.prototype.advancedSystray = function() {
	drive.advanced_systray();
}
SystrayController.prototype.getLastFiles = function($scope) {
	if ($scope.current_actions.length < 5) {
		$scope.last_files = angular.fromJson(drive.get_last_files($scope.engine.uid, 5-$scope.current_actions.length, null)); 
	} else {
		$scope.last_files = [];	
	}
}

/**
 * Sample of a CustomSystrayController
 */
function CustomSystrayController($scope, $interval, $translate) {
	SystrayController.call(this, $scope, $interval, $translate);
}
CustomSystrayController.prototype = Object.create(SystrayController.prototype);
CustomSystrayController.prototype.constructor = CustomSystrayController;
CustomSystrayController.prototype.advancedSystray = function() {
	drive.advanced_systray();
}

@@ -31,32 +31,31 @@
 on($scope, $
-interval
+timeout
 , $translate
@@ -1228,24 +1228,50 @@
 unction() %7B%0A
+%09%09$scope.interval = null;%0A
 %09%09$scope.app
@@ -1476,16 +1476,110 @@
  update%0A
+%09%09%09if ($scope.interval === null ) %7B%0A%09%09%09%09$scope.interval = $timeout($scope.update, 1000);%0A%09%09%09%7D%0A
 %09%09%09retur
@@ -1936,16 +1936,107 @@
 iles();%0A
+%09%09if ($scope.interval === null ) %7B%0A%09%09%09$scope.interval = $timeout($scope.update, 1000);%0A%09%09%7D%0A
 %09%7D%0A%09$sco
@@ -2894,21 +2894,23 @@
 erval ==
+=
  null
+ 
 ) %7B%0A%09%09%09$
@@ -2927,24 +2927,23 @@
 rval = $
-interval
+timeout
 ($scope.

Use timeout instead of interval to avoid continued execution