Changeset ee52fc
- Timestamp:
- Sep 15, 2010, 5:15:43 PM (10 years ago)
- Branches:
- ng_0.6, ng_0.8, ng_0.9
- Children:
- 250d2d
- Parents:
- b269e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/vI_getHeader.js
rb269e7 ree52fc 22 22 Contributor(s): Christian Weiske 23 23 Contributor(s): Patrick Brunschwig 24 Contributor(s): http://xulsolutions.blogspot.com/2006/07/creating-uninstall-script-for.html 25 24 26 * ***** END LICENSE BLOCK ***** */ 25 27 … … 31 33 * some code copied and adapted from 'enigmail' 32 34 * thanks to Patrick Brunschwig <patrick.brunschwig@gmx.net> 35 */ 36 /** 37 * some code copied and adapted from 'http://xulsolutions.blogspot.com/2006/07/creating-uninstall-script-for.html' 38 * thanks to the unknown programmer 33 39 */ 34 40 … … 218 224 vI_prepareHeader.prefroot.QueryInterface(Components.interfaces.nsIPrefBranch2); 219 225 vI_prepareHeader.prefroot.addObserver("extensions.virtualIdentity.smart_reply_headers", this, false); 226 vI_prepareHeader.uninstallObserver.register(); 220 227 vI_prepareHeader.observer_added = true; 221 228 }, … … 224 231 if (!vI_prepareHeader.observer_added) return; 225 232 vI_prepareHeader.prefroot.removeObserver("extensions.virtualIdentity.smart_reply_headers", this); 233 vI_prepareHeader.uninstallObserver.unregister(); 226 234 vI_prepareHeader.observer_added = false; 227 235 }, … … 329 337 MsgReload(); 330 338 } 331 } 339 }, 340 341 // code adapted from http://xulsolutions.blogspot.com/2006/07/creating-uninstall-script-for.html 342 uninstallObserver : { 343 MY_EXTENSION_UUID : "{dddd428e-5ac8-4a81-9f78-276c734f75b8}", 344 _uninstall : false, 345 observe : function(subject, topic, data) { 346 if (topic == "em-action-requested") { 347 var extension = subject.QueryInterface(Components.interfaces.nsIUpdateItem); 348 349 if (extension.id == this.MY_EXTENSION_UUID) { 350 if (data == "item-uninstalled") { 351 this._uninstall = true; 352 } else if (data == "item-cancel-action") { 353 this._uninstall = false; 354 } 355 } 356 } else if (topic == "quit-application-granted") { 357 if (this._uninstall) { 358 /* uninstall stuff. */ 359 vI_notificationBar.dump("## vI_uninstall: _uninstall \n"); 360 vI_prepareHeader.removeExtraHeader(); 361 vI_notificationBar.dump("## vI_uninstall: _uninstall done\n"); 362 } 363 this.unregister(); 364 } 365 }, 366 register : function() { 367 var observerService = 368 Components.classes["@mozilla.org/observer-service;1"]. 369 getService(Components.interfaces.nsIObserverService); 370 371 observerService.addObserver(this, "em-action-requested", false); 372 observerService.addObserver(this, "quit-application-granted", false); 373 }, 374 unregister : function() { 375 var observerService = 376 Components.classes["@mozilla.org/observer-service;1"]. 377 getService(Components.interfaces.nsIObserverService); 378 379 observerService.removeObserver(this,"em-action-requested"); 380 observerService.removeObserver(this,"quit-application-granted"); 381 } 382 } 332 383 } 333 384 … … 335 386 window.addEventListener("load", function(e) { vI_prepareHeader.init(); }, false); 336 387 window.addEventListener("unload", function(e) { vI_prepareHeader.cleanup(); }, false); 388 // window.addEventListener("load", initializeOverlay, false);
Note: See TracChangeset
for help on using the changeset viewer.