Changeset 996

Show
Ignore:
Timestamp:
07/30/08 00:04:24 (1 month ago)
Author:
MaierMan
Message:

#822: Preferences Filters doesn't update

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/chrome/content/preferences/prefs.js

    r993 r996  
    173173        _filters: [], 
    174174        _lastRowEdited : -1, 
     175         
     176        Observer: { 
     177                registerObserver: function() { 
     178                        try { 
     179                                makeObserver(this); 
     180                                var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); 
     181                                os.addObserver(this, 'DTA:filterschanged', true); 
     182                        } 
     183                        catch (ex) { 
     184                                Debug.log("cannot install filterManager observer!", ex); 
     185                                return false; 
     186                        } 
     187                        return true; 
     188                },       
     189                // nsIObserver::observe 
     190                observe : function(subject, topic, prefName) { 
     191                        // filterManager will throw this topic at us. 
     192                        if (topic == 'DTA:filterschanged') { 
     193                                // the heavy work will be performed by changeTab.. 
     194                                // it will create the filter boxen for us, and furthermore do another selection 
     195                                Filters.reloadFilters(); 
     196                        } 
     197                } 
     198        }, 
    175199 
    176200        load: function() { 
     
    178202                this._elem.view = this; 
    179203                 
    180                 this.registerObserver(); 
     204                this.Observer.registerObserver(); 
    181205                this.reloadFilters(); 
    182206        }, 
    183         registerObserver: function() { 
    184                 try { 
    185                         makeObserver(this); 
    186                         var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); 
    187                         os.addObserver(this, 'DTA:filterschanged', true); 
    188                 } 
    189                 catch (ex) { 
    190                         Debug.log("cannot install filterManager observer!", ex); 
    191                         return false; 
    192                 } 
    193                 return true; 
    194         },       
    195207        reloadFilters: function() { 
    196208                // something has changed.. 
     
    410422        getCellProperties: function(idx, column, prop) {}, 
    411423        getColumnProperties: function(column, element, prop) {}, 
    412         setCellValue: function(idx, col, value) {}, 
    413          
    414         // nsIObserver::observe 
    415         observe : function(subject, topic, prefName) { 
    416                 // filterManager will throw this topic at us. 
    417                 if (topic == 'DTA:filterschanged') { 
    418                         // the heavy work will be performed by changeTab.. 
    419                         // it will create the filter boxen for us, and furthermore do another selection 
    420                         this.reloadFilters(); 
    421                 } 
    422         } 
     424        setCellValue: function(idx, col, value) {} 
    423425}; 
    424426