comparison gaim-installer.nsi @ 5332:4d734dbc88dd

[gaim-migrate @ 5705] Improved installer.. Now installs for all users, not only admins. Gaim is once again installing GTK+, through the GTK+ installer available at Gaim's win32 web page. Also now giving user option to install GTK theme engines. There is also now a half way solution to deal with DLL Hell.. On installation the Gaim installer will notify the user if there are any dlls in his system directories that could conflict with the GTK dlls, and will offer to rename them to avoid the conflict. This is a half way solution because it will probably break the apps responsible for putting those dlls in the system directories.. committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Thu, 08 May 2003 04:17:01 +0000
parents ff58f210135c
children e44333671363
comparison
equal deleted inserted replaced
5331:0cf56ff1b0d6 5332:4d734dbc88dd
1 ; Installer script for win32 Gaim 1 ; Installer script for win32 Gaim
2 ; Herman Bloggs <hermanator12002@yahoo.com> 2 ; Herman Bloggs <hermanator12002@yahoo.com>
3 3
4 ; NOTE: this .NSI script is designed for NSIS v2.0b3+ 4 ; NOTE: this .NSI script is designed for NSIS v2.0b4+
5 5
6 !define MUI_PRODUCT "Gaim" ;Define your own software name here 6 ;--------------------------------
7 !define MUI_VERSION ${GAIM_VERSION} ;Define your own software version here 7 ;Configuration
8
9 ;General
10 OutFile "gaim-${GAIM_VERSION}.exe"
11 SetCompressor bzip2
12
13 DirShow show
14 ShowInstDetails show
15 ShowUninstDetails show
16 SetDateSave on
17
18 ; $INSTDIR is set in .onInit function..
8 19
9 !include "MUI.nsh" 20 !include "MUI.nsh"
10 21 !include Sections.nsh
11 ;-------------------------------- 22
12 ;Configuration 23 ;--------------------------------
13 24 ;Defines
14 ;General 25
15 OutFile "gaim-${GAIM_VERSION}.exe" 26 !define MUI_PRODUCT "Gaim"
16 27 !define MUI_VERSION ${GAIM_VERSION}
17 ;Folder selection page 28
18 InstallDir "$PROGRAMFILES\Gaim" 29 !define MUI_ICON .\pixmaps\gaim-install.ico
19 30 !define MUI_UNICON .\pixmaps\gaim-install.ico
20 ;Remember install folder 31
21 InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" "" 32 !define GAIM_NSIS_INCLUDE_PATH ".\src\win32\nsis"
22 33
23 !define MUI_ICON .\pixmaps\gaim-install.ico 34 !define GAIM_REG_KEY "SOFTWARE\gaim"
24 !define MUI_UNICON .\pixmaps\gaim-install.ico 35 !define GAIM_UNINSTALL_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
25 36 !define HKLM_APP_PATHS_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe"
37 !define GAIM_UNINST_EXE "gaim-uninst.exe"
38
39 !define GTK_VERSION "2.2.1"
40 !define GTK_REG_KEY "SOFTWARE\GTK\2.0"
41 !define GTK_DEFAULT_INSTALL_PATH "$PROGRAMFILES\Common Files\GTK\2.0"
42 !define GTK_INSTALL_VERIFIER "lib\libgtk-win32-2.0-0.dll"
43 !define GTK_RUNTIME_INSTALLER "..\gtk_installer\gtk-runtime*.exe"
44 !define GTK_THEME_DIR "..\gtk_installer\gtk_themes"
45 !define GTK_DEFAULT_THEME_GTKRC_DIR "share\themes\Default\gtk-2.0"
46 !define GTK_DEFAULT_THEME_ENGINE_DIR "lib\gtk-2.0\2.2.0\engines"
26 47
27 ;-------------------------------- 48 ;--------------------------------
28 ;Modern UI Configuration 49 ;Modern UI Configuration
50
51 !define MUI_CUSTOMPAGECOMMANDS
29 52
30 !define MUI_WELCOMEPAGE 53 !define MUI_WELCOMEPAGE
31 !define MUI_LICENSEPAGE 54 !define MUI_LICENSEPAGE
55 !define MUI_COMPONENTSPAGE
56 !define MUI_COMPONENTSPAGE_SMALLDESC
32 !define MUI_DIRECTORYPAGE 57 !define MUI_DIRECTORYPAGE
33 !define MUI_FINISHPAGE 58 !define MUI_FINISHPAGE
34 59
35 !define MUI_ABORTWARNING 60 !define MUI_ABORTWARNING
36 61
37 !define MUI_UNINSTALLER 62 !define MUI_UNINSTALLER
38 !define MUI_UNCONFIRMPAGE 63 !define MUI_UNCONFIRMPAGE
64
65 ;--------------------------------
66 ;Pages
39 67
68 !insertmacro MUI_PAGECOMMAND_WELCOME
69 !insertmacro MUI_PAGECOMMAND_LICENSE
70 !insertmacro MUI_PAGECOMMAND_COMPONENTS
71 !insertmacro MUI_PAGECOMMAND_DIRECTORY
72 Page custom ShowGtkInstallDirChooser GtkInstallDirVerify
73 !insertmacro MUI_PAGECOMMAND_INSTFILES
74 !insertmacro MUI_PAGECOMMAND_FINISH
75
40 ;-------------------------------- 76 ;--------------------------------
41 ;Languages 77 ;Languages
42 78
43 !insertmacro MUI_LANGUAGE "English" 79 !insertmacro MUI_LANGUAGE "English"
44 80
81 ;--------------------------------
82 ;Language Strings
83
84 ; Componants Page
85 LangString GAIM_SECTION_TITLE ${LANG_ENGLISH} \
86 "Gaim Instant Messenger (required)"
87 LangString GTK_SECTION_TITLE ${LANG_ENGLISH} \
88 "GTK+ Rutime Environment (required)"
89 LangString GTK_THEMES_SECTION_TITLE ${LANG_ENGLISH} \
90 "GTK+ Themes"
91 LangString GTK_NOTHEME_SECTION_TITLE ${LANG_ENGLISH} \
92 "No Theme"
93 LangString GTK_WIMP_SECTION_TITLE ${LANG_ENGLISH} \
94 "Wimp Theme"
95 LangString GTK_BLUECURVE_SECTION_TITLE ${LANG_ENGLISH} \
96 "Bluecurve Theme"
97 LangString GTK_LIGHTHOUSEBLUE_SECTION_TITLE ${LANG_ENGLISH} \
98 "Light House Blue Theme"
99 LangString GAIM_SECTION_DESCRIPTION ${LANG_ENGLISH} \
100 "Core Gaim files and dlls"
101 LangString GTK_SECTION_DESCRIPTION ${LANG_ENGLISH} \
102 "A multi-platform GUI toolkit, used by Gaim"
103 LangString GTK_THEMES_SECTION_DESCRIPTION ${LANG_ENGLISH} \
104 "GTK+ Themes can change the look and feel of GTK+ applications."
105 LangString GTK_NO_THEME_DESC ${LANG_ENGLISH} \
106 "Don't install a GTK+ theme"
107 LangString GTK_WIMP_THEME_DESC ${LANG_ENGLISH} \
108 "GTK-Wimp (Windows impersonator) is a GTK theme that blends well into the Windows desktop environment."
109 LangString GTK_BLUECURVE_THEME_DESC ${LANG_ENGLISH} \
110 "The Bluecurve theme."
111 LangString GTK_LIGHTHOUSEBLUE_THEME_DESC ${LANG_ENGLISH} \
112 "The Lighthouseblue theme."
113
114 ; Extra GTK+ Dir Selector Page
115 LangString GTK_PAGE_TITLE ${LANG_ENGLISH} \
116 "Choose Install Location"
117 LangString GTK_PAGE_SUBTITLE ${LANG_ENGLISH} \
118 "Choose the folder in which to install GTK+"
119 LangString GTK_PAGE_INSTALL_MSG1 ${LANG_ENGLISH} \
120 "Setup will install GTK+ in the following folder"
121 LangString GTK_PAGE_INSTALL_MSG2 ${LANG_ENGLISH} \
122 "To install in a different folder, click Browse and select \
123 another folder. Click Next to continue."
124 LangString GTK_PAGE_UPGRADE_MSG1 ${LANG_ENGLISH} \
125 "Setup will upgrade GTK+ found in the following folder"
126 LangString GTK_UPGRADE_PROMPT ${LANG_ENGLISH} \
127 "An old version of the GTK+ runtime was found. Do you wish to upgrade? $\r \
128 Note: Gaim may not work unless you do."
129
130 ; Gaim Section Prompts and Texts
131 LangString GAIM_UNINSTALL_DESC ${LANG_ENGLISH} \
132 "Gaim (remove only)"
133 LangString GAIM_PROMPT_WIPEOUT ${LANG_ENGLISH} \
134 "You're old Gaim directory is about to be deleted. Would you like to continue?$\r$\r \
135 Note: Any non-standard plugins that you may have installed will be deleted. $\r \
136 Gaim user settings will not be affected."
137 LangString GAIM_PROMPT_DIR_EXISTS ${LANG_ENGLISH} \
138 "The installation directory you specified already exists. Any contents $\r \
139 it may have will be deleted. Would you like to continue?"
140
141 ; GTK+ Section Prompts
142 LangString GTK_INSTALL_ERROR ${LANG_ENGLISH} \
143 "Error installing GTK+ runtime."
144 LangString GTK_BAD_INSTALL_PATH ${LANG_ENGLISH} \
145 "The path you entered can not be accessed or created."
146 LangString GTK_DLL_CONFLICT_PROMPT ${LANG_ENGLISH} \
147 "Duplicate GTK+ dlls were found in your Windows dll search path and will$\r \
148 likely conflict with your GTK+ runtime installation. $\r$\r \
149 $\r \
150 Would you like to rename these dlls to avoid any possible conflicts?$\r \
151 (E.G. somedll.dll to somedll.dll.prob)$\r \
152 $\r \
153 Note: Any applications relying on these dlls will no longer function.$\r \
154 It is suggested that you contact the authors of these applications$\r \
155 to notify them of this conflict."
156 LangString GTK_INSTALL_TO_GAIM_DIR ${LANG_ENGLISH} \
157 "Installing GTK+ runtime package to your Gaim installation directory.$\r \
158 (This will prevent Gaim from using any of the duplicate dlls found in $\r \
159 in your Windows dll search path)."
160 LangString GTK_CAN_NOT_RENAME_CONFLICT_DLL ${LANG_ENGLISH} \
161 "A duplicate GTK+ dll was found in your Windows dll search path and will$\r \
162 likely conflict with your GTK+ runtime installation. $\r$\r \
163 You do not have permission to rename this file. To avoid any possible dll$\r \
164 conflicts, you can install the GTK+ runtime files to the Gaim installation$\r \
165 directory. Do you wish to do so?$\r$\r \
166 Note: You may also resolve these conflicts by logging on with an Admin account$\r \
167 and running the Gaim installer once more. This will enable the Gaim installer to$\r \
168 rename the conflict dlls."
169
170 ; GTK+ Themes section
171 LangString GTK_NO_THEME_INSTALL_RIGHTS ${LANG_ENGLISH} \
172 "You do not have permission to install a GTK+ theme."
173
174 ; Uninstall Section Prompts
175 LangString un.GAIM_UNINSTALL_ERROR_1 ${LANG_ENGLISH} \
176 "The uninstaller could not find registry entries for Gaim.$\r \
177 It is likely that another user installed this application."
178 LangString un.GAIM_UNINSTALL_ERROR_2 ${LANG_ENGLISH} \
179 "You do not have permission to uninstall this application."
180
181
45 ;-------------------------------- 182 ;--------------------------------
46 ;Data 183 ;Data
47 184
48 LicenseData "./COPYING" 185 LicenseData "./COPYING"
49 186
50 ;-------------------------------- 187 ;--------------------------------
188 ;Reserve Files
189 ; Only need this if using bzip2 compression
190
191 ReserveFile "${GAIM_NSIS_INCLUDE_PATH}\gtkInstall.ini"
192 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
193 ReserveFile "${NSISDIR}\Plugins\AccessControl.dll"
194 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
195
196 ;--------------------------------
51 ;Installer Sections 197 ;Installer Sections
52 198
53 Section "" ; (default section) 199 Section $(GAIM_SECTION_TITLE) SecGaim
54 ; Check if previous intallation exists 200 SectionIn 1 RO
55 ReadRegStr $R0 HKEY_LOCAL_MACHINE "SOFTWARE\gaim" "" 201
56 StrCmp $R0 "" cont_install 202 ; Check install rights..
57 ; Previous version found 203 Call CheckUserInstallRights
58 ReadRegStr $R1 HKEY_LOCAL_MACHINE "SOFTWARE\gaim" "Version" 204 Pop $R0
59 ; Version key started with 0.60a3. Prior versions can't be 205
60 ; automaticlly uninstalled. 206 StrCmp $R0 "HKLM" gaim_hklm
61 StrCmp $R1 "" uninstall_error 207 StrCmp $R0 "HKCU" gaim_hkcu gaim_install_files
62 ; Version found - Read in uninstall string. 208
63 ReadRegStr $R2 HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" "UninstallString" 209 gaim_hkcu:
64 StrCmp $R2 "" uninstall_error 210 ReadRegStr $R1 HKCU ${GAIM_REG_KEY} ""
65 ; Have uninstall string.. go ahead and uninstall. 211 ReadRegStr $R2 HKCU ${GAIM_REG_KEY} "Version"
66 SetOverwrite on 212 ReadRegStr $R3 HKCU "${GAIM_UNINSTALL_KEY}" "UninstallString"
67 ; Need to copy uninstaller outside of the install dir so that when deleting 213 Goto try_uninstall
68 ; the install dir we won't come across an in use binary. 214
69 CopyFiles /SILENT $R2 "$TEMP\gaim-uninst.exe" 215 gaim_hklm:
70 SetOverwrite off 216 ReadRegStr $R1 HKLM ${GAIM_REG_KEY} ""
71 IfErrors uninstall_error uninstall_copy 217 ReadRegStr $R2 HKLM ${GAIM_REG_KEY} "Version"
72 uninstall_copy: 218 ReadRegStr $R3 HKLM "${GAIM_UNINSTALL_KEY}" "UninstallString"
73 ExecWait '"$TEMP\gaim-uninst.exe" /S _?=$R0' 219
74 IfErrors exec_error exec_cont 220 ; If previous version exists .. remove
75 exec_cont: 221 try_uninstall:
76 Delete "$TEMP\gaim-uninst.exe" 222 StrCmp $R1 "" cont_install
77 Goto cont_install 223 ; Version key started with 0.60a3. Prior versions can't be
78 exec_error: 224 ; automaticlly uninstalled.
79 Delete "$TEMP\gaim-uninst.exe" 225 StrCmp $R2 "" uninstall_problem
80 226 ; Check if we have uninstall string..
81 uninstall_error: 227 IfFileExists $R3 0 uninstall_problem
82 ; In this case just wipe out previous Gaim install dir.. 228 ; Have uninstall string.. go ahead and uninstall.
83 ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry 229 SetOverwrite on
84 ; and versions 0.60 and lower did not correctly set the uninstall reg string 230 ; Need to copy uninstaller outside of the install dir
85 ; (the string was set in quotes) 231 ClearErrors
86 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" 232 CopyFiles /SILENT $R3 "$TEMP\${GAIM_UNINST_EXE}"
87 RMDir /r "$R0" 233 SetOverwrite off
88 234 IfErrors uninstall_problem
89 cont_install: 235 ; Ready to uninstall..
90 ; Check to see if GTK+ Runtime is installed. 236 ClearErrors
91 ReadRegStr $R0 HKEY_LOCAL_MACHINE "SOFTWARE\GTK\2.0" "Version" 237 ExecWait '"$TEMP\${GAIM_UNINST_EXE}" /S _?=$R1'
92 StrCmp $R0 "" no_gtk have_gtk 238 IfErrors exec_error
239 Delete "$TEMP\${GAIM_UNINST_EXE}"
240 Goto cont_install
241
242 exec_error:
243 Delete "$TEMP\${GAIM_UNINST_EXE}"
244 Goto uninstall_problem
245
246 uninstall_problem:
247 ; In this case just wipe out previous Gaim install dir..
248 ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry
249 ; and versions 0.60 and lower did not correctly set the uninstall reg string
250 ; (the string was set in quotes)
251 MessageBox MB_YESNO $(GAIM_PROMPT_WIPEOUT) IDYES do_wipeout IDNO cancel_install
252 cancel_install:
253 Quit
254
255 do_wipeout:
256 StrCmp $R0 "HKLM" gaim_del_lm_reg gaim_del_cu_reg
257 gaim_del_cu_reg:
258 DeleteRegKey HKCU ${GAIM_REG_KEY}
259 Goto uninstall_prob_cont
260 gaim_del_lm_reg:
261 DeleteRegKey HKLM ${GAIM_REG_KEY}
262
263 uninstall_prob_cont:
264 RMDir /r "$R1"
265
266 cont_install:
267 ; Gaim Registry Settings
268 StrCmp $R0 "HKLM" gaim_hklm1 gaim_hkcu1
269
270 gaim_hklm1:
271 WriteRegStr HKLM ${GAIM_REG_KEY} "" "$INSTDIR"
272 WriteRegStr HKLM ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}"
273 WriteRegStr HKLM "${GAIM_UNINSTALL_KEY}" "DisplayName" $(GAIM_UNINSTALL_DESC)
274 WriteRegStr HKLM "${GAIM_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GAIM_UNINST_EXE}"
275 ; Sets scope of the desktop and Start Menu entries for all users.
276 SetShellVarContext "all"
277 Goto gaim_install_files
278
279 gaim_hkcu1:
280 WriteRegStr HKCU ${GAIM_REG_KEY} "" "$INSTDIR"
281 WriteRegStr HKCU ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}"
282 WriteRegStr HKCU "${GAIM_UNINSTALL_KEY}" "DisplayName" $(GAIM_UNINSTALL_DESC)
283 WriteRegStr HKCU "${GAIM_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GAIM_UNINST_EXE}"
284 Goto gaim_install_files
285
286 gaim_install_files:
287 SetOutPath "$INSTDIR"
288 ; Gaim files
289 SetOverwrite on
290 File /r .\win32-install-dir\*.*
291
292 ; This stuff we do in both cases (install rights and no install rights)
293 CreateDirectory "$SMPROGRAMS\Gaim"
294 CreateShortCut "$SMPROGRAMS\Gaim\Gaim.lnk" "$INSTDIR\gaim.exe"
295 CreateShortCut "$DESKTOP\Gaim.lnk" "$INSTDIR\gaim.exe"
296 ; If we don't have install rights.. we're done
297 StrCmp $R0 "NONE" done
298 CreateShortCut "$SMPROGRAMS\Gaim\Uninstall.lnk" "$INSTDIR\${GAIM_UNINST_EXE}"
299 SetOverwrite off
300
301 ; write out uninstaller
302 SetOverwrite on
303 WriteUninstaller "$INSTDIR\${GAIM_UNINST_EXE}"
304 SetOverwrite off
305
306 done:
307 SectionEnd ; end of default Gaim section
308
309
310 ;--------------------------------
311 ;GTK+ Runtime Install Section
312
313 Section $(GTK_SECTION_TITLE) SecGtk
314 SectionIn 1 RO
315
316 Call CheckUserInstallRights
317 Pop $R1
318
319 SetOutPath $TEMP
320 SetOverwrite on
321 File /oname=gtk-runtime.exe ${GTK_RUNTIME_INSTALLER}
322 SetOverwrite off
323
324 ; This keeps track whether we install GTK+ or not..
325 StrCpy $R5 "0"
326
327 Call DoWeNeedGtk
328 Pop $R0
329 Pop $R6
330
331 StrCmp $R0 "0" have_gtk
332 StrCmp $R0 "1" upgrade_gtk
333 StrCmp $R0 "2" no_gtk no_gtk
334
93 no_gtk: 335 no_gtk:
94 ; Instruct user to install GTK+ runtime first. 336 StrCmp $R1 "NONE" gtk_no_install_rights
95 MessageBox MB_OK "Could not find GTK+ runtime environment. Visit http://www.dropline.net/gtk/ to download and install GTK+ v2.2.1.1" IDOK 337 !insertmacro MUI_INSTALLOPTIONS_READ $R2 "gtkInstall.ini" "Field 4" "State"
338 ClearErrors
339 ExecWait '"$TEMP\gtk-runtime.exe" /S /D=$R2'
340 Goto gtk_install_cont
341
342 upgrade_gtk:
343 MessageBox MB_YESNO $(GTK_UPGRADE_PROMPT) IDNO done_final
344 ClearErrors
345 ExecWait '"$TEMP\gtk-runtime.exe" /S'
346 Goto gtk_install_cont
347
348 gtk_install_cont:
349 IfErrors gtk_install_error
350 StrCpy $R5 "1" ; marker that says we installed...
351 Goto done
352
353 gtk_install_error:
354 Delete "$TEMP\gtk-runtime.exe"
355 MessageBox MB_OK $(GTK_INSTALL_ERROR) IDOK
356 Quit
357
358 have_gtk:
359 StrCpy $R2 $R6 ; Copy GTK+ path
360 StrCmp $R1 "NONE" done ; If we have no rights.. can't re-install..
361 ; Even if we have a sufficient version of GTK+, we give user choice to re-install.
362 ClearErrors
363 ExecWait '"$TEMP\gtk-runtime.exe" /S'
364 IfErrors gtk_install_error
365 Goto done
366
367 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
368 ; end got_install rights
369
370 gtk_no_install_rights:
371 ClearErrors
372 ExecWait '"$TEMP\gtk-runtime.exe" /S /D=$INSTDIR'
373 IfErrors gtk_install_error
374 ; Move the dlls to the Gaim install dir..
375 move_gtk_dlls:
376 ClearErrors
377 CopyFiles /FILESONLY "$INSTDIR\lib\*.dll" $INSTDIR
378 IfErrors gtk_install_error
379 Delete "$INSTDIR\lib\*.dll"
380 Goto done_final
381 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
382 ; end gtk_no_install_rights
383
384 done:
385 ; If we have HKLM rights.. write App Path key.. else add to PATH
386 StrCmp $R1 "HKLM" 0 hkcu_path
387 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R2\lib"
388 Goto done_cont
389 hkcu_path:
390 ; Add to User's PATH
391 StrCpy $R9 "$R2\lib"
392 Push $R9
393 Call AddToPath
394
395 done_cont:
396 ; Check for any of those nasty 'dll hell' situations..
397 Push $R2
398 Call CheckGtkInstallConflicts
399 Pop $R0
400 StrCmp $R0 "0" 0 done_final
401 ; Failure
402 MessageBox MB_OK $(GTK_INSTALL_TO_GAIM_DIR) IDOK
403 CopyFiles "$R2\*.*" $INSTDIR
404 Delete "$INSTDIR\uninst.exe"
405 Goto move_gtk_dlls
406
407 done_final:
408 Delete "$TEMP\gtk-runtime.exe"
409 SectionEnd ; end of GTK+ section
410
411 ;--------------------------------
412 ;GTK+ Themes
413
414 SubSection /e $(GTK_THEMES_SECTION_TITLE) SecGtkThemes
415 Section $(GTK_NOTHEME_SECTION_TITLE) SecGtkNone
416 ; Do nothing..
417 SectionEnd
418
419 Section $(GTK_WIMP_SECTION_TITLE) SecGtkWimp
420 Call CanWeInstallATheme
421 Pop $R1
422 StrCmp $R1 "" done
423
424 SetOverwrite on
425 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
426 SetOutPath $R1\${GTK_DEFAULT_THEME_ENGINE_DIR}
427 File ${GTK_THEME_DIR}\engines\libwimp.dll
428 SetOutPath $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}
429 File ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp
430 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp
431 SetOverwrite off
432
433 done:
434 SectionEnd
435
436 Section $(GTK_BLUECURVE_SECTION_TITLE) SecGtkBluecurve
437 Call CanWeInstallATheme
438 Pop $R1
439 StrCmp $R1 "" done
440
441 SetOverwrite on
442 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
443 SetOutPath $R1\${GTK_DEFAULT_THEME_ENGINE_DIR}
444 File ${GTK_THEME_DIR}\engines\libbluecurve.dll
445 SetOutPath $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}
446 File ${GTK_THEME_DIR}\themes\gtkrc.bluecurve
447 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.bluecurve
448 SetOverwrite off
449
450 done:
451 SectionEnd
452
453 Section $(GTK_LIGHTHOUSEBLUE_SECTION_TITLE) SecGtkLighthouseblue
454 Call CanWeInstallATheme
455 Pop $R1
456 StrCmp $R1 "" done
457
458 SetOverwrite on
459 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
460 SetOutPath $R1\${GTK_DEFAULT_THEME_ENGINE_DIR}
461 File ${GTK_THEME_DIR}\engines\liblighthouseblue.dll
462 SetOutPath $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}
463 File ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue
464 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue
465 SetOverwrite off
466
467 done:
468 SectionEnd
469 SubSectionEnd
470
471
472 ;--------------------------------
473 ;Uninstaller Section
474
475
476 Section Uninstall
477 Call un.CheckUserInstallRights
478 Pop $R0
479 StrCmp $R0 "NONE" no_rights
480 StrCmp $R0 "HKCU" try_hkcu try_hklm
481
482 try_hkcu:
483 ReadRegStr $R0 HKCU ${GAIM_REG_KEY} ""
484 StrCmp $R0 $INSTDIR 0 cant_uninstall
485 ; HKCU install path matches our INSTDIR.. so uninstall
486 DeleteRegKey HKCU ${GAIM_REG_KEY}
487 DeleteRegKey HKCU "${GAIM_UNINSTALL_KEY}"
488 ; Try to remove GTK lib dir from PATH env var.
489 ReadRegStr $R1 HKCU ${GTK_REG_KEY} "Path"
490 StrCmp $R1 "" 0 cont_check_path
491 ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path"
492 StrCmp $R1 "" cont_uninstall
493 cont_check_path:
494 ; Remove GTK+ path from PATH
495 StrCpy $R9 "$R1\lib"
496 Push $R9
497 Call un.RemoveFromPath
498 Goto cont_uninstall
499
500 try_hklm:
501 ReadRegStr $R0 HKLM ${GAIM_REG_KEY} ""
502 StrCmp $R0 $INSTDIR 0 try_hkcu
503 ; HKLM install path matches our INSTDIR.. so uninstall
504 DeleteRegKey HKLM ${GAIM_REG_KEY}
505 DeleteRegKey HKLM "${GAIM_UNINSTALL_KEY}"
506 DeleteRegKey HKLM "${HKLM_APP_PATHS_KEY}"
507 ; Sets start menu and desktop scope to all users..
508 SetShellVarContext "all"
509
510 cont_uninstall:
511 RMDir /r "$INSTDIR\locale"
512 RMDir /r "$INSTDIR\pixmaps"
513 Delete "$INSTDIR\plugins\autorecon.dll"
514 Delete "$INSTDIR\plugins\iconaway.dll"
515 Delete "$INSTDIR\plugins\libgg.dll"
516 Delete "$INSTDIR\plugins\libirc.dll"
517 Delete "$INSTDIR\plugins\libjabber.dll"
518 Delete "$INSTDIR\plugins\libmsn.dll"
519 Delete "$INSTDIR\plugins\liboscar.dll"
520 Delete "$INSTDIR\plugins\libtoc.dll"
521 Delete "$INSTDIR\plugins\libyahoo.dll"
522 Delete "$INSTDIR\plugins\spellchk.dll"
523 Delete "$INSTDIR\plugins\ticker.dll"
524 Delete "$INSTDIR\plugins\win2ktrans.dll"
525 Delete "$INSTDIR\plugins\winprefs.dll"
526 RMDir "$INSTDIR\plugins"
527 Delete "$INSTDIR\sounds\gaim\arrive.wav"
528 Delete "$INSTDIR\sounds\gaim\leave.wav"
529 Delete "$INSTDIR\sounds\gaim\receive.wav"
530 Delete "$INSTDIR\sounds\gaim\redalert.wav"
531 Delete "$INSTDIR\sounds\gaim\send.wav"
532 RMDir "$INSTDIR\sounds\gaim"
533 RMDir "$INSTDIR\sounds"
534 Delete "$INSTDIR\gaim.dll"
535 Delete "$INSTDIR\gaim.exe"
536 Delete "$INSTDIR\${GAIM_UNINST_EXE}"
537 Delete "$INSTDIR\idletrack.dll"
538 Delete "$INSTDIR\libgtkspell.dll"
539 Delete "$INSTDIR\perl56.dll"
540 ;Remove possible GTK+ files and folders..
541 RMDir \r "$INSTDIR\lib"
542 RMDir \r "$INSTDIR\share"
543 RMDir \r "$INSTDIR\locale"
544 RMDir \r "$INSTDIR\bin"
545 Delete "$INSTDIR\*.dll"
546 ;Try to remove Gaim install dir .. if empty
547 RMDir "$INSTDIR"
548
549 ; Shortcuts..
550 RMDir /r "$SMPROGRAMS\Gaim"
551 Delete "$DESKTOP\Gaim.lnk"
552
553 Goto done
554
555 cant_uninstall:
556 MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_1) IDOK
96 Quit 557 Quit
97 have_gtk: 558
98 ; Check GTK+ version 559 no_rights:
99 StrLen $R3 $R0 ; Expecting 5 char length version string 560 MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_2) IDOK
100 IntCmp $R3 5 check_version bad_version check_version ; if greater or equal to 5... good 561 Quit
101 check_version: 562
102 StrCpy $R4 $R0 1 ;Major 563 done:
103 StrCpy $R1 $R0 1 2 ;Minor
104 StrCpy $R2 $R0 1 4 ;Micro
105 IntCmp $R4 2 to_minor bad_version
106 to_minor:
107 IntCmp $R1 2 to_micro bad_version
108 to_micro: ; If greator or equal to one.. good
109 IntCmp $R2 1 good_version bad_version good_version
110 bad_version:
111 MessageBox MB_OK "Found GTK+ verison $R0. Make sure that you have version 2.2.1 or higher installed, before installing Gaim." IDOK
112 Quit
113
114 ; Continue
115 good_version:
116 SetOutPath "$INSTDIR"
117 ; Gaim files
118 File /r .\win32-install-dir\*.*
119
120 ; Gaim Registry Settings
121 WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" "" "$INSTDIR"
122 WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" "Version" "${GAIM_VERSION}"
123 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" "DisplayName" "Gaim (remove only)"
124 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" "UninstallString" "$INSTDIR\gaim-uninst.exe"
125 ; Set App path to include GTK+ lib dir
126 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe" "" "$INSTDIR\gaim.exe"
127 ; Concat GTK+ path and lib dir
128 ReadRegStr $R5 HKEY_LOCAL_MACHINE "SOFTWARE\GTK\2.0" "Path"
129 StrCpy $R5 "$R5\lib"
130 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe" "Path" $R5
131
132 ; Set Start Menu icons
133 SetShellVarContext "all"
134 CreateDirectory "$SMPROGRAMS\Gaim"
135 CreateShortCut "$SMPROGRAMS\Gaim\Gaim.lnk" \
136 "$INSTDIR\gaim.exe"
137 CreateShortCut "$SMPROGRAMS\Gaim\Uninstall.lnk" \
138 "$INSTDIR\gaim-uninst.exe"
139 ; Set Desktop icon
140 CreateShortCut "$DESKTOP\Gaim.lnk" \
141 "$INSTDIR\gaim.exe"
142
143 ; write out uninstaller
144 WriteUninstaller "$INSTDIR\gaim-uninst.exe"
145 SectionEnd ; end of default section
146
147 ;--------------------------------
148 ;Uninstaller Section
149
150 Section Uninstall
151 ; Delete Gaim Dir
152 RMDir /r "$INSTDIR"
153
154 ; Delete Start Menu group & Desktop icon
155 SetShellVarContext "all"
156 RMDir /r "$SMPROGRAMS\Gaim"
157 Delete "$DESKTOP\Gaim.lnk"
158
159 ; Delete Gaim Registry Settings
160 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Gaim"
161 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
162 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe"
163
164 ;Display the Finish header 564 ;Display the Finish header
165 !insertmacro MUI_UNFINISHHEADER 565 !insertmacro MUI_UNFINISHHEADER
166
167 SectionEnd ; end of uninstall section 566 SectionEnd ; end of uninstall section
567
568 ;--------------------------------
569 ;Descriptions
570 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
571 !insertmacro MUI_DESCRIPTION_TEXT ${SecGaim} \
572 $(GAIM_SECTION_DESCRIPTION)
573 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtk} \
574 $(GTK_SECTION_DESCRIPTION)
575 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkThemes} \
576 $(GTK_THEMES_SECTION_DESCRIPTION)
577 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkNone} \
578 $(GTK_NO_THEME_DESC)
579 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkWimp} \
580 $(GTK_WIMP_THEME_DESC)
581 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkBluecurve} \
582 $(GTK_BLUECURVE_THEME_DESC)
583 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkLighthouseblue} \
584 $(GTK_LIGHTHOUSEBLUE_THEME_DESC)
585 !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
586
587 ;--------------------------------
588 ;Functions
589
590 ;
591 ; Check that there are no conflicting dlls elsewhere on the system.
592 ; If there are, prompt the user to remove them.
593 ; Usage:
594 ; Push $R0 - Path to GTK+ installation
595 ; Call CheckGtkInstallConflicts
596 ; Pop $R0 - Return value
597 ;
598 ; Return Value:
599 ; Success - "1" pushed to stack
600 ; Success means that either there were not conflicting dlls, or they
601 ; were successfully removed.
602 ; Failure - "0" pushed to stack
603 ; Failure means that conflicting dlls were found, but we do not have
604 ; file access permissions to rename the conflicting dlls.
605 ;
606 Function CheckGtkInstallConflicts
607 Exch $5 ; GTK+ install path..
608 Push $0
609 Push $1
610 Push $2
611 Push $3
612 Push $4
613 Push $6
614 ; Two different actions in the search loop:
615 ; Action 1: $4 = "0" - String Cat conflict dlls to $2
616 ; Action 2: $4 = "1" - Remove conflict dll
617 ;
618 StrCpy $4 "0"
619
620 begin_search:
621 StrCpy $2 ""
622 ClearErrors
623 FindFirst $0 $1 "$5\lib\*.dll"
624 IfErrors search_done
625 ClearErrors
626 SearchPath $3 $1
627 IfErrors search_loop
628 search_loop1:
629 StrCmp $3 "$5\lib\$1" search_loop
630 ; Found conflict dll..
631 StrCmp $4 "0" action1
632 StrCmp $4 "1" action2
633 action1:
634 StrCpy $2 "$2$3$\r"
635 ClearErrors
636 FileOpen $6 $3 a
637 IfErrors rename_error
638 FileClose $6
639 Goto search_loop
640
641 action2:
642 ClearErrors
643 Rename $3 "$3.prob"
644 IfErrors rename_error
645
646 search_loop:
647 ClearErrors
648 FindNext $0 $1
649 IfErrors search_done
650 ClearErrors
651 SearchPath $3 $1
652 IfErrors search_loop
653 Goto search_loop1
654
655 search_done:
656 StrCmp $4 "0" action1a
657 StrCmp $4 "1" success
658 action1a:
659 StrCmp $2 "" success
660 MessageBox MB_YESNO $(GTK_DLL_CONFLICT_PROMPT) IDNO no_rename
661 ; Remove conflict dlls..
662 StrCpy $4 "1"
663 Goto begin_search
664
665 no_rename:
666 Goto failure
667
668
669 rename_error:
670 MessageBox MB_YESNO $(GTK_CAN_NOT_RENAME_CONFLICT_DLL) IDYES failure IDNO success
671
672 success:
673 StrCpy $0 "1"
674 Goto done
675
676 failure:
677 StrCpy $0 "0"
678 Goto done
679
680 done:
681 StrCpy $5 $0
682 Pop $6
683 Pop $4
684 Pop $3
685 Pop $2
686 Pop $1
687 Pop $0
688 Exch $5
689 FunctionEnd
690
691 ;
692 ; Usage:
693 ;
694 ; Call CanWeInstallATheme
695 ; Pop $R0
696 ;
697 ; Return:
698 ; "" - If no
699 ; "root path of GTK+ installation" - if yes
700 ;
701 Function CanWeInstallATheme
702 Push $1
703 Push $0
704
705 ; Did we install GTK+ to the Gaim dir?
706 IfFileExists "$INSTDIR\lib" 0 check_keys
707 StrCpy $1 $INSTDIR
708 Goto done
709
710 check_keys:
711 ; First see if we can install a theme..
712 Call CheckUserInstallRights
713 Pop $0
714
715 StrCmp $0 "HKCU" hkcu
716 StrCmp $0 "HKLM" hklm no_rights
717
718 hkcu:
719 ReadRegStr $1 HKCU ${GTK_REG_KEY} "Path"
720 StrCmp $1 "" no_rights done
721
722 hklm:
723 ReadRegStr $1 HKLM ${GTK_REG_KEY} "Path"
724 StrCmp $1 "" no_rights done
725
726 no_rights:
727 MessageBox MB_OK $(GTK_NO_THEME_INSTALL_RIGHTS) IDOK done
728 StrCpy $1 ""
729
730 done:
731 Pop $0
732 Exch $1
733 FunctionEnd
734
735
736 Function CheckUserInstallRights
737 ClearErrors
738 UserInfo::GetName
739 IfErrors Win9x
740 Pop $0
741 UserInfo::GetAccountType
742 Pop $1
743
744 StrCmp $1 "Admin" 0 +3
745 StrCpy $1 "HKLM"
746 Goto done
747 StrCmp $1 "Power" 0 +3
748 StrCpy $1 "HKLM"
749 Goto done
750 StrCmp $1 "User" 0 +3
751 StrCpy $1 "HKCU"
752 Goto done
753 StrCmp $1 "Guest" 0 +3
754 StrCpy $1 "NONE"
755 Goto done
756 ; Unknown error
757 StrCpy $1 "NONE"
758 Goto done
759
760 Win9x:
761 StrCpy $1 "HKLM"
762
763 done:
764 Push $1
765 FunctionEnd
766
767 Function un.CheckUserInstallRights
768 ClearErrors
769 UserInfo::GetName
770 IfErrors Win9x
771 Pop $0
772 UserInfo::GetAccountType
773 Pop $1
774 StrCmp $1 "Admin" 0 +3
775 StrCpy $1 "HKLM"
776 Goto done
777 StrCmp $1 "Power" 0 +3
778 StrCpy $1 "HKLM"
779 Goto done
780 StrCmp $1 "User" 0 +3
781 StrCpy $1 "HKCU"
782 Goto done
783 StrCmp $1 "Guest" 0 +3
784 StrCpy $1 "NONE"
785 Goto done
786 ; Unknown error
787 StrCpy $1 "NONE"
788 Goto done
789
790 Win9x:
791 StrCpy $1 "HKLM"
792
793 done:
794 Push $1
795 FunctionEnd
796
797 ;
798 ; Usage:
799 ; Push $0 ; Path string
800 ; Call VerifyDir
801 ; Pop $0 ; 0 - Bad path 1 - Good path
802 ;
803 Function VerifyDir
804 Pop $0
805 Loop:
806 IfFileExists $0 dir_exists
807 StrCpy $1 $0 ; save last
808 Push $0
809 Call GetParent
810 Pop $0
811 StrLen $2 $0
812 ; IfFileExists "C:" on xp returns true and on win2k returns false
813 ; So we're done in such a case..
814 StrCmp $2 "2" loop_done
815 Goto Loop
816
817 loop_done:
818 StrCpy $1 "$0\GaImFooB"
819 ; Check if we can create dir on this drive..
820 ClearErrors
821 CreateDirectory $1
822 IfErrors DirBad DirGood
823
824 dir_exists:
825 ClearErrors
826 FileOpen $1 "$0\gaimfoo.bar" w
827 IfErrors PathBad PathGood
828
829 DirGood:
830 RMDir $1
831 Goto PathGood1
832
833 DirBad:
834 RMDir $1
835 Goto PathBad1
836
837 PathBad:
838 FileClose $1
839 Delete "$0\gaimfoo.bar"
840 PathBad1:
841 StrCpy $0 "0"
842 Push $0
843 Return
844
845 PathGood:
846 FileClose $1
847 Delete "$0\gaimfoo.bar"
848 PathGood1:
849 StrCpy $0 "1"
850 Push $0
851 FunctionEnd
852
853 Function .onVerifyInstDir
854 Push $INSTDIR
855 Call VerifyDir
856 Pop $0
857 StrCmp $0 "0" 0 dir_good
858 Abort
859 dir_good:
860 FunctionEnd
861
862 ; GetParent
863 ; input, top of stack (e.g. C:\Program Files\Poop)
864 ; output, top of stack (replaces, with e.g. C:\Program Files)
865 ; modifies no other variables.
866 ;
867 ; Usage:
868 ; Push "C:\Program Files\Directory\Whatever"
869 ; Call GetParent
870 ; Pop $R0
871 ; ; at this point $R0 will equal "C:\Program Files\Directory"
872 Function GetParent
873 Exch $0 ; old $0 is on top of stack
874 Push $1
875 Push $2
876 StrCpy $1 -1
877 loop:
878 StrCpy $2 $0 1 $1
879 StrCmp $2 "" exit
880 StrCmp $2 "\" exit
881 IntOp $1 $1 - 1
882 Goto loop
883 exit:
884 StrCpy $0 $0 $1
885 Pop $2
886 Pop $1
887 Exch $0 ; put $0 on top of stack, restore $0 to original value
888 FunctionEnd
889
890
891 ; CheckGtkVersion
892 ; inputs: Push 2 GTK+ version strings to check. The major and minor values
893 ; need to be equal, for success. If the micro val to check is equal or greater
894 ; to the refrence micro value, then we have success.
895 ;
896 ; Usage:
897 ; Push "2.2.0" ; Refrence version
898 ; Push "2.2.1" ; Version to check
899 ; Call CheckGtkVersion
900 ; Pop $R0
901 ; $R0 will now equal "0", because 2.2.0 is less than 2.2.1
902 ;
903 Function CheckGtkVersion
904 ; Version we want to check
905 Pop $6
906 ; Reference version
907 Pop $8
908
909 ; Check that the string to check is at least 5 chars long (i.e. x.x.x)
910 StrLen $7 $6
911 IntCmp $7 5 0 bad_version
912
913 ; Major version check
914 StrCpy $7 $6 1
915 StrCpy $9 $8 1
916 IntCmp $7 $9 check_minor
917 Goto bad_version
918
919 check_minor:
920 StrCpy $7 $6 1 2
921 StrCpy $9 $8 1 2
922 IntCmp $7 $9 check_micro
923 Goto bad_version
924
925 check_micro:
926 StrCpy $7 $6 1 4
927 StrCpy $9 $8 1 4
928 IntCmp $7 $9 good_version bad_version good_version
929
930 bad_version:
931 StrCpy $6 "0"
932 Push $6
933 Goto done
934
935 good_version:
936 StrCpy $6 "1"
937 Push $6
938 done:
939 FunctionEnd
940
941 ;
942 ; Usage:
943 ; Call DoWeNeedGtk
944 ; First Pop:
945 ; 0 - We have the correct version
946 ; Second Pop: Key where Version was found
947 ; 1 - We have an old version that needs to be upgraded
948 ; Second Pop: HKLM or HKCU depending on where GTK was found.
949 ; 2 - We don't have Gtk+ at all
950 ; Second Pop: "NONE, HKLM or HKCU" depending on our rights..
951 ;
952 Function DoWeNeedGtk
953 ; Logic should be:
954 ; - Check what user rights we have (HKLM or HKCU)
955 ; - If HKLM rights..
956 ; - Only check HKLM key for GTK+
957 ; - If installed to HKLM, check it and return.
958 ; - If HKCU rights..
959 ; - First check HKCU key for GTK+
960 ; - if good or bad exists stop and ret.
961 ; - If no hkcu gtk+ install, check HKLM
962 ; - If HKLM ver exists but old, return as if no ver exits.
963 ; - If no rights
964 ; - Check HKLM
965
966 Call CheckUserInstallRights
967 Pop $3
968 StrCmp $3 "HKLM" check_hklm
969 StrCmp $3 "HKCU" check_hkcu check_hklm
970 check_hkcu:
971 ReadRegStr $0 HKCU ${GTK_REG_KEY} "Version"
972 StrCpy $5 "HKCU"
973 StrCmp $0 "" check_hklm have_gtk
974
975 check_hklm:
976 ReadRegStr $0 HKLM ${GTK_REG_KEY} "Version"
977 StrCpy $5 "HKLM"
978 StrCmp $0 "" no_gtk have_gtk
979
980
981 have_gtk:
982 ; GTK+ is already installed.. check version.
983 StrCpy $1 ${GTK_VERSION} ; Minimum GTK+ version needed
984 Push $1
985 Push $0
986 Call CheckGtkVersion
987 Pop $2
988 StrCmp $2 "1" good_version bad_version
989 bad_version:
990 ; Bad version. If hklm ver and we have hkcu or no rights.. return no gtk
991 StrCmp $3 "NONE" no_gtk ; if no rights.. can't upgrade
992 StrCmp $3 "HKCU" 0 upgrade_gtk ; if HKLM can upgrade..
993 StrCmp $5 "HKLM" no_gtk upgrade_gtk ; have hkcu rights.. if found hklm ver can't upgrade..
994
995 upgrade_gtk:
996 StrCpy $2 "1"
997 Push $5
998 Push $2
999 Goto done
1000
1001 good_version:
1002 ; Just make sure we have it. There was a gtk+ uninstaller that
1003 ; left behind reg entries after uninstalling..
1004 StrCmp $5 "HKLM" have_hklm_gtk have_hkcu_gtk
1005 have_hkcu_gtk:
1006 ; Have HKCU version
1007 ReadRegStr $4 HKCU ${GTK_REG_KEY} "Path"
1008 StrCpy $1 "$4\${GTK_INSTALL_VERIFIER}"
1009 IfFileExists $1 good_version_verified
1010 DeleteRegKey HKCU ${GTK_REG_KEY}
1011 Goto no_gtk
1012
1013 have_hklm_gtk:
1014 ReadRegStr $4 HKLM ${GTK_REG_KEY} "Path"
1015 StrCpy $1 "$4\${GTK_INSTALL_VERIFIER}"
1016 IfFileExists $1 good_version_verified
1017 DeleteRegKey HKLM ${GTK_REG_KEY}
1018 Goto no_gtk
1019
1020 good_version_verified:
1021 StrCpy $2 "0"
1022 Push $4 ; The path to existing GTK+
1023 Push $2
1024 Goto done
1025
1026 no_gtk:
1027 StrCpy $2 "2"
1028 Push $3 ; our rights
1029 Push $2
1030 Goto done
1031
1032 done:
1033 FunctionEnd
1034
1035 Function .onInit
1036 ;Extract InstallOptions INI Files
1037 !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "${GAIM_NSIS_INCLUDE_PATH}\gtkInstall.ini" "gtkInstall.ini"
1038
1039 Call CheckUserInstallRights
1040 Pop $0
1041
1042 StrCmp $0 "HKLM" 0 user_dir
1043 StrCpy $INSTDIR "$PROGRAMFILES\Gaim"
1044 Goto instdir_done
1045 user_dir:
1046 StrCpy $2 "$SMPROGRAMS"
1047 Push $2
1048 Call GetParent
1049 Call GetParent
1050 Pop $2
1051 StrCpy $INSTDIR "$2\Gaim"
1052
1053 instdir_done:
1054
1055 ; Set up Theme sections..
1056 StrCpy $1 ${SecGtkNone} ; Sets global to remember which theme is set.
1057 !insertmacro SelectSection ${SecGtkNone}
1058 !insertmacro UnselectSection ${SecGtkWimp}
1059 !insertmacro UnselectSection ${SecGtkBluecurve}
1060 !insertmacro UnselectSection ${SecGtkLighthouseblue}
1061
1062 FunctionEnd
1063
1064 Function .onSelChange
1065 Push $0
1066 Push $2
1067
1068 StrCpy $2 ${SF_SELECTED}
1069 SectionGetFlags ${SecGtkNone} $0
1070 IntOp $2 $2 & $0
1071 SectionGetFlags ${SecGtkWimp} $0
1072 IntOp $2 $2 & $0
1073 SectionGetFlags ${SecGtkBluecurve} $0
1074 IntOp $2 $2 & $0
1075 SectionGetFlags ${SecGtkLighthouseblue} $0
1076 IntOp $2 $2 & $0
1077 StrCmp $2 0 skip
1078 SectionSetFlags ${SecGtkNone} 0
1079 SectionSetFlags ${SecGtkWimp} 0
1080 SectionSetFlags ${SecGtkBluecurve} 0
1081 SectionSetFlags ${SecGtkLighthouseblue} 0
1082 skip:
1083
1084 !insertmacro UnselectSection $1
1085
1086 ; Remember old selection
1087 StrCpy $2 $1
1088
1089 ; Now go through and see who is checked..
1090 SectionGetFlags ${SecGtkNone} $0
1091 IntOp $0 $0 & ${SF_SELECTED}
1092 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1093 StrCpy $1 ${SecGtkNone}
1094 SectionGetFlags ${SecGtkWimp} $0
1095 IntOp $0 $0 & ${SF_SELECTED}
1096 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1097 StrCpy $1 ${SecGtkWimp}
1098 SectionGetFlags ${SecGtkBluecurve} $0
1099 IntOp $0 $0 & ${SF_SELECTED}
1100 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1101 StrCpy $1 ${SecGtkBluecurve}
1102 SectionGetFlags ${SecGtkLighthouseblue} $0
1103 IntOp $0 $0 & ${SF_SELECTED}
1104 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1105 StrCpy $1 ${SecGtkLighthouseblue}
1106
1107 StrCmp $2 $1 0 +2 ; selection hasn't changed
1108 !insertmacro SelectSection $1
1109
1110 Pop $2
1111 Pop $0
1112 FunctionEnd
1113
1114 Function ShowGtkInstallDirChooser
1115 Call DoWeNeedGtk
1116 Pop $0
1117 Pop $1
1118
1119 StrCmp $0 "0" have_gtk
1120 StrCmp $0 "1" upgrade_gtk
1121 StrCmp $0 "2" no_gtk no_gtk
1122
1123 ; Don't show dir selector.. Upgrades are done to existing path..
1124 have_gtk:
1125 upgrade_gtk:
1126 Abort
1127
1128 no_gtk:
1129 StrCmp $1 "NONE" 0 no_gtk_cont
1130 ; Got no install rights..
1131 Abort
1132 no_gtk_cont:
1133 ; Suggest path..
1134 StrCmp $1 "HKCU" 0 hklm1
1135 StrCpy $2 "$SMPROGRAMS"
1136 Push $2
1137 Call GetParent
1138 Call GetParent
1139 Pop $2
1140 StrCpy $2 "$2\GTK\2.0"
1141 Goto got_path
1142 hklm1:
1143 StrCpy $2 "${GTK_DEFAULT_INSTALL_PATH}"
1144
1145 got_path:
1146 !insertmacro MUI_INSTALLOPTIONS_WRITE "gtkInstall.ini" "Field 4" "State" $2
1147
1148 !insertmacro MUI_INSTALLOPTIONS_WRITE "gtkInstall.ini" "Field 1" "Text" $(GTK_PAGE_INSTALL_MSG1)
1149 !insertmacro MUI_INSTALLOPTIONS_WRITE "gtkInstall.ini" "Field 2" "Text" $(GTK_PAGE_INSTALL_MSG2)
1150 !insertmacro MUI_HEADER_TEXT "$(GTK_PAGE_TITLE)" "$(GTK_PAGE_SUBTITLE)"
1151 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "gtkInstall.ini"
1152 FunctionEnd
1153
1154 Function GtkInstallDirVerify
1155 !insertmacro MUI_INSTALLOPTIONS_READ $0 "gtkInstall.ini" "Field 4" "State"
1156 Push $0
1157 Call VerifyDir
1158 Pop $0
1159 StrCmp $0 "0" 0 done
1160 MessageBox MB_OK $(GTK_BAD_INSTALL_PATH) IDOK
1161 Abort
1162 done:
1163 FunctionEnd
1164
1165 ; PATH Env Manipulation..
1166 !include "${GAIM_NSIS_INCLUDE_PATH}\AddToPath.nsi"