<?xml version="1.0" encoding="Windows-1252" ?>
<!--
  Copyright (C) 2008-2009  The Tor Project, Inc.
  See LICENSE file for rights and terms.
 -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?define ThisProductVersion="1.2.0" ?>
  <?define ThisProductVersionDisp="1.2.0" ?>
  <?define UpgradeCode="e13a294d-6ac6-4ddd-a300-8ee8dee768c6" ?>
  
  <?define CurrProductGUID="5c09de77-eceb-44b7-a9cc-7308ed7dd0fa" ?>
  <?define CurrExtensionGUID="cb29b0ed-4fb0-4f69-ab87-98cc3ae96eec" ?>
  <?define CurrStartMenuGUID="24cabe82-2fd6-408e-9af4-e3792cac9feb" ?>
  <?define CurrDesktopGUID="c1352049-ec2e-4b72-ab34-313b20016e84" ?>

  <Product Name="TorButton $(var.ThisProductVersionDisp)" Id="$(var.CurrProductGUID)"
           Version="$(var.ThisProductVersion)"
           Manufacturer="www.torproject.org"
           Language="!(loc.LCID)"
           UpgradeCode="$(var.UpgradeCode)">
    
    <Package Id="*" Keywords="Installer"
             Description="TorButton $(var.ThisProductVersionDisp) Installer"
             Manufacturer="www.torproject.org"
             InstallerVersion="200" Compressed="yes"
             InstallPrivileges="limited" />

    <Media Id="1" Cabinet="TorButton.cab" CompressionLevel="high"
           EmbedCab="yes" DiskPrompt="CD-ROM #1" />
    <Property Id="DiskPrompt" Value="TorButton $(var.ThisProductVersionDisp) Installation Volume [1]" />
    <Property Id="ALLUSERS" Secure="yes"/>
    <Property Id="ReinstallModeText">omus</Property>

    <!-- To avoid placing shortcuts all over the desktop / start menu during a
    silent installation the NOSC=1 option can be passed to omit shortcuts.
    This is useful if bundled with other applications like Vidalia that manage
    configuration and Tor related processes themselves.
      -->
    <Property Id="NOSC" Secure="yes"/>

    <!-- Associate this package with the upgrade code for this series
    to ensure that upgrade installations by Thandy or other means work
    as expected.
    The OnlyDetect option must be false to ensure that existing files
    from an older version are removed and replaced with current files.
      -->
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion
        Property="UPGRADEFOUND"
        OnlyDetect="no"
        Minimum="0.0.0"
        IncludeMinimum="yes"
        Maximum="$(var.ThisProductVersion)"
        IncludeMaximum="no"
      />
    </Upgrade>


    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="LocalAppDataFolder" Name="LocalAppData">

        <Directory Id="INSTALLDIR" Name="TorButton">
          <Component Id="TorButtonExtension" Guid="$(var.CurrExtensionGUID)">
            <CreateFolder/>
            <RemoveFolder Id="RemoveINSTALLDIR" On="uninstall" />
            <RegistryKey Root="HKCU" Key="Software\TorButton" Action="createAndRemoveOnUninstall">
              <RegistryValue Name="Version" Value="$(var.ThisProductVersion)" Type="string" KeyPath="yes" />
            </RegistryKey>
            <File
              Id="TorButtonExtensionFile"
              Name="torbutton.xpi"
              Source="torbutton.xpi"
              Vital="yes"
              ReadOnly="no"
              DiskId="1"> 
            </File>
          </Component>

        </Directory>
      </Directory>

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ShortcutFolder" Name="TorButton">
          <Component Id="AddTorButtonToStartMenu" Guid="$(var.CurrStartMenuGUID)">
            <Condition><![CDATA[NOSC <> 1]]> </Condition>
            <RegistryKey Root="HKCU" Key="Software\TorButton" Action="createAndRemoveOnUninstall">
              <RegistryValue Name="StartMenuShortcut" Value="1" Type="integer" KeyPath="yes" />
            </RegistryKey>
            <Shortcut Id="TorButtonStartMenuShortcut"
                      Name="Install TorButton" Target="[ProgramFilesFolder]Mozilla Firefox\firefox.exe"
                      Arguments="torbutton.xpi"
                      Directory="ShortcutFolder" WorkingDirectory="INSTALLDIR" />
            <RemoveFolder Id="RemoveShortcutFolder" On="uninstall" />
          </Component>
        </Directory>
      </Directory>

      <Directory Id="DesktopFolder" Name="Desktop">
        <Component Id="AddTorButtonToDesktop" Guid="$(var.CurrDesktopGUID)">
          <Condition><![CDATA[NOSC <> 1]]> </Condition>
          <RegistryKey Root="HKCU" Key="Software\TorButton" Action="createAndRemoveOnUninstall">
            <RegistryValue Name="DesktopShortcut" Value="1" Type="integer" KeyPath="yes" />
          </RegistryKey>
          <Shortcut Id="TorButtonDesktopShortcut"
                    Name="Install TorButton" Target="[ProgramFilesFolder]Mozilla Firefox\firefox.exe"
                    Arguments="torbutton.xpi"
                    Directory="DesktopFolder" WorkingDirectory="INSTALLDIR" />
        </Component>
      </Directory>
    </Directory>

    <!-- Build up the feature hierarchy -->
    <Feature Id="Complete" Title="TorButton"
             Level="1" Display="expand" ConfigurableDirectory="INSTALLDIR"
             Description="TorButton protects your FireFox browser while using the Tor network.">
      <Feature Id="MainApplication" Title="TorButton $(var.ThisProductVersionDisp)"
               AllowAdvertise="no" Absent="disallow" Level="1"
               Description="Main application">
        <ComponentRef Id="TorButtonExtension" />
      </Feature>
      <Feature Id="Shortcuts" Title="Shortcuts"
               AllowAdvertise="no" Absent="allow" Level="1"
               Description="Add a shortcut to TorButton to your Start menu or Desktop.">
        <Feature Id="StartMenuShortcuts" Title="Add to Start menu"
                 AllowAdvertise="no" Absent="allow" Level="1"
                 Description="Add TorButton to your Start menu">
          <ComponentRef Id="AddTorButtonToStartMenu" />
        </Feature>
        <Feature Id="DesktopShortcuts" Title="Add to Desktop"
                 AllowAdvertise="no" Absent="allow" Level="1"
                 Description="Add TorButton to your Desktop">
          <ComponentRef Id="AddTorButtonToDesktop" />
        </Feature>
      </Feature>
    </Feature>

    <!-- Upgrade installation sequence. -->
    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallValidate" />
    </InstallExecuteSequence>

    <!-- Set the UI options -->
    <UIRef Id="WixUI_Custom" />
    <WixVariable Id="WixUIBannerBmp" Value="default-header.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="default-welcome.bmp" />
  </Product>
</Wix>
