1 ; Installer script for win32 Gaim
2 ; Herman Bloggs <hermanator12002@yahoo.com>
4 ; NOTE: this .NSI script is designed for NSIS v2.0b4+
6 ;--------------------------------
11 OutFile "gaim-${GAIM_VERSION}.exe"
14 OutFile "gaim-${GAIM_VERSION}-debug.exe"
16 OutFile "gaim-${GAIM_VERSION}-no-gtk.exe"
23 ShowUninstDetails show
26 ; $INSTDIR is set in .onInit function..
31 ;--------------------------------
34 !define MUI_PRODUCT
"Gaim"
35 !define MUI_VERSION
${GAIM_VERSION}
37 !define MUI_ICON
.\pixmaps\gaim
-install
.ico
38 !define MUI_UNICON
.\pixmaps\gaim
-install
.ico
39 !define MUI_SPECIALBITMAP
.\src\win32\nsis\gaim
-intro
.bmp
40 !define MUI_HEADERBITMAP
.\src\win32\nsis\gaim
-header
.bmp
42 !define GAIM_NSIS_INCLUDE_PATH
".\src\win32\nsis"
44 !define GAIM_REG_KEY
"SOFTWARE\gaim"
45 !define GAIM_UNINSTALL_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
46 !define HKLM_APP_PATHS_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe"
47 !define GAIM_STARTUP_RUN_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
48 !define GAIM_UNINST_EXE
"gaim-uninst.exe"
50 !define GTK_VERSION
"2.2.1"
51 !define GTK_REG_KEY
"SOFTWARE\GTK\2.0"
52 !define GTK_DEFAULT_INSTALL_PATH
"$PROGRAMFILES\Common Files\GTK\2.0"
53 !define GTK_INSTALL_VERIFIER
"lib\libgtk-win32-2.0-0.dll"
54 !define GTK_RUNTIME_INSTALLER
"..\gtk_installer\gtk-runtime*.exe"
55 !define GTK_THEME_DIR
"..\gtk_installer\gtk_themes"
56 !define GTK_DEFAULT_THEME_GTKRC_DIR
"share\themes\Default\gtk-2.0"
57 !define GTK_DEFAULT_THEME_ENGINE_DIR
"lib\gtk-2.0\2.2.0\engines"
59 ;--------------------------------
60 ;Modern UI Configuration
62 !define MUI_CUSTOMPAGECOMMANDS
64 !define MUI_WELCOMEPAGE
65 !define MUI_LICENSEPAGE
66 !define MUI_COMPONENTSPAGE
67 !define MUI_COMPONENTSPAGE_SMALLDESC
68 !define MUI_DIRECTORYPAGE
69 !define MUI_FINISHPAGE
71 !define MUI_ABORTWARNING
73 !define MUI_UNINSTALLER
74 !define MUI_UNCONFIRMPAGE
76 ;--------------------------------
79 !insertmacro MUI_PAGECOMMAND_WELCOME
80 !insertmacro MUI_PAGECOMMAND_LICENSE
81 !insertmacro MUI_PAGECOMMAND_COMPONENTS
82 Page custom ShowGtkInstallDirChooser GtkInstallDirVerify
83 !insertmacro MUI_PAGECOMMAND_DIRECTORY
84 !insertmacro MUI_PAGECOMMAND_INSTFILES
85 !insertmacro MUI_PAGECOMMAND_FINISH
87 ;--------------------------------
90 !insertmacro MUI_LANGUAGE
"English"
92 ;--------------------------------
95 LangString GTK_INSTALLER_NEEDED
${LANG_ENGLISH} \
96 "The GTK+ runtime environment is either missing or needs to be upgraded.$\r \
97 Please install v${GTK_VERSION} or higher of the GTK+ runtime"
100 LangString GAIM_SECTION_TITLE
${LANG_ENGLISH} \
101 "Gaim Instant Messenger (required)"
102 LangString GTK_SECTION_TITLE
${LANG_ENGLISH} \
103 "GTK+ Rutime Environment (required)"
104 LangString GTK_THEMES_SECTION_TITLE
${LANG_ENGLISH} \
106 LangString GTK_NOTHEME_SECTION_TITLE
${LANG_ENGLISH} \
108 LangString GTK_WIMP_SECTION_TITLE
${LANG_ENGLISH} \
110 LangString GTK_BLUECURVE_SECTION_TITLE
${LANG_ENGLISH} \
112 LangString GTK_LIGHTHOUSEBLUE_SECTION_TITLE
${LANG_ENGLISH} \
113 "Light House Blue Theme"
114 LangString GAIM_SECTION_DESCRIPTION
${LANG_ENGLISH} \
115 "Core Gaim files and dlls"
116 LangString GTK_SECTION_DESCRIPTION
${LANG_ENGLISH} \
117 "A multi-platform GUI toolkit, used by Gaim"
118 LangString GTK_THEMES_SECTION_DESCRIPTION
${LANG_ENGLISH} \
119 "GTK+ Themes can change the look and feel of GTK+ applications."
120 LangString GTK_NO_THEME_DESC
${LANG_ENGLISH} \
121 "Don't install a GTK+ theme"
122 LangString GTK_WIMP_THEME_DESC
${LANG_ENGLISH} \
123 "GTK-Wimp (Windows impersonator) is a GTK theme that blends well into the Windows desktop environment."
124 LangString GTK_BLUECURVE_THEME_DESC
${LANG_ENGLISH} \
125 "The Bluecurve theme."
126 LangString GTK_LIGHTHOUSEBLUE_THEME_DESC
${LANG_ENGLISH} \
127 "The Lighthouseblue theme."
129 ; Extra GTK+ Dir Selector Page
130 LangString GTK_PAGE_TITLE
${LANG_ENGLISH} \
131 "Choose Install Location"
132 LangString GTK_PAGE_SUBTITLE
${LANG_ENGLISH} \
133 "Choose the folder in which to install GTK+"
134 LangString GTK_PAGE_INSTALL_MSG1
${LANG_ENGLISH} \
135 "Setup will install GTK+ in the following folder"
136 LangString GTK_PAGE_INSTALL_MSG2
${LANG_ENGLISH} \
137 "To install in a different folder, click Browse and select \
138 another folder. Click Next to continue."
139 LangString GTK_PAGE_UPGRADE_MSG1
${LANG_ENGLISH} \
140 "Setup will upgrade GTK+ found in the following folder"
141 LangString GTK_UPGRADE_PROMPT
${LANG_ENGLISH} \
142 "An old version of the GTK+ runtime was found. Do you wish to upgrade? $\r \
143 Note: Gaim may not work unless you do."
145 ; Gaim Section Prompts and Texts
146 LangString GAIM_UNINSTALL_DESC
${LANG_ENGLISH} \
148 LangString GAIM_PROMPT_WIPEOUT
${LANG_ENGLISH} \
149 "You're old Gaim directory is about to be deleted. Would you like to continue?$\r$\r \
150 Note: Any non-standard plugins that you may have installed will be deleted. $\r \
151 Gaim user settings will not be affected."
152 LangString GAIM_PROMPT_DIR_EXISTS
${LANG_ENGLISH} \
153 "The installation directory you specified already exists. Any contents $\r \
154 it may have will be deleted. Would you like to continue?"
156 ; GTK+ Section Prompts
157 LangString GTK_INSTALL_ERROR
${LANG_ENGLISH} \
158 "Error installing GTK+ runtime."
159 LangString GTK_BAD_INSTALL_PATH
${LANG_ENGLISH} \
160 "The path you entered can not be accessed or created."
161 LangString GTK_DLL_CONFLICT_PROMPT
${LANG_ENGLISH} \
162 "Duplicate GTK+ dlls were found in your Windows dll search path and will$\r \
163 likely conflict with your GTK+ runtime installation. $\r$\r \
165 Would you like to rename these dlls to avoid any possible conflicts?$\r \
166 (E.G. somedll.dll to somedll.dll.prob)$\r \
168 Note: Any applications relying on these dlls will no longer function.$\r \
169 It is suggested that you contact the authors of these applications$\r \
170 to notify them of this conflict."
171 LangString GTK_INSTALL_TO_GAIM_DIR
${LANG_ENGLISH} \
172 "Installing GTK+ runtime package to your Gaim installation directory.$\r \
173 (This will prevent Gaim from using any of the duplicate dlls found in $\r \
174 in your Windows dll search path)."
175 LangString GTK_CAN_NOT_RENAME_CONFLICT_DLL
${LANG_ENGLISH} \
176 "A duplicate GTK+ dll was found in your Windows dll search path and will$\r \
177 likely conflict with your GTK+ runtime installation. $\r$\r \
178 You do not have permission to rename this file. To avoid any possible dll$\r \
179 conflicts, you can install the GTK+ runtime files to the Gaim installation$\r \
180 directory. Do you wish to do so?$\r$\r \
181 Note: You may also resolve these conflicts by logging on with an Admin account$\r \
182 and running the Gaim installer once more. This will enable the Gaim installer to$\r \
183 rename the conflict dlls."
185 ; GTK+ Themes section
186 LangString GTK_NO_THEME_INSTALL_RIGHTS
${LANG_ENGLISH} \
187 "You do not have permission to install a GTK+ theme."
189 ; Uninstall Section Prompts
190 LangString un
.GAIM_UNINSTALL_ERROR_1
${LANG_ENGLISH} \
191 "The uninstaller could not find registry entries for Gaim.$\r \
192 It is likely that another user installed this application."
193 LangString un
.GAIM_UNINSTALL_ERROR_2
${LANG_ENGLISH} \
194 "You do not have permission to uninstall this application."
197 ;--------------------------------
200 LicenseData "./COPYING"
202 ;--------------------------------
204 ; Only need this if using bzip2 compression
206 ReserveFile
"${GAIM_NSIS_INCLUDE_PATH}\gtkInstall.ini"
207 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
208 ReserveFile
"${NSISDIR}\Plugins\AccessControl.dll"
209 ReserveFile
"${NSISDIR}\Plugins\UserInfo.dll"
213 ;--------------------------------
214 ;Uninstall any old version of Gaim
216 Section -SecUninstallOldGaim
217 ; Check install rights..
218 Call CheckUserInstallRights
221 StrCmp $R0 "HKLM" gaim_hklm
222 StrCmp $R0 "HKCU" gaim_hkcu done
225 ReadRegStr $R1 HKCU ${GAIM_REG_KEY} ""
226 ReadRegStr $R2 HKCU ${GAIM_REG_KEY} "Version"
227 ReadRegStr $R3 HKCU "${GAIM_UNINSTALL_KEY}" "UninstallString"
231 ReadRegStr $R1 HKLM ${GAIM_REG_KEY} ""
232 ReadRegStr $R2 HKLM ${GAIM_REG_KEY} "Version"
233 ReadRegStr $R3 HKLM "${GAIM_UNINSTALL_KEY}" "UninstallString"
235 ; If previous version exists .. remove
238 ; Version key started with 0.60a3. Prior versions can't be
239 ; automaticlly uninstalled.
240 StrCmp $R2 "" uninstall_problem
241 ; Check if we have uninstall string..
242 IfFileExists $R3 0 uninstall_problem
243 ; Have uninstall string.. go ahead and uninstall.
245 ; Need to copy uninstaller outside of the install dir
247 CopyFiles /SILENT
$R3 "$TEMP\${GAIM_UNINST_EXE}"
249 IfErrors uninstall_problem
250 ; Ready to uninstall..
252 ExecWait '"$TEMP\${GAIM_UNINST_EXE}" /S _?=$R1'
254 Delete "$TEMP\${GAIM_UNINST_EXE}"
258 Delete "$TEMP\${GAIM_UNINST_EXE}"
259 Goto uninstall_problem
262 ; In this case just wipe out previous Gaim install dir..
263 ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry
264 ; and versions 0.60 and lower did not correctly set the uninstall reg string
265 ; (the string was set in quotes)
266 MessageBox MB_YESNO $(GAIM_PROMPT_WIPEOUT
) IDYES do_wipeout
IDNO cancel_install
271 StrCmp $R0 "HKLM" gaim_del_lm_reg gaim_del_cu_reg
273 DeleteRegKey HKCU ${GAIM_REG_KEY}
274 Goto uninstall_prob_cont
276 DeleteRegKey HKLM ${GAIM_REG_KEY}
285 ;--------------------------------
286 ;GTK+ Runtime Install Section
289 Section $(GTK_SECTION_TITLE
) SecGtk
292 Call CheckUserInstallRights
297 File /oname=gtk
-runtime
.exe
${GTK_RUNTIME_INSTALLER}
300 ; This keeps track whether we install GTK+ or not..
307 StrCmp $R0 "0" have_gtk
308 StrCmp $R0 "1" upgrade_gtk
309 StrCmp $R0 "2" no_gtk no_gtk
312 StrCmp $R1 "NONE" gtk_no_install_rights
313 !insertmacro MUI_INSTALLOPTIONS_READ
$R2 "gtkInstall.ini" "Field 4" "State"
315 ExecWait '"$TEMP\gtk-runtime.exe" /S /D=$R2'
316 Goto gtk_install_cont
319 MessageBox MB_YESNO $(GTK_UPGRADE_PROMPT
) IDNO done
321 ExecWait '"$TEMP\gtk-runtime.exe" /S'
322 Goto gtk_install_cont
325 IfErrors gtk_install_error
326 StrCpy $R5 "1" ; marker that says we installed...
330 Delete "$TEMP\gtk-runtime.exe"
331 MessageBox MB_OK $(GTK_INSTALL_ERROR
) IDOK
335 StrCpy $R2 $R6 ; Copy GTK+ path
336 StrCmp $R1 "NONE" done
; If we have no rights.. can't re-install..
337 ; Even if we have a sufficient version of GTK+, we give user choice to re-install.
339 ExecWait '"$TEMP\gtk-runtime.exe" /S'
340 IfErrors gtk_install_error
343 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
344 ; end got_install rights
346 gtk_no_install_rights:
348 ExecWait '"$TEMP\gtk-runtime.exe" /S /D=$INSTDIR'
349 IfErrors gtk_install_error
352 CopyFiles /FILESONLY
"$INSTDIR\lib\*.dll" $INSTDIR
354 IfErrors gtk_install_error
355 Delete "$INSTDIR\lib\*.dll"
357 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
358 ; end gtk_no_install_rights
361 Delete "$TEMP\gtk-runtime.exe"
362 SectionEnd ; end of GTK+ section
365 ;--------------------------------
366 ;Gaim Install Section
368 Section $(GAIM_SECTION_TITLE
) SecGaim
371 ; Check install rights..
372 Call CheckUserInstallRights
375 ; Get GTK+ lib dir if we have it..
377 StrCmp $R0 "NONE" gaim_none
378 StrCmp $R0 "HKLM" gaim_hklm gaim_hkcu
381 ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path"
382 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R1\lib"
383 WriteRegStr HKLM ${GAIM_REG_KEY} "" "$INSTDIR"
384 WriteRegStr HKLM ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}"
385 WriteRegStr HKLM "${GAIM_UNINSTALL_KEY}" "DisplayName" $(GAIM_UNINSTALL_DESC
)
386 WriteRegStr HKLM "${GAIM_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GAIM_UNINST_EXE}"
387 ; Sets scope of the desktop and Start Menu entries for all users.
388 SetShellVarContext
"all"
389 Goto gaim_install_files
392 ReadRegStr $R1 HKCU ${GTK_REG_KEY} "Path"
393 StrCmp $R1 "" 0 gaim_hkcu1
394 ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path"
396 WriteRegStr HKCU ${GAIM_REG_KEY} "" "$INSTDIR"
397 WriteRegStr HKCU ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}"
398 WriteRegStr HKCU "${GAIM_UNINSTALL_KEY}" "DisplayName" $(GAIM_UNINSTALL_DESC
)
399 WriteRegStr HKCU "${GAIM_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GAIM_UNINST_EXE}"
400 Goto gaim_install_files
403 ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path"
406 SetOutPath "$INSTDIR"
409 File /r
.\win32
-install
-dir\
*.*
411 File ..\win32
-dev\drmingw\exchndl
.dll
414 ; If we don't have install rights and no hklm GTK install.. then Start in lnk property should
415 ; remain gaim dir.. otherwise it should be set to the GTK lib dir. (to avoid dll hell)
416 StrCmp $R0 "NONE" 0 startin_gtk
417 StrCmp $R1 "" startin_gaim
421 CreateDirectory "$SMPROGRAMS\Gaim"
422 CreateShortCut "$SMPROGRAMS\Gaim\Gaim.lnk" "$INSTDIR\gaim.exe"
423 CreateShortCut "$DESKTOP\Gaim.lnk" "$INSTDIR\gaim.exe"
424 SetOutPath "$INSTDIR"
426 ; If we don't have install rights.. we're done
427 StrCmp $R0 "NONE" done
428 CreateShortCut "$SMPROGRAMS\Gaim\Uninstall.lnk" "$INSTDIR\${GAIM_UNINST_EXE}"
431 ; write out uninstaller
433 WriteUninstaller "$INSTDIR\${GAIM_UNINST_EXE}"
437 SectionEnd ; end of default Gaim section
439 ;--------------------------------
442 SubSection
/e
$(GTK_THEMES_SECTION_TITLE
) SecGtkThemes
443 Section $(GTK_NOTHEME_SECTION_TITLE
) SecGtkNone
447 Section $(GTK_WIMP_SECTION_TITLE
) SecGtkWimp
448 Call CanWeInstallATheme
453 Rename $R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
$R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
.old
454 SetOutPath $R1\
${GTK_DEFAULT_THEME_ENGINE_DIR}
455 File ${GTK_THEME_DIR}\engines\libwimp
.dll
456 SetOutPath $R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}
457 File ${GTK_THEME_DIR}\themes\gtkrc
.gtkwimp
458 File /oname=gtkrc
${GTK_THEME_DIR}\themes\gtkrc
.gtkwimp
464 Section $(GTK_BLUECURVE_SECTION_TITLE
) SecGtkBluecurve
465 Call CanWeInstallATheme
470 Rename $R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
$R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
.old
471 SetOutPath $R1\
${GTK_DEFAULT_THEME_ENGINE_DIR}
472 File ${GTK_THEME_DIR}\engines\libbluecurve
.dll
473 SetOutPath $R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}
474 File ${GTK_THEME_DIR}\themes\gtkrc
.bluecurve
475 File /oname=gtkrc
${GTK_THEME_DIR}\themes\gtkrc
.bluecurve
481 Section $(GTK_LIGHTHOUSEBLUE_SECTION_TITLE
) SecGtkLighthouseblue
482 Call CanWeInstallATheme
487 Rename $R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
$R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
.old
488 SetOutPath $R1\
${GTK_DEFAULT_THEME_ENGINE_DIR}
489 File ${GTK_THEME_DIR}\engines\liblighthouseblue
.dll
490 SetOutPath $R1\
${GTK_DEFAULT_THEME_GTKRC_DIR}
491 File ${GTK_THEME_DIR}\themes\gtkrc
.lighthouseblue
492 File /oname=gtkrc
${GTK_THEME_DIR}\themes\gtkrc
.lighthouseblue
499 ;--------------------------------
504 Call un
.CheckUserInstallRights
506 StrCmp $R0 "NONE" no_rights
507 StrCmp $R0 "HKCU" try_hkcu try_hklm
510 ReadRegStr $R0 HKCU ${GAIM_REG_KEY} ""
511 StrCmp $R0 $INSTDIR 0 cant_uninstall
512 ; HKCU install path matches our INSTDIR.. so uninstall
513 DeleteRegKey HKCU ${GAIM_REG_KEY}
514 DeleteRegKey HKCU "${GAIM_UNINSTALL_KEY}"
518 ReadRegStr $R0 HKLM ${GAIM_REG_KEY} ""
519 StrCmp $R0 $INSTDIR 0 try_hkcu
520 ; HKLM install path matches our INSTDIR.. so uninstall
521 DeleteRegKey HKLM ${GAIM_REG_KEY}
522 DeleteRegKey HKLM "${GAIM_UNINSTALL_KEY}"
523 DeleteRegKey HKLM "${HKLM_APP_PATHS_KEY}"
524 ; Sets start menu and desktop scope to all users..
525 SetShellVarContext
"all"
528 ; The WinPrefs plugin may have left this behind..
529 DeleteRegValue HKCU "${GAIM_STARTUP_RUN_KEY}" "Gaim"
530 DeleteRegValue HKLM "${GAIM_STARTUP_RUN_KEY}" "Gaim"
532 RMDir /r
"$INSTDIR\locale"
533 RMDir /r
"$INSTDIR\pixmaps"
534 Delete "$INSTDIR\plugins\autorecon.dll"
535 Delete "$INSTDIR\plugins\iconaway.dll"
536 Delete "$INSTDIR\plugins\docklet.dll"
537 Delete "$INSTDIR\plugins\perl.dll"
538 Delete "$INSTDIR\plugins\libgg.dll"
539 Delete "$INSTDIR\plugins\libirc.dll"
540 Delete "$INSTDIR\plugins\libjabber.dll"
541 Delete "$INSTDIR\plugins\libmsn.dll"
542 Delete "$INSTDIR\plugins\liboscar.dll"
543 Delete "$INSTDIR\plugins\libtoc.dll"
544 Delete "$INSTDIR\plugins\libyahoo.dll"
545 Delete "$INSTDIR\plugins\spellchk.dll"
546 Delete "$INSTDIR\plugins\ticker.dll"
547 Delete "$INSTDIR\plugins\win2ktrans.dll"
548 Delete "$INSTDIR\plugins\winprefs.dll"
549 RMDir "$INSTDIR\plugins"
550 Delete "$INSTDIR\sounds\gaim\arrive.wav"
551 Delete "$INSTDIR\sounds\gaim\leave.wav"
552 Delete "$INSTDIR\sounds\gaim\receive.wav"
553 Delete "$INSTDIR\sounds\gaim\redalert.wav"
554 Delete "$INSTDIR\sounds\gaim\send.wav"
555 RMDir "$INSTDIR\sounds\gaim"
556 RMDir "$INSTDIR\sounds"
557 Delete "$INSTDIR\gaim.dll"
558 Delete "$INSTDIR\gaim.exe"
559 Delete "$INSTDIR\${GAIM_UNINST_EXE}"
560 Delete "$INSTDIR\idletrack.dll"
561 Delete "$INSTDIR\libgtkspell.dll"
562 Delete "$INSTDIR\perl56.dll"
563 ;Remove possible GTK+ files and folders..
564 RMDir \r
"$INSTDIR\lib"
565 RMDir \r
"$INSTDIR\share"
566 RMDir \r
"$INSTDIR\locale"
567 RMDir \r
"$INSTDIR\bin"
568 Delete "$INSTDIR\*.dll"
569 ;Try to remove Gaim install dir .. if empty
573 RMDir /r
"$SMPROGRAMS\Gaim"
574 Delete "$DESKTOP\Gaim.lnk"
579 MessageBox MB_OK $(un
.GAIM_UNINSTALL_ERROR_1
) IDOK
583 MessageBox MB_OK $(un
.GAIM_UNINSTALL_ERROR_2
) IDOK
587 ;Display the Finish header
588 !insertmacro MUI_UNFINISHHEADER
589 SectionEnd ; end of uninstall section
591 ;--------------------------------
593 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
594 !insertmacro MUI_DESCRIPTION_TEXT
${SecGaim} \
595 $(GAIM_SECTION_DESCRIPTION
)
597 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtk} \
598 $(GTK_SECTION_DESCRIPTION
)
600 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtkThemes} \
601 $(GTK_THEMES_SECTION_DESCRIPTION
)
602 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtkNone} \
604 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtkWimp} \
605 $(GTK_WIMP_THEME_DESC
)
606 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtkBluecurve} \
607 $(GTK_BLUECURVE_THEME_DESC
)
608 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtkLighthouseblue} \
609 $(GTK_LIGHTHOUSEBLUE_THEME_DESC
)
610 !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
612 ;--------------------------------
618 ; Call CanWeInstallATheme
623 ; "root path of GTK+ installation" - if yes
625 Function CanWeInstallATheme
629 ; Did we install GTK+ to the Gaim dir?
630 IfFileExists "$INSTDIR\lib" 0 check_keys
635 ; First see if we can install a theme..
636 Call CheckUserInstallRights
639 StrCmp $0 "HKCU" hkcu
640 StrCmp $0 "HKLM" hklm no_rights
643 ReadRegStr $1 HKCU ${GTK_REG_KEY} "Path"
644 StrCmp $1 "" no_rights done
647 ReadRegStr $1 HKLM ${GTK_REG_KEY} "Path"
648 StrCmp $1 "" no_rights done
651 MessageBox MB_OK $(GTK_NO_THEME_INSTALL_RIGHTS
) IDOK done
660 Function CheckUserInstallRights
665 UserInfo::GetAccountType
668 StrCmp $1 "Admin" 0 +3
671 StrCmp $1 "Power" 0 +3
674 StrCmp $1 "User" 0 +3
677 StrCmp $1 "Guest" 0 +3
691 Function un
.CheckUserInstallRights
696 UserInfo::GetAccountType
698 StrCmp $1 "Admin" 0 +3
701 StrCmp $1 "Power" 0 +3
704 StrCmp $1 "User" 0 +3
707 StrCmp $1 "Guest" 0 +3
723 ; Push $0 ; Path string
725 ; Pop $0 ; 0 - Bad path 1 - Good path
730 IfFileExists $0 dir_exists
731 StrCpy $1 $0 ; save last
736 ; IfFileExists "C:" on xp returns true and on win2k returns false
737 ; So we're done in such a case..
738 StrCmp $2 "2" loop_done
742 StrCpy $1 "$0\GaImFooB"
743 ; Check if we can create dir on this drive..
746 IfErrors DirBad DirGood
750 FileOpen $1 "$0\gaimfoo.bar" w
751 IfErrors PathBad PathGood
763 Delete "$0\gaimfoo.bar"
771 Delete "$0\gaimfoo.bar"
777 Function .onVerifyInstDir
781 StrCmp $0 "0" 0 dir_good
787 ; input, top of stack (e.g. C:\Program Files\Poop)
788 ; output, top of stack (replaces, with e.g. C:\Program Files)
789 ; modifies no other variables.
792 ; Push "C:\Program Files\Directory\Whatever"
795 ; ; at this point $R0 will equal "C:\Program Files\Directory"
797 Exch $0 ; old $0 is on top of stack
811 Exch $0 ; put $0 on top of stack, restore $0 to original value
816 ; inputs: Push 2 GTK+ version strings to check. The major and minor values
817 ; need to be equal, for success. If the micro val to check is equal or greater
818 ; to the refrence micro value, then we have success.
821 ; Push "2.2.0" ; Refrence version
822 ; Push "2.2.1" ; Version to check
823 ; Call CheckGtkVersion
825 ; $R0 will now equal "0", because 2.2.0 is less than 2.2.1
827 Function CheckGtkVersion
828 ; Version we want to check
833 ; Check that the string to check is at least 5 chars long (i.e. x.x.x)
835 IntCmp $7 5 0 bad_version
837 ; Major version check
840 IntCmp $7 $9 check_minor
846 IntCmp $7 $9 check_micro
852 IntCmp $7 $9 good_version bad_version good_version
869 ; 0 - We have the correct version
870 ; Second Pop: Key where Version was found
871 ; 1 - We have an old version that needs to be upgraded
872 ; Second Pop: HKLM or HKCU depending on where GTK was found.
873 ; 2 - We don't have Gtk+ at all
874 ; Second Pop: "NONE, HKLM or HKCU" depending on our rights..
878 ; - Check what user rights we have (HKLM or HKCU)
880 ; - Only check HKLM key for GTK+
881 ; - If installed to HKLM, check it and return.
883 ; - First check HKCU key for GTK+
884 ; - if good or bad exists stop and ret.
885 ; - If no hkcu gtk+ install, check HKLM
886 ; - If HKLM ver exists but old, return as if no ver exits.
890 Call CheckUserInstallRights
892 StrCmp $3 "HKLM" check_hklm
893 StrCmp $3 "HKCU" check_hkcu check_hklm
895 ReadRegStr $0 HKCU ${GTK_REG_KEY} "Version"
897 StrCmp $0 "" check_hklm have_gtk
900 ReadRegStr $0 HKLM ${GTK_REG_KEY} "Version"
902 StrCmp $0 "" no_gtk have_gtk
906 ; GTK+ is already installed.. check version.
907 StrCpy $1 ${GTK_VERSION} ; Minimum GTK+ version needed
912 StrCmp $2 "1" good_version bad_version
914 ; Bad version. If hklm ver and we have hkcu or no rights.. return no gtk
915 StrCmp $3 "NONE" no_gtk
; if no rights.. can't upgrade
916 StrCmp $3 "HKCU" 0 upgrade_gtk
; if HKLM can upgrade..
917 StrCmp $5 "HKLM" no_gtk upgrade_gtk
; have hkcu rights.. if found hklm ver can't upgrade..
926 ; Just make sure we have it. There was a gtk+ uninstaller that
927 ; left behind reg entries after uninstalling..
928 StrCmp $5 "HKLM" have_hklm_gtk have_hkcu_gtk
931 ReadRegStr $4 HKCU ${GTK_REG_KEY} "Path"
932 StrCpy $1 "$4\${GTK_INSTALL_VERIFIER}"
933 IfFileExists $1 good_version_verified
934 DeleteRegKey HKCU ${GTK_REG_KEY}
938 ReadRegStr $4 HKLM ${GTK_REG_KEY} "Path"
939 StrCpy $1 "$4\${GTK_INSTALL_VERIFIER}"
940 IfFileExists $1 good_version_verified
941 DeleteRegKey HKLM ${GTK_REG_KEY}
944 good_version_verified:
946 Push $4 ; The path to existing GTK+
960 ; If this installer dosn't have GTK, check whether we need it.
966 StrCmp $0 "0" have_gtk need_gtk
968 MessageBox MB_OK $(GTK_INSTALLER_NEEDED
) IDOK
972 ;Extract InstallOptions INI Files
973 !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS
"${GAIM_NSIS_INCLUDE_PATH}\gtkInstall.ini" "gtkInstall.ini"
976 Call CheckUserInstallRights
979 StrCmp $0 "HKLM" 0 user_dir
980 StrCpy $INSTDIR "$PROGRAMFILES\Gaim"
983 StrCpy $2 "$SMPROGRAMS"
988 StrCpy $INSTDIR "$2\Gaim"
992 ; Set up Theme sections..
993 StrCpy $1 ${SecGtkNone} ; Sets global to remember which theme is set.
994 !insertmacro SelectSection
${SecGtkNone}
995 !insertmacro UnselectSection
${SecGtkWimp}
996 !insertmacro UnselectSection
${SecGtkBluecurve}
997 !insertmacro UnselectSection
${SecGtkLighthouseblue}
1001 Function .onSelChange
1005 StrCpy $2 ${SF_SELECTED}
1006 SectionGetFlags
${SecGtkNone} $0
1008 SectionGetFlags
${SecGtkWimp} $0
1010 SectionGetFlags
${SecGtkBluecurve} $0
1012 SectionGetFlags
${SecGtkLighthouseblue} $0
1015 SectionSetFlags
${SecGtkNone} 0
1016 SectionSetFlags
${SecGtkWimp} 0
1017 SectionSetFlags
${SecGtkBluecurve} 0
1018 SectionSetFlags
${SecGtkLighthouseblue} 0
1021 !insertmacro UnselectSection
$1
1023 ; Remember old selection
1026 ; Now go through and see who is checked..
1027 SectionGetFlags
${SecGtkNone} $0
1028 IntOp $0 $0 & ${SF_SELECTED}
1029 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1030 StrCpy $1 ${SecGtkNone}
1031 SectionGetFlags
${SecGtkWimp} $0
1032 IntOp $0 $0 & ${SF_SELECTED}
1033 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1034 StrCpy $1 ${SecGtkWimp}
1035 SectionGetFlags
${SecGtkBluecurve} $0
1036 IntOp $0 $0 & ${SF_SELECTED}
1037 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1038 StrCpy $1 ${SecGtkBluecurve}
1039 SectionGetFlags
${SecGtkLighthouseblue} $0
1040 IntOp $0 $0 & ${SF_SELECTED}
1041 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1042 StrCpy $1 ${SecGtkLighthouseblue}
1044 StrCmp $2 $1 0 +2 ; selection hasn't changed
1045 !insertmacro SelectSection
$1
1051 Function ShowGtkInstallDirChooser
1056 StrCmp $0 "0" have_gtk
1057 StrCmp $0 "1" upgrade_gtk
1058 StrCmp $0 "2" no_gtk no_gtk
1060 ; Don't show dir selector.. Upgrades are done to existing path..
1066 StrCmp $1 "NONE" 0 no_gtk_cont
1067 ; Got no install rights..
1071 StrCmp $1 "HKCU" 0 hklm1
1072 StrCpy $2 "$SMPROGRAMS"
1077 StrCpy $2 "$2\GTK\2.0"
1080 StrCpy $2 "${GTK_DEFAULT_INSTALL_PATH}"
1083 !insertmacro MUI_INSTALLOPTIONS_WRITE
"gtkInstall.ini" "Field 4" "State" $2
1085 !insertmacro MUI_INSTALLOPTIONS_WRITE
"gtkInstall.ini" "Field 1" "Text" $(GTK_PAGE_INSTALL_MSG1
)
1086 !insertmacro MUI_INSTALLOPTIONS_WRITE
"gtkInstall.ini" "Field 2" "Text" $(GTK_PAGE_INSTALL_MSG2
)
1087 !insertmacro MUI_HEADER_TEXT
"$(GTK_PAGE_TITLE)" "$(GTK_PAGE_SUBTITLE)"
1088 !insertmacro MUI_INSTALLOPTIONS_DISPLAY
"gtkInstall.ini"
1091 Function GtkInstallDirVerify
1092 !insertmacro MUI_INSTALLOPTIONS_READ
$0 "gtkInstall.ini" "Field 4" "State"
1096 StrCmp $0 "0" 0 done
1097 MessageBox MB_OK $(GTK_BAD_INSTALL_PATH
) IDOK