Warn-on-close is now configurable off
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 5 Nov 1999 09:50:49 +0000 (09:50 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 5 Nov 1999 09:50:49 +0000 (09:50 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@273 cda61777-01e9-0310-a592-d414129be87e

putty.h
win_res.h
win_res.rc
windlg.c
window.c

diff --git a/putty.h b/putty.h
index 6999d3e..fcbb878 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -97,6 +97,7 @@ typedef struct {
     int port;
     enum { PROT_RAW, PROT_TELNET, PROT_SSH } protocol;
     int close_on_exit;
+    int warn_on_close;
     /* SSH options */
     int nopty;
     enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;
index 9c436c4..3e00d73 100644 (file)
--- a/win_res.h
+++ b/win_res.h
@@ -42,6 +42,7 @@
 #define IDC0_SESSSAVE   1013
 #define IDC0_SESSDEL    1014
 #define IDC0_CLOSEEXIT  1015
+#define IDC0_CLOSEWARN  1016
 
 #define IDC1_DELSTATIC  1001
 #define IDC1_DEL008     1002
index f419205..8ed6ebd 100644 (file)
@@ -52,23 +52,24 @@ BEGIN
     EDITTEXT IDC0_PORT, 131, 11, 34, 12
 #ifdef FWHACK
     RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 42, 8
-    AUTORADIOBUTTON "R&aw", IDC0_PROTRAW, 51, 29, 33, 10, WS_GROUP
+    AUTORADIOBUTTON "&Raw", IDC0_PROTRAW, 51, 29, 33, 10, WS_GROUP
     AUTORADIOBUTTON "&Telnet", IDC0_PROTTELNET, 86, 29, 33, 10
     AUTORADIOBUTTON "SS&H/hack", IDC0_PROTSSH, 122, 29, 43, 10
 #else
     RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 52, 8
-    AUTORADIOBUTTON "R&aw", IDC0_PROTRAW, 61, 29, 33, 10, WS_GROUP
+    AUTORADIOBUTTON "&Raw", IDC0_PROTRAW, 61, 29, 33, 10, WS_GROUP
     AUTORADIOBUTTON "&Telnet", IDC0_PROTTELNET, 96, 29, 33, 10
     AUTORADIOBUTTON "SS&H", IDC0_PROTSSH, 132, 29, 33, 10
 #endif
-    LTEXT "Sto&red Sessions", IDC0_SESSSTATIC, 3, 40, 122, 8
+    LTEXT "Stor&ed Sessions", IDC0_SESSSTATIC, 3, 40, 122, 8
     EDITTEXT IDC0_SESSEDIT, 3, 48, 122, 12, ES_AUTOHSCROLL
     LISTBOX IDC0_SESSLIST, 3, 63, 122, 81,
         LBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     PUSHBUTTON "&Load", IDC0_SESSLOAD, 131, 63, 34, 14
     PUSHBUTTON "&Save", IDC0_SESSSAVE, 131, 80, 34, 14
     PUSHBUTTON "&Delete", IDC0_SESSDEL, 131, 97, 34, 14
-    AUTOCHECKBOX "Close &Window on Exit", IDC0_CLOSEEXIT, 3, 147, 162, 10
+    AUTOCHECKBOX "Close &Window on Exit", IDC0_CLOSEEXIT, 3, 147, 91, 10
+    AUTOCHECKBOX "Warn on C&lose", IDC0_CLOSEWARN, 96, 147, 69, 10
 END
 
 IDD_PANEL1 DIALOG DISCARDABLE 6, 30, 168, 163
index 023ebbc..3dccae1 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -120,6 +120,7 @@ static void save_settings (char *section, int do_host) {
                  cfg.protocol == PROT_TELNET ? "telnet" : "raw" );
     }
     wppi (sesskey, "CloseOnExit", !!cfg.close_on_exit);
+    wppi (sesskey, "WarnOnClose", !!cfg.warn_on_close);
     wpps (sesskey, "TerminalType", cfg.termtype);
     wpps (sesskey, "TerminalSpeed", cfg.termspeed);
     {
@@ -235,6 +236,7 @@ static void load_settings (char *section, int do_host) {
        cfg.protocol = default_protocol;
 
     gppi (sesskey, "CloseOnExit", 1, &cfg.close_on_exit);
+    gppi (sesskey, "WarnOnClose", 1, &cfg.warn_on_close);
     gpps (sesskey, "TerminalType", "xterm", cfg.termtype,
          sizeof(cfg.termtype));
     gpps (sesskey, "TerminalSpeed", "38400,38400", cfg.termspeed,
@@ -454,6 +456,7 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
                          cfg.protocol==PROT_SSH ? IDC0_PROTSSH : 
                          cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW );
        CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
+       CheckDlgButton (hwnd, IDC0_CLOSEWARN, cfg.warn_on_close);
        break;
       case WM_LBUTTONUP:
         /*
@@ -495,6 +498,11 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
                HIWORD(wParam) == BN_DOUBLECLICKED)
                cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC0_CLOSEEXIT);
            break;
+         case IDC0_CLOSEWARN:
+           if (HIWORD(wParam) == BN_CLICKED ||
+               HIWORD(wParam) == BN_DOUBLECLICKED)
+               cfg.warn_on_close = IsDlgButtonChecked (hwnd, IDC0_CLOSEWARN);
+           break;
          case IDC0_SESSEDIT:
            if (HIWORD(wParam) == EN_CHANGE)
                SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
@@ -553,6 +561,7 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
                                  (cfg.protocol==PROT_SSH ? IDC0_PROTSSH :
                                  cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW));
                CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
+               CheckDlgButton (hwnd, IDC0_CLOSEWARN, cfg.warn_on_close);
                SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
                                    (WPARAM) -1, 0);
            }
index 10650ed..decb220 100644 (file)
--- a/window.c
+++ b/window.c
@@ -617,7 +617,8 @@ static int WINAPI WndProc (HWND hwnd, UINT message,
       case WM_CREATE:
        break;
       case WM_CLOSE:
-       if (MessageBox(hwnd, "Are you sure you want to close this session?",
+       if (!cfg.warn_on_close ||
+           MessageBox(hwnd, "Are you sure you want to close this session?",
                       "PuTTY Exit Confirmation",
                       MB_ICONWARNING | MB_OKCANCEL) == IDOK)
            DestroyWindow(hwnd);