Blob Blame History Raw
;Include Modern UI
!include "MUI2.nsh"
!include "FileFunc.nsh"

;General
!define APPNAME "Glade Interface Designer"
!define COMPANYNAME "GNOME Foundation"

!define VERSIONMAJOR @GLADE_MAJOR_VERSION@
!define VERSIONMINOR @GLADE_MINOR_VERSION@
!define VERSIONBUILD @GLADE_MICRO_VERSION@

!define HELPURL "http://bugzilla.gnome.org/browse.cgi?product=glade"
!define UPDATEURL "http://glade.gnome.org"
!define ABOUTURL "http://gnome.org"

;Name and file
Name "${APPNAME}"
BrandingText "${COMPANYNAME}"
outFile "glade-@GLADE_MAJOR_VERSION@-@GLADE_MINOR_VERSION@-@GLADE_MICRO_VERSION@-installer.exe"

;Default installation folder
InstallDir "$LOCALAPPDATA\${COMPANYNAME}\${APPNAME}"

;Request application privileges for Windows Vista
RequestExecutionLevel user

;Interface Settings
!define MUI_ICON "glade.ico"
!define MUI_ABORTWARNING

;Pages
!insertmacro MUI_PAGE_LICENSE "COPYING"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;Languages
!insertmacro MUI_LANGUAGE "English"

Function .onInit

  MessageBox MB_OK "This Glade build and installer are BETA SOFTWARE!$\nIt was cross compiled on Linux and tested with wine! (a Windows emulator)$\nand it is distributed with the hope it will be usefull as a starting point for a new Windows comunity$\nthat can support it and contribute back to make it better."

  ReadRegStr $R0 HKLM \
  "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString"
  StrCmp $R0 "" done
 
  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
  "${APPNAME} is already installed. $\n$\nClick `OK` to remove the \
  previous version or `Cancel` to cancel this upgrade." \
  IDOK uninst
  Abort
 
;Run the uninstaller
uninst:
  ClearErrors
  SetOverwrite on
  ; Get old instalation directory
  ${GetFileName} $R0 $1
  ${GetParent} $R0 $2
  ; Move old uninstaller
  CopyFiles $R0 $TEMP
  SetOverwrite off
  ; execute old uninstaller
  ExecWait '$TEMP\$1 _?=$2' $3
  ; remove moved uninstaller
  Delete $TEMP\$1
done:
 
FunctionEnd

Section "Install"
        SetOutPath "$INSTDIR"
        file /r bin
        file /r etc
        !include install_files.nsh
        file glade.ico
  
        ;Create uninstaller
        WriteUninstaller "$INSTDIR\Uninstall.exe"
        ;Create shortcuts
        createDirectory "$SMPROGRAMS\${COMPANYNAME}"
        createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\bin\glade.exe" "" "$INSTDIR\glade.ico"
 
	; Registry information for add/remove programs
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME}"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$INSTDIR\uninstall.exe /S"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$INSTDIR"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\glade.ico$\""
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
	WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
	WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
        WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMicro" ${VERSIONBUILD}
	; There is no option for modifying or repairing the install
	WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
	WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
SectionEnd

Section "Uninstall"
	; Remove Start Menu launcher
	delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
	; Try to remove the Start Menu folder - this will only happen if it is empty
	rmDir "$SMPROGRAMS\${COMPANYNAME}"
 
	; Remove files
        delete "$INSTDIR\glade.ico"
        !include uninstall_files.nsh

	; Always delete uninstaller as the last action
	delete "$INSTDIR\uninstall.exe"
 
	; Try to remove the install directory - this will only happen if it is empty
	rmDir "$INSTDIR"
        rmDir "$LOCALAPPDATA\${COMPANYNAME}"
 
	; Remove uninstaller information from the registry
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"

SectionEnd