;******************************************************************************
; Installation script for Gadget & Image Collection #1 (GI1)
; Written by David N. Junod
; Changed by Henk Jonas for only tabs.gadget
;******************************************************************************

; Initialize a few things
(set docbits 0)
(set ename "tabs.gadget")

;******************************************************************************
; Ask the user if we are installing or removing

(set mode
        (askchoice
                (prompt "tabs.gadget")
                (help @askchoice-help)
                (choices "Install" "Remove")
        )
)

; Set the prompt string
(if mode
        (set pmode "Remove")
        (set pmode "Install")
)

;******************************************************************************
; Prompt for components and their directories

; Classes
    (set classdir
             (askdir
                      (prompt "Where do the tabs.gadget belong")
                      (help @askdir-help)
                      (default "SYS:Classes")
             )
    )

;******************************************************************************
;******************************************************************************
;******************************************************************************

(if mode
        ;**********************************************************************
        ; Remove
        ;**********************************************************************
        (
                ; Are we supposed to remove classes
                      (
                              (working "Removing tabs.gadget")
                              (delete (tackon classdir "gadgets/tabs.gadget"))
                      )

                ; Don't want to use the confusing "Installation Complete" message
                ; when what we really did was remove things...
                (message "The \"tabs.gadget\" "
                         "have been successfully removed")
                (exit (quiet))
        )

        ;**********************************************************************
        ; Install
        ;**********************************************************************
        (
                ; Are we supposed to install classes
                      (
                             ; Make sure the class sub-directories exist */
                             (makedir (tackon classdir "Gadgets"))
                             (makedir (tackon classdir "Images"))

                             ; Install the classes
                             (copylib
                                  (prompt "Copying tabs gadget")
                                  (help @copylib-help)
                                  (source "classes/gadgets/tabs.gadget")
                                  (dest (tackon classdir "Gadgets"))
                                  (confirm)
                             )
                      )
        )

)
