home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / xulrunner-1.9.0.14 / chrome / toolkit.jar / content / mozapps / preferences / preferences.xml < prev    next >
Encoding:
Extensible Markup Language  |  2006-09-10  |  2.8 KB  |  73 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="PreferencesSkinBindings"
  4.           xmlns="http://www.mozilla.org/xbl"
  5.           xmlns:xbl="http://www.mozilla.org/xbl"
  6.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  7.  
  8.   <binding id="fileField" extends="chrome://global/content/bindings/general.xml#control-item">
  9.     <content>
  10.       <xul:stringbundle anonid="bundle" src="chrome://mozapps/locale/preferences/preferences.properties"/>
  11.       <xul:hbox class="fileFieldContentBox" align="center" flex="1">
  12.         <xul:image class="fileFieldIcon" xbl:inherits="src=image"/>
  13.         <xul:textbox class="fileFieldLabel" xbl:inherits="value=label,disabled,accesskey,tabindex" flex="1" readonly="true"/>
  14.       </xul:hbox>
  15.     </content>
  16.     <implementation implements="nsIDOMXULLabeledControlElement">
  17.       <property name="label" onget="return this.getAttribute('label');">
  18.         <setter>
  19.           this.setAttribute('label', val); 
  20.           var elt = document.getAnonymousElementByAttribute(this, "class", "fileFieldLabel");
  21.           return (elt.value = val);
  22.         </setter>
  23.       </property>
  24.       
  25.       <field name="_file">null</field>
  26.       <property name="file"  onget="return this._file">
  27.         <setter>
  28.         <![CDATA[
  29.           this._file = val; 
  30.           if (val) {
  31.             this.image = this._getIconURLForFile(val);
  32.             this.label = this._getDisplayNameForFile(val);
  33.           }
  34.           else {
  35.             this.removeAttribute("image");
  36.             var bundle = document.getAnonymousElementByAttribute(this, "anonid", "bundle");
  37.             this.label = bundle.getString("downloadHelperNoneSelected");
  38.           }            
  39.           return val;
  40.         ]]>
  41.         </setter>
  42.       </property>      
  43.       <method name="_getDisplayNameForFile">
  44.         <parameter name="aFile"/>
  45.         <body>
  46.         <![CDATA[
  47.           var ios = Components.classes["@mozilla.org/network/io-service;1"]
  48.                               .getService(Components.interfaces.nsIIOService);
  49.           var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
  50.           return url.fileName;
  51.         ]]>
  52.         </body>
  53.       </method>
  54.       
  55.       <method name="_getIconURLForFile">
  56.         <parameter name="aFile"/>
  57.         <body>
  58.         <![CDATA[
  59.           if (!aFile)
  60.             return "";
  61.           var ios = Components.classes["@mozilla.org/network/io-service;1"]
  62.                               .getService(Components.interfaces.nsIIOService);
  63.           var fph = ios.getProtocolHandler("file")
  64.                        .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
  65.           var urlspec = fph.getURLSpecFromFile(aFile);
  66.           return "moz-icon://" + urlspec + "?size=16";  
  67.         ]]>
  68.         </body>
  69.       </method>
  70.     </implementation>
  71.   </binding>
  72. </bindings>
  73.