diff pidgin/win32/nsis/pidgin-installer.nsi @ 30369:e8b781c23fb6

Allow the GTK+ Runtime to be unselected when there is no existing runtime (but not when there is an existing runtime that is too old). This allows "advanced" users to more easily reuse a global GTK+ runtime if they choose to do so. Additionally, this provides some additional alerts and hints about what to do when downloading the GTK+ Runtime or Spellchecking dictionary fails. Fixes #11852, #11889
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 15 May 2010 06:13:15 +0000
parents 0d42077e36cf
children 62f0988c666c
line wrap: on
line diff
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Sat May 15 03:24:24 2010 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Sat May 15 06:13:15 2010 +0000
@@ -8,8 +8,9 @@
 ;--------------------------------
 ;Global Variables
 Var name
-Var ISSILENT
 Var STARTUP_RUN_KEY
+Var CURRENT_GTK_STATE
+Var WARNED_GTK_STATE
 
 ;--------------------------------
 ;Configuration
@@ -351,7 +352,7 @@
   Pop $R0
   StrCmp $R0 "cancel" done
   StrCmp $R0 "success" +2
-    MessageBox MB_RETRYCANCEL "$(PIDGIN_GTK_DOWNLOAD_ERROR) : $R2" /SD IDCANCEL IDRETRY retry IDCANCEL done
+    MessageBox MB_RETRYCANCEL "$(PIDGIN_GTK_DOWNLOAD_ERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
 
 !endif
 
@@ -548,7 +549,7 @@
   Pop $R0
   StrCmp $R0 "cancel" done
   StrCmp $R0 "success" +2
-    MessageBox MB_RETRYCANCEL "$(PIDGIN_DEBUGSYMBOLS_ERROR) : $R2" /SD IDCANCEL IDRETRY retry IDCANCEL done
+    MessageBox MB_RETRYCANCEL "$(PIDGIN_DEBUGSYMBOLS_ERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
 
 !endif
 
@@ -1154,12 +1155,6 @@
   ;Reset ShellVarContext because we may have changed it
   SetShellVarContext "current"
 
-  StrCpy $ISSILENT "/S"
-  ; GTK installer has two silent states - one with Message boxes, one without
-  ; If pidgin installer was run silently, we want to supress gtk installer msg boxes.
-  IfSilent 0 +2
-    StrCpy $ISSILENT "/NOUI"
-
   ClearErrors
   ${GetOptions} "$R3" "/L=" $R1
   IfErrors +3
@@ -1263,9 +1258,11 @@
 !endif
 
   Call DoWeNeedGtk
-  Pop $R0
-  IntCmp $R0 1 done gtk_not_mandatory
-    ; Make the GTK+ Section RO if it is required.
+  Pop $CURRENT_GTK_STATE
+  StrCpy $WARNED_GTK_STATE "0"
+  IntCmp $CURRENT_GTK_STATE 1 done gtk_not_mandatory
+    ; Make the GTK+ Section RO if it is required. (it is required only if you have an existing version that is too old)
+    StrCmp $CURRENT_GTK_STATE "2" 0 done
     !insertmacro SetSectionFlag ${SecGtk} ${SF_RO}
     Goto done
   gtk_not_mandatory:
@@ -1277,6 +1274,29 @@
   Pop $R0
 FunctionEnd
 
+; If the GTK+ Section has been unselected and there isn't a compatible GTK+ already, confirm
+Function .onSelChange
+  Push $R0
+
+  SectionGetFlags ${SecGtk} $R0
+  IntOp $R0 $R0 & ${SF_SELECTED}
+  ; If the Gtk Section is currently selected, reset the "Warned" flag
+  StrCmp $R0 "${SF_SELECTED}" 0 +3
+  StrCpy $WARNED_GTK_STATE "0"
+  Goto done
+
+  ; If we've already warned the user, don't warn them again
+  StrCmp $WARNED_GTK_STATE "1" done
+  IntCmp $CURRENT_GTK_STATE 1 done done 0
+  StrCpy $WARNED_GTK_STATE "1"
+  MessageBox MB_YESNO $(PIDGIN_PROMPT_FORCE_NO_GTK) /SD IDNO IDYES done
+  !insertmacro SelectSection ${SecGtk}
+
+  done:
+  Pop $R0
+FunctionEnd
+
+
 ; Convert the current $LANGUAGE to a language code that we can use for translation mo selection
 ; If there's a better way to do this, I'd love to know it
 Function SelectTranslationForCurrentLanguage
@@ -1429,6 +1449,7 @@
   Pop $R1 ;This is the language file
   Push $R2
   Push $R3
+  Push $R4
 
   ClearErrors
   IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\$R0.dic" installed
@@ -1441,10 +1462,10 @@
   DetailPrint "Downloading the $R0 Dictionary... ($R3)"
   retry:
   NSISdl::download /TIMEOUT=10000 "$R3" "$R2"
-  Pop $R3
-  StrCmp $R3 "cancel" done
-  StrCmp $R3 "success" +3
-    MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_ERROR) : $R3" /SD IDCANCEL IDRETRY retry IDCANCEL done
+  Pop $R4
+  StrCmp $R4 "cancel" done
+  StrCmp $R4 "success" +3
+    MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_ERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
     Goto done
   SetOutPath "$INSTDIR\spellcheck\share\enchant\myspell"
   nsisunz::UnzipToLog "$R2" "$OUTDIR"
@@ -1458,6 +1479,7 @@
     DetailPrint "$R0 Dictionary is installed"
 
   done:
+  Pop $R4
   Pop $R3
   Pop $R2
   Pop $R0