autorun-manager: Fix 'destroy' handler of resident source

If the resident source is destroyed, it should be recreated
immediately, so that it is available when another volume is
mounted. However, we only connect to the 'destroy' signal
on the original source, not on newly created ones. As a result,
the resident source only works twice, after that it shows up
without icon and an empty notification.

Fix by always connecting to the source's 'destroy' signal.
This commit is contained in:
Florian Müllner 2011-07-13 21:22:35 +02:00
parent 7a8a00c705
commit 86818e9c52

View File

@ -164,11 +164,7 @@ AutorunManager.prototype = {
this._onMountRemoved));
this._transDispatcher = new AutorunTransientDispatcher();
this._residentSource = new AutorunResidentSource();
this._residentSource.connect('destroy', Lang.bind(this,
function() {
this._residentSource = new AutorunResidentSource();
}));
this._createResidentSource();
let mounts = this._volumeMonitor.get_mounts();
@ -182,6 +178,13 @@ AutorunManager.prototype = {
}));
},
_createResidentSource: function() {
this._residentSource = new AutorunResidentSource();
this._residentSource.connect('destroy',
Lang.bind(this,
this._createResidentSource));
},
_onMountAdded: function(monitor, mount) {
// don't do anything if our session is not the currently
// active one