Changeset 998
- Timestamp:
- 07/30/08 00:19:20 (1 month ago)
- Files:
-
- branches/1.0.x/chrome/content/preferences/prefs.js (modified) (2 diffs)
- branches/1.0.x/components/filterManager.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0.x/chrome/content/preferences/prefs.js
r916 r998 145 145 this._elem.view = this; 146 146 147 this. registerObserver();147 this.Observer.registerObserver(); 148 148 this.reloadFilters(); 149 149 }, 150 registerObserver: function() { 151 try { 152 makeObserver(this); 153 var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); 154 os.addObserver(this, 'DTA:filterschanged', true); 155 } catch (ex) { 156 Debug.dump("cannot install filterManager observer!", ex); 157 return false; 158 } 159 return true; 160 }, 150 Observer: { 151 registerObserver: function() { 152 try { 153 makeObserver(this); 154 var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); 155 os.addObserver(this, 'DTA:filterschanged', true); 156 } 157 catch (ex) { 158 Debug.dump("cannot install filterManager observer!", ex); 159 return false; 160 } 161 return true; 162 }, 163 // nsIObserver::observe 164 observe : function(subject, topic, prefName) { 165 // filterManager will throw this topic at us. 166 if (topic == 'DTA:filterschanged') { 167 // the heavy work will be performed by changeTab.. 168 // it will create the filter boxen for us, and furthermore do another selection 169 Filters.reloadFilters(); 170 } 171 } 172 }, 161 173 reloadFilters: function() { 162 174 // something has changed.. … … 422 434 getCellProperties: function(idx, column, prop) {}, 423 435 getColumnProperties: function(column, element, prop) {}, 424 setCellValue: function(idx, col, value) {}, 425 426 // nsIObserver::observe 427 observe : function(subject, topic, prefName) { 428 // filterManager will throw this topic at us. 429 if (topic == 'DTA:filterschanged') { 430 // the heavy work will be performed by changeTab.. 431 // it will create the filter boxen for us, and furthermore do another selection 432 this.reloadFilters(); 433 } 434 } 436 setCellValue: function(idx, col, value) {} 435 437 }; 436 438 branches/1.0.x/components/filterManager.js
r538 r998 49 49 include("chrome://dta/content/common/regconvert.js"); 50 50 51 const Timer = Components.Constructor('@mozilla.org/timer;1', 'nsITimer', 'initWithCallback'); 52 const TYPE_ONE_SHOT = CI.nsITimer.TYPE_ONE_SHOT; 53 51 54 // no not create DTA_Filter yourself, managed by DTA_FilterManager 52 55 function Filter(name, prefs) { … … 328 331 329 332 _done: true, 330 _mustReload: true,333 _mustReload: false, 331 334 _prefs: CC['@mozilla.org/preferences-service;1'] 332 335 .getService(CI.nsIPrefService) 333 336 .getBranch("extensions.dta.filters."), 334 _timer: CC['@mozilla.org/timer;1'] 335 .createInstance(CI.nsITimer), 337 _timer: null, 336 338 337 339 _init: function FM_init() { … … 351 353 // register (the observer) and initialize our timer, so that we'll get a reload event. 352 354 this.register(); 353 this._timer.initWithCallback( 354 this, 355 100, 356 this._timer.TYPE_ONE_SHOT 357 ); 355 this._delayedReload(); 358 356 }, 359 357 360 358 _delayedReload: function FM_delayedReload() { 359 if (this._mustReload) { 360 return; 361 } 361 362 this._mustReload = true; 362 this._timer .delay = 100;363 this._timer = new Timer(this, 100, TYPE_ONE_SHOT); 363 364 }, 364 365
