Changeset 871

Show
Ignore:
Timestamp:
2008-03-12 00:00:30 (10 months ago)
Author:
MaierMan
Message:

Simplify getProfileFile

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/chrome/content/common/internalFunctions.js

    r853 r871  
    5959         
    6060         
    61 const SYSTEMSLASH = (DTA_profileFile.get('dummy').path.indexOf('/') != -1) ? '/' : '\\'; 
     61const SYSTEMSLASH = (DTA_getProfileFile('dummy').path.indexOf('/') != -1) ? '/' : '\\'; 
    6262 
    6363// shared state defines 
  • trunk/chrome/content/common/overlayFunctions.js

    r860 r871  
    165165                        .QueryInterface(Components.interfaces.nsIPrefBranch2) 
    166166                        .addObserver(branch, obj, true); 
    167         } 
    168 }; 
    169  
    170 var DTA_profileFile = { 
    171         _ds : Components.classes["@mozilla.org/file/directory_service;1"] 
    172                 .getService(Components.interfaces.nsIProperties), 
    173  
    174         get: function PF_get(fileName)  { 
    175                 var file = this._ds.get("ProfD", Components.interfaces.nsIFile) 
     167        }, 
     168        removeObserver: function DP_removeObserver(branch, obj) { 
     169                this._pref 
     170                        .QueryInterface(Components.interfaces.nsIPrefBranch2) 
     171                        .removeObserver(branch, obj); 
     172        } 
     173}; 
     174 
     175function DTA_getProfileFile(fileName) { 
     176        var _profile = Components.classes["@mozilla.org/file/directory_service;1"] 
     177                .getService(Components.interfaces.nsIProperties) 
     178                .get("ProfD", Components.interfaces.nsIFile); 
     179        DTA_getProfileFile = function(fileName) { 
     180                var file = _profile.clone(); 
    176181                file.append(fileName); 
    177182                return file; 
    178         } 
    179 }; 
     183        }; 
     184        return DTA_getProfileFile(fileName); 
     185
     186 
    180187var DTA_debug = Components.classes['@downthemall.net/debug-service;1'] 
    181188        .getService(Components.interfaces.dtaIDebugService); 
  • trunk/chrome/content/dta/manager/sessionmanager.js

    r867 r871  
    4545        init: function() { 
    4646                this._con = Serv('@mozilla.org/storage/service;1', 'mozIStorageService') 
    47                         .openDatabase(DTA_profileFile.get(DB_FILE)); 
     47                        .openDatabase(DTA_getProfileFile(DB_FILE)); 
    4848                try { 
    4949                        if (('schemaVersion' in this._con) && this._con.schemaVersion != DB_VERSION) { 
  • trunk/chrome/content/preferences/prefs.js

    r829 r871  
    5656        load: function PP_load() { 
    5757                try { 
    58                         var log = !DTA_profileFile.get('dta_log.txt').exists(); 
     58                        var log = !DTA_getProfileFile('dta_log.txt').exists(); 
    5959                        $("butShowLog", 'butDelLog', 'butRevealLog') 
    6060                                .forEach(function(e) { e.disabled = log; });