Switch to MUI2 and add Run after Install
authorAndre Heinecke <aheinecke@intevation.de>
Mon, 29 Feb 2016 13:52:11 +0000 (14:52 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Mon, 29 Feb 2016 14:00:13 +0000 (15:00 +0100)
MUI2 gives more flexibility in customizing pages.

* src/installer-options.ini.in: Removed.
* src/Makefile.am (installer-options.ini.in): Remove mentions.
 (g4wihelp.dll): Link with desktopshellrun.cpp
* src/g4wihelp.c: Fix implicit stdio usages.
* src/gpg4win-src.nsi, src/gpg4win.nsi (ABOUT_STR): MUI2 needs
  $\r$\n everywere.
  (Sections): Include Sections and Memento header.
  (installer.nsi): Include after sections.
* src/inst-sections.nsi, src/installer.nsi: Move generic functions
 into installer.nsi
* src/installer.nsi (FinishFunction): New. Conditional show run with
 correct Cert Manager. If not source installer.
  (RunAsUser): New. Use DesktopShellRun.
  (LICENSE_PAGE): Commented out.
  (MUI_UNIFINISHPAGE): Commented out.

--

The finish page now shows a Run GPA or Run Kleopatra depending
on wether or not they are selected. If none is selected nothing
is offered.

License and finish page for uninstaller and source installer removed.

src/Makefile.am
src/g4wihelp.c
src/gpg4win-src.nsi
src/gpg4win.nsi
src/inst-sections.nsi
src/installer-options.ini.in [deleted file]
src/installer.nsi

index 0c92cc6..a1dc553 100644 (file)
@@ -19,8 +19,9 @@
 
 EXTRA_DIST = pkg-config gpg4win.nsi gpg4win-src.nsi \
        config.site config.nsi.in \
-        installer-options.ini.in libiconv.def libintl.def loreley.mid \
-        gpg4win-splash.wav exdll.h g4wihelp.c g4wihelp.nsi \
+        libiconv.def libintl.def loreley.mid \
+        gpg4win-splash.wav exdll.h g4wihelp.c desktopshellrun.cpp \
+        g4wihelp.nsi \
         inst-sections.nsi installer.nsi installer-finish.nsi  \
        zlib.pc sha1sum.c mkportable.c     \
        mkportable-vanilla.h mkportable-light.h mkportable-full.h \
@@ -97,10 +98,10 @@ HOWTO_files = $(addsuffix .txt, \
 foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe mkportable.exe
 
 # Need to clean the dll because we bypassed automake.
-CLEANFILES = g4wihelp.dll versioninfo.txt $(README_files) $(HOWTO_files) \
-             installer-options.ini NEWS.tmp COMPONENTS-list.tmp \
-            license.blurb cdversioninfo.tmp \
-            $(foosum_exe)
+CLEANFILES = g4wihelp.dll desktopshellrun.o versioninfo.txt $(README_files) \
+                        $(HOWTO_files) NEWS.tmp COMPONENTS-list.tmp \
+                        license.blurb cdversioninfo.tmp \
+                        $(foosum_exe)
 
 # Supported source packages.
 gpg4win_spkgs = glib libffi gdk-pixbuf gtk+ \
@@ -538,10 +539,6 @@ COMPONENTS-list.tmp : $(top_srcdir)/NEWS
        awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print "    "$$0}' \
             < $(top_srcdir)/NEWS > COMPONENTS-list.tmp
 
-installer-options.ini : $(top_srcdir)/src/installer-options.ini.in
-       cat $(top_srcdir)/src/installer-options.ini.in >installer-options.ini
-
-
 # For some nut-crazy reason someone thought it would be a great idea
 # if makensis changed to the directory of the source file at startup.
 # So we have to pull a couple of strings to correct this.
@@ -549,7 +546,7 @@ installers/gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final
                         g4wihelp.dll \
                        $(foosum_exe) \
                        $(README_files) $(HOWTO_files) \
-                       license.blurb installer-options.ini versioninfo.txt
+                       license.blurb versioninfo.txt
        $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi && \
                   mv gpg4win-$(VERSION).exe installers/gpg4win-$(VERSION).exe
@@ -558,7 +555,7 @@ installers/gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-
                         g4wihelp.dll \
                        $(foosum_exe) \
                        $(README_files) $(HOWTO_files) \
-                       license.blurb installer-options.ini versioninfo.txt
+                       license.blurb versioninfo.txt
        $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
            -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi && \
@@ -569,7 +566,7 @@ installers/gpg4win-vanilla-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stam
                         g4wihelp.dll  \
                        $(foosum_exe) \
                        $(README_files) $(HOWTO_files) \
-                       license.blurb installer-options.ini versioninfo.txt
+                       license.blurb versioninfo.txt
        $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
            -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi && \
@@ -622,9 +619,11 @@ installers/gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsii) \
 license.blurb: $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3
        cat $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 >$@
 
-g4wihelp.dll: g4wihelp.c exdll.h
+g4wihelp.dll: desktopshellrun.cpp g4wihelp.c exdll.h
+       $(CC) -I. -O2 -c -o desktopshellrun.o $(srcdir)/desktopshellrun.cpp
        $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
-          -lwinmm -lgdi32
+         desktopshellrun.o -lwinmm -lgdi32 -luserenv -lshell32 \
+         -lole32 -loleaut32
        $(STRIP) g4wihelp.dll
 
 sha1sum.exe: sha1sum.c
index 204256d..7cb0679 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <windows.h>
+#include <stdio.h>
 #include "exdll.h"
 
 static HINSTANCE g_hInstance; /* Our Instance. */
index f7842b8..e614e7c 100644 (file)
 !define WELCOME_TITLE_STR "$(T_WelcomeTitleGpg4winSrc)"
 
 !define ABOUT_STR "$(T_AboutGpg4winSrc) \
-       \r\n\r\n$_CLICK \r\n\r\n\r\n\r\n\r\n \
-        $(T_AboutGpg4winSrcVersion) \r\n \
-        $(T_AboutGpg4winSrcFileVersion) \r\n\r\n \
+       $\r$\n$\r$\n$_CLICK $\r$\n$\r$\n$\r$\n$\r$\n$\r$\n \
+        $(T_AboutGpg4winSrcVersion) $\r$\n \
+        $(T_AboutGpg4winSrcFileVersion) $\r$\n$\r$\n \
         $(T_AboutGpg4winSrcReleaseDate)"
 
 # The copyright license of the package.  Define only one of these.
 !define LICENSE_GPL
 # !define LICENSE_LGPL
 
+# Sections
+!include "Sections.nsh"
+
+# We use Memento to remember past installation choices.
+!include Memento.nsh
+!define MEMENTO_REGISTRY_ROOT HKLM
+!define MEMENTO_REGISTRY_KEY \
+  Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}
+# We need to know wether we are installing to 64 bit.
+!include "x64.nsh"
+
+
 
 # The installation directory.
 !define ipdir "playground/install/pkgs"
 # For source packages we use the standard zip method because it takes
 # ages to compress a large archive of already packed sources.
 SetCompressor zlib
-
-# Now include the generic parts.
-!include "installer.nsi"
-
-
 # Now include all the sections.
 !define SOURCES
 !include "inst-sections.nsi"
 
+# Now include the generic parts.
+!include "installer.nsi"
+
 # The WelcomeTitle is displayed on the first page.
 LangString T_WelcomeTitleGpg4winSrc ${LANG_ENGLISH} \
  "Welcome to the installation of the Gpg4win sources"
index 0146157..2e22591 100644 (file)
 !define WELCOME_TITLE_STR "$(T_WelcomeTitleGpg4win)"
 
 !define ABOUT_STR "$(T_AboutGpg4win) \
-       \r\n\r\n$_CLICK \r\n\r\n\r\n\r\n\r\n \
-       $(T_AboutGpg4winVersion) \r\n \
-        $(T_AboutGpg4winFileVersion) \r\n\r\n \
-       $(T_AboutGpg4winReleaseDate)"
+       $\r$\n$\r$\n$\r$\n$_CLICK $\r$\n$\r$\n$\r$\n \
+       $(T_AboutGpg4winVersion $\r$\n$(T_AboutGpg4winReleaseDate)"
 
 # The copyright license of the package.  Define only one of these.
 !define LICENSE_GPL
@@ -179,15 +177,24 @@ SetCompressor /SOLID lzma
 !include "uninst-claws-mail.nsi"
 !endif
 
-# Now include the generic parts.
-!define HAVE_STARTMENU
-!include "installer.nsi"
+# Sections
+!include "Sections.nsh"
 
+# We use Memento to remember past installation choices.
+!include Memento.nsh
+!define MEMENTO_REGISTRY_ROOT HKLM
+!define MEMENTO_REGISTRY_KEY \
+  Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}
+# We need to know wether we are installing to 64 bit.
+!include "x64.nsh"
 
 # Now include the sections.
 !define BINARIES
 !include "inst-sections.nsi"
 
+# Now include the generic parts.
+!define HAVE_STARTMENU
+!include "installer.nsi"
 
 # The WelcomeTitle is displayed on the first page.
 LangString T_WelcomeTitleGpg4win ${LANG_ENGLISH} \
index 2f3c5db..5972bdc 100644 (file)
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
-
-# Sections
-
 !include "inst-gpg4win.nsi"
 
 # The order of installation must be the same as the build order.  You
 
 ${MementoSectionDone}
 
-!include "Sections.nsh"
-
-
 Function CalcDefaults
 
-# The defaults for the installer-options.ini file.
-g4wihelp::config_fetch_bool "inst_start_menu"
-StrCmp $R0 "" +2
-!insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 2" "State" $R0
-
-g4wihelp::config_fetch_bool "inst_desktop"
-StrCmp $R0 "" +2
-!insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 3" "State" $R0
-
-g4wihelp::config_fetch_bool "inst_quick_launch_bar"
-StrCmp $R0 "" +2
-!insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 4" "State" $R0
-
 !ifdef HAVE_PKG_KLEOPATRA
   g4wihelp::config_fetch_bool "inst_kleopatra"
   StrCmp $R0 "1" 0 calc_defaults_kleopatra_not_one
@@ -934,49 +912,6 @@ Function CalcDepends
 
 FunctionEnd
 
-
-Function .onInit
-  Call G4wRunOnce
-
-  SetOutPath $TEMP
-!ifdef SOURCES
-  File /oname=gpgspltmp.bmp "${TOP_SRCDIR}/doc/logo/gpg4win-logo-400px.bmp"
-  # We play the tune only for the source installer
-  File /oname=gpgspltmp.wav "${TOP_SRCDIR}/src/gpg4win-splash.wav"
-  g4wihelp::playsound $TEMP\gpgspltmp.wav
-  g4wihelp::showsplash 2500 $TEMP\gpgspltmp.bmp
-
-  Delete $TEMP\gpgspltmp.bmp
-  # Note that we delete gpgspltmp.wav in .onInst{Failed,Success}
-!endif
-
-  # Enable this to force a language selection dialog on every run (the
-  # preferred language is the default).  Otherwise, the preferred
-  # language is stored in the registry, and the installer does not ask
-  # on upgrades.
-!ifdef DEBUG
-!define MUI_LANGDLL_ALWAYSSHOW
-!endif
-  !insertmacro MUI_LANGDLL_DISPLAY
-
-  # We can't use TOP_SRCDIR dir as the name of the file needs to be
-  # the same while building and running the installer.  Thus we
-  # generate the file from a template.
-  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "installer-options.ini"
-
-  ${MementoSectionRestore}
-  Call CalcDefaults
-  Call CalcDepends
-  Call CheckOtherGnuPGApps
-FunctionEnd
-
-
-Function un.onInit
-  # Remove the language preference.
-  !insertmacro MUI_UNGETLANGUAGE
-FunctionEnd
-
-
 Function .onInstFailed
   Delete $TEMP\gpgspltmp.wav
 FunctionEnd
@@ -1006,44 +941,6 @@ FunctionEnd
 #FunctionEnd
 
 
-# This must be in a central place.  Urgs.
-
-!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
-!ifdef HAVE_PKG_GNUPG_W32
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gnupg_w32} $(DESC_SEC_gnupg_w32)
-!endif
-!ifdef HAVE_PKG_GPGOL
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpgol} $(DESC_SEC_gpgol)
-!endif
-!ifdef HAVE_PKG_GPGEX
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpgex} $(DESC_SEC_gpgex)
-!endif
-!ifdef HAVE_PKG_PAPERKEY
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_paperkey} $(DESC_SEC_paperkey)
-!endif
-!ifdef HAVE_PKG_GPA
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpa} $(DESC_SEC_gpa)
-!endif
-!ifdef HAVE_PKG_KLEOPATRA
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_kleopatra} $(DESC_SEC_kleopatra)
-!endif
-!ifdef HAVE_PKG_MAN_NOVICE_EN
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_novice_en} $(DESC_SEC_man_novice_en)
-!endif
-!ifdef HAVE_PKG_MAN_ADVANCED_EN
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_advanced_en} $(DESC_SEC_man_advanced_en)
-!endif
-!ifdef HAVE_PKG_COMPENDIUM
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_compendium} $(DESC_SEC_compendium)
-!endif
-!ifdef HAVE_PKG_MAN_NOVICE_DE
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_novice_de} $(DESC_SEC_man_novice_de)
-!endif
-!ifdef HAVE_PKG_MAN_ADVANCED_DE
-  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_advanced_de} $(DESC_SEC_man_advanced_de)
-!endif
-!insertmacro MUI_FUNCTION_DESCRIPTION_END
-
 
 # This also must be in a central place.  Also Urgs.
 
@@ -1059,9 +956,8 @@ Section "-startmenu"
   SetShellVarContext all
 
   # Check if the start menu entries where requested.
-  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
-       "Field 2" "State"
-  IntCmp $R0 0 no_start_menu
+  g4wihelp::config_fetch_bool "inst_start_menu"
+  StrCmp $R0 "0" no_start_menu
 
 !ifdef HAVE_PKG_GPA
     SectionGetFlags ${SEC_gpa} $R0
@@ -1086,8 +982,8 @@ Section "-startmenu"
  no_start_menu:
 
   # Check if the desktop entries where requested.
-  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
-       "Field 3" "State"
+  g4wihelp::config_fetch_bool "inst_desktop"
+  StrCmp $R0 "0" no_desktop
   IntCmp $R0 0 no_desktop
 
 !ifdef HAVE_PKG_GPA
diff --git a/src/installer-options.ini.in b/src/installer-options.ini.in
deleted file mode 100644 (file)
index 29797c7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-[Settings]
-NumFields=5
-
-; The number of the fields here is known in installer.nsi.
-; The tags must be "[Field N]" with N=1..NumFields
-
-[Field 1]
-Type=Label
-Left=0
-Right=-1
-Top=0
-Bottom=20
-
-[Field 2]
-Type=Checkbox
-Left=0
-Right=-1
-Top=30
-Bottom=40
-;Text=Start Menu
-State=1
-
-[Field 3]
-Type=Checkbox
-Left=0
-Right=-1
-Top=50
-Bottom=60
-;Text=Desktop
-State=0
-
-[Field 4]
-Type=Checkbox
-Left=0
-Right=-1
-Top=70
-Bottom=80
-;Text=Quick Launch Bar
-State=0
-
-[Field 5]
-Type=Label
-Left=0
-Right=-1
-Top=90
-Bottom=130
-
index 62f350b..fdc4298 100644 (file)
 # !define Regkey_for_Env 'HKCU "Environment"'
 
 
-# We use Memento to remember past installation choices.
-!include Memento.nsh
-!define MEMENTO_REGISTRY_ROOT HKLM
-!define MEMENTO_REGISTRY_KEY \
-  Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}
-
-
-# We use the modern UI.
-!include "MUI.nsh"
-
-# We need to know wether we are installing to 64 bit.
-!include "x64.nsh"
+# We use the modern UI 2.
+!ifdef DEBUG
+!include "MUI2.nsh"
+!else
+!include "MUI2.nsh"
+# MUI2 defines debug
+!undef DEBUG
+!endif
 
 # Set the package name.  Note that this name should not be sufficed
 #  with the version because this would get displayed in the start menu.
@@ -147,10 +143,9 @@ Bitte die Sprache des Installations-Vorgangs angeben."
 
 !insertmacro MUI_PAGE_WELCOME
 
-!define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
-!define MUI_PAGE_HEADER_SUBTEXT "$(T_GPLHeader)"
-!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(T_GPLShort)"
-!insertmacro MUI_PAGE_LICENSE "license.blurb"
+#!define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
+#!define MUI_PAGE_HEADER_SUBTEXT "$(T_GPLHeader)"
+#!insertmacro MUI_PAGE_LICENSE "license.blurb"
 
 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PrintNonAdminWarning
 !insertmacro MUI_PAGE_COMPONENTS
@@ -163,23 +158,60 @@ Bitte die Sprache des Installations-Vorgangs angeben."
 !define MUI_PAGE_CUSTOMFUNCTION_PRE ShowFinalWarnings
 
 # Finish page
+!ifndef SOURCES
+!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishFunction
+!define MUI_FINISHPAGE_RUN
+!define MUI_FINISHPAGE_RUN_FUNCTION RunAsUser
 !define MUI_FINISHPAGE_SHOWREADME "share\gpg4win\README.$(T_LangCode).txt"
 !define MUI_FINISHPAGE_SHOWREADME_TEXT "$(T_ShowReadme)"
-#!define MUI_FINISHPAGE_RUN
-#!define MUI_FINISHPAGE_RUN_FUNCTION RunOnFinish
-#!define MUI_FINISHPAGE_RUN_TEXT "$(T_RunKeyManager)"
-#!define MUI_FINISHPAGE_RUN_NOTCHECKED
+!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
 !define MUI_FINISHPAGE_LINK "$(T_MoreInfo)"
 !define MUI_FINISHPAGE_LINK_LOCATION "$(T_MoreInfoURL)"
 !insertmacro MUI_PAGE_FINISH
 
+Function FinishFunction
+  IfSilent leave
+  Var /GLOBAL gpa_or_kleopatra
+  !insertmacro SectionFlagIsSet ${SEC_kleopatra} \
+        ${SF_SELECTED} have_kleo 0
+  !insertmacro SectionFlagIsSet ${SEC_gpa} \
+        ${SF_SELECTED} have_gpa 0
+  ShowWindow $mui.FinishPage.Run ${SW_HIDE}
+  goto leave
+have_kleo:
+  SendMessage $mui.FinishPage.Run.Text ${WM_SETTEXT} 0 "STR:$(T_RunKleopatra)"
+  goto leave
+have_gpa:
+  SendMessage $mui.FinishPage.Run.Text ${WM_SETTEXT} 0 "STR:$(T_RunGPA)"
+  StrCpy $gpa_or_kleopatra "GPA"
+leave:
+FunctionEnd
+
+Function RunAsUser
+  !insertmacro SectionFlagIsSet ${SEC_kleopatra} \
+        ${SF_SELECTED} 0 skip_kleo
+  g4wihelp::DesktopShellRun "$INSTDIR\bin\kleopatra.exe"
+  goto leave
+skip_kleo:
+  !insertmacro SectionFlagIsSet ${SEC_gpa} \
+        ${SF_SELECTED} 0 leave
+  g4wihelp::DesktopShellRun "$INSTDIR\bin\gpa.exe"
+leave:
+FunctionEnd
+
+LangString T_RunKleopatra ${LANG_ENGLISH} \
+   "Run Kleopatra"
+
+LangString T_RunGPA ${LANG_ENGLISH} \
+   "Run GPA"
+!endif # SOURCES
 
 # Uninstaller pages.
 
 !insertmacro MUI_UNPAGE_WELCOME
 !insertmacro MUI_UNPAGE_CONFIRM
 !insertmacro MUI_UNPAGE_INSTFILES
-!insertmacro MUI_UNPAGE_FINISH
+#!insertmacro MUI_UNPAGE_FINISH
 
 #Page license
 #Page components
@@ -206,7 +238,6 @@ Bitte die Sprache des Installations-Vorgangs angeben."
 !undef PO_HEADER
 
 !insertmacro MUI_RESERVEFILE_LANGDLL
-!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
 ReserveFile "${BUILD_DIR}\g4wihelp.dll"
 !ifdef SOURCES
 ReserveFile "${TOP_SRCDIR}\doc\logo\gpg4win-logo-400px.bmp"
@@ -230,9 +261,6 @@ LangString T_GPLShort ${LANG_ENGLISH} \
    You may distribute it as long as you give the recipients the same \
    rights you have received."
 
-LangString T_RunKeyManager ${LANG_ENGLISH} \
-   "Run the key manager"
-
 LangString T_MoreInfo ${LANG_ENGLISH} \
    "Click here for the project's homepage"
 LangString T_MoreInfoURL ${LANG_ENGLISH} "http://www.gpg4win.org"
@@ -261,28 +289,6 @@ LangString DESC_Desktop_manuals ${LANG_ENGLISH} \
 # Custom functions and macros for gpg4win.
 !include "g4wihelp.nsi"
 
-#
-# Control function for the Custom page to select special
-# install options.
-#
-Function CustomPageOptions
-  !insertmacro MUI_HEADER_TEXT "$(T_InstallOptions)" "$(T_InstallOptLinks)"
-
-  # Note that the default selection is done in the ini file.
-  !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 1" "Text"  "$(T_InstOptLabelA)"
-  !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 2" "Text"  "$(T_InstOptFieldA)"
-  !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 3" "Text"  "$(T_InstOptFieldB)"
-  !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 4" "Text"  "$(T_InstOptFieldC)"
-  !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
-       "Field 5" "Text"  "$(T_InstOptLabelB)"
-
-  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "installer-options.ini"
-FunctionEnd
-
 # Display a warning if this is a Beta version.
 #Function PrintBetaWarning
 #   MessageBox MB_OK "$(T_BetaWarning)"
@@ -402,15 +408,6 @@ Function PrintNonAdminWarning
 FunctionEnd
 
 
-# Check whether the start menu is actually wanted.
-
-Function CheckIfStartMenuWanted
-  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
-       "Field 2" "State"
-  IntCmp $R0 1 +2
-    Abort
-FunctionEnd
-
 # Check for claws mail installation which was shipped in Gpg4win
 # versions < 2.2.6
 Function CheckClawsUninstall
@@ -690,4 +687,77 @@ Function un.RemoveFromPath
   Pop $0
 FunctionEnd
 
+Function .onInit
+  Call G4wRunOnce
+
+  SetOutPath $TEMP
+!ifdef SOURCES
+  File /oname=gpgspltmp.bmp "${TOP_SRCDIR}/doc/logo/gpg4win-logo-400px.bmp"
+  # We play the tune only for the source installer
+  File /oname=gpgspltmp.wav "${TOP_SRCDIR}/src/gpg4win-splash.wav"
+  g4wihelp::playsound $TEMP\gpgspltmp.wav
+  g4wihelp::showsplash 2500 $TEMP\gpgspltmp.bmp
+
+  Delete $TEMP\gpgspltmp.bmp
+  # Note that we delete gpgspltmp.wav in .onInst{Failed,Success}
+!endif
+
+  # Enable this to force a language selection dialog on every run (the
+  # preferred language is the default).  Otherwise, the preferred
+  # language is stored in the registry, and the installer does not ask
+  # on upgrades.
+!ifdef DEBUG
+!define MUI_LANGDLL_ALWAYSSHOW
+!endif
+  !insertmacro MUI_LANGDLL_DISPLAY
+
+  ${MementoSectionRestore}
+  Call CalcDefaults
+  Call CalcDepends
+  Call CheckOtherGnuPGApps
+FunctionEnd
+
+
+Function un.onInit
+  # Remove the language preference.
+  !insertmacro MUI_UNGETLANGUAGE
+FunctionEnd
+
+# This must be in a central place.  Urgs.
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+!ifdef HAVE_PKG_GNUPG_W32
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gnupg_w32} $(DESC_SEC_gnupg_w32)
+!endif
+!ifdef HAVE_PKG_GPGOL
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpgol} $(DESC_SEC_gpgol)
+!endif
+!ifdef HAVE_PKG_GPGEX
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpgex} $(DESC_SEC_gpgex)
+!endif
+!ifdef HAVE_PKG_PAPERKEY
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_paperkey} $(DESC_SEC_paperkey)
+!endif
+!ifdef HAVE_PKG_GPA
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpa} $(DESC_SEC_gpa)
+!endif
+!ifdef HAVE_PKG_KLEOPATRA
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_kleopatra} $(DESC_SEC_kleopatra)
+!endif
+!ifdef HAVE_PKG_MAN_NOVICE_EN
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_novice_en} $(DESC_SEC_man_novice_en)
+!endif
+!ifdef HAVE_PKG_MAN_ADVANCED_EN
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_advanced_en} $(DESC_SEC_man_advanced_en)
+!endif
+!ifdef HAVE_PKG_COMPENDIUM
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_compendium} $(DESC_SEC_compendium)
+!endif
+!ifdef HAVE_PKG_MAN_NOVICE_DE
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_novice_de} $(DESC_SEC_man_novice_de)
+!endif
+!ifdef HAVE_PKG_MAN_ADVANCED_DE
+  !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_advanced_de} $(DESC_SEC_man_advanced_de)
+!endif
+!insertmacro MUI_FUNCTION_DESCRIPTION_END