diff gaim-installer.nsi @ 14984:8186cb621d2b

[gaim-migrate @ 17762] GTK+ Theme selection will now choose the system-wide theme if the installer is being run by the admin user. Also, the theme checkboxes can now be all unselected and we wont mess with the current theme selection. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 17 Nov 2006 01:11:18 +0000
parents 43f692951d49
children 6bdcfafc2259
line wrap: on
line diff
--- a/gaim-installer.nsi	Fri Nov 17 00:41:28 2006 +0000
+++ b/gaim-installer.nsi	Fri Nov 17 01:11:18 2006 +0000
@@ -49,7 +49,6 @@
 !insertmacro VersionCompare
 
 !include "TextFunc.nsh"
-!insertmacro ConfigRead
 !insertmacro ConfigWriteS
 
 ;--------------------------------
@@ -487,7 +486,7 @@
 ;--------------------------------
 ;Shortcuts
 
-SubSection /e $(GAIM_SHORTCUTS_SECTION_TITLE) SecShortcuts
+SectionGroup /e $(GAIM_SHORTCUTS_SECTION_TITLE) SecShortcuts
   Section /o $(GAIM_DESKTOP_SHORTCUT_SECTION_TITLE) SecDesktopShortcut
     SetOverwrite on
     CreateShortCut "$DESKTOP\Gaim.lnk" "$INSTDIR\gaim.exe"
@@ -499,12 +498,12 @@
     CreateShortCut "$SMPROGRAMS\Gaim\Gaim.lnk" "$INSTDIR\gaim.exe"
     SetOverwrite off
   SectionEnd
-SubSectionEnd
+SectionGroupEnd
 
 ;--------------------------------
 ;GTK+ Themes
 
-SubSection /e $(GTK_THEMES_SECTION_TITLE) SecGtkThemes
+SectionGroup /e $(GTK_THEMES_SECTION_TITLE) SecGtkThemes
   Section /o $(GTK_NOTHEME_SECTION_TITLE) SecGtkNone
     Push "Raleigh"
     Call WriteGtkThemeConfig
@@ -524,12 +523,12 @@
     Push "Lighthouseblue"
     Call WriteGtkThemeConfig
   SectionEnd
-SubSectionEnd
+SectionGroupEnd
 
 ;--------------------------------
 ;Spell Checking
 
-SubSection /e $(GAIM_SPELLCHECK_SECTION_TITLE) SecSpellCheck
+SectionGroup /e $(GAIM_SPELLCHECK_SECTION_TITLE) SecSpellCheck
   Section /o $(GAIM_SPELLCHECK_BRETON) SecSpellCheckBreton
     Push ${SecSpellCheckBreton}
     Call InstallAspellAndDict
@@ -618,7 +617,7 @@
     Push ${SecSpellCheckUkrainian}
     Call InstallAspellAndDict
   SectionEnd
-SubSectionEnd
+SectionGroupEnd
 
 ;--------------------------------
 ;Uninstaller Section
@@ -822,25 +821,37 @@
 ;Functions
 
 Function WriteGtkThemeConfig
-Exch $0
-Push $1
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
 
-ClearErrors
-${ConfigRead} "$PROFILE\.gtkrc-2.0" "gtk-theme-name =" $1
-IfErrors new_file
-${ConfigWriteS} "$PROFILE\.gtkrc-2.0" "gtk-theme-name =" "$\"$0$\"" $1
-Goto done
+  Call CheckUserInstallRights
+  Pop $2
+  StrCmp $2 "HKLM" 0 user_theme
+
+  ; Global Theme
+  ReadRegStr $2 HKLM ${GTK_REG_KEY} "Path"
+  StrCpy $3 "$2\etc\gtk-2.0\gtkrc"
+  Goto update_theme
+  user_theme:
+  StrCpy $3 "$PROFILE\.gtkrc-2.0"
 
-new_file:
-ClearErrors
-FileOpen $1 "$PROFILE\.gtkrc-2.0" w
-FileWrite $1 "gtk-theme-name = $\"$0$\""
-FileClose $1
-Goto done
+  update_theme:
+  IfFileExists $3 0 new_file
+  ${ConfigWriteS} $3 "gtk-theme-name =" " $\"$0$\"" $1
+  Goto done
 
-done:
-Pop $1
-Pop $0
+  new_file:
+  FileOpen $1 $3 w
+  FileWrite $1 "gtk-theme-name = $\"$0$\""
+  FileClose $1
+
+  done:
+  Pop $3
+  Pop $2
+  Pop $1
+  Pop $0
 FunctionEnd
 
 !macro CheckUserInstallRightsMacro UN
@@ -1177,7 +1188,7 @@
   Push $1
   Push $2
 
-  !insertmacro StartRadioButtons $GTK_THEME_SEL
+  !insertmacro StartRadioButtonsUnselectable $GTK_THEME_SEL
     !insertmacro RadioButton ${SecGtkNone}
     !insertmacro RadioButton ${SecGtkWimp}
     !insertmacro RadioButton ${SecGtkBluecurve}