X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=gui.cpp;h=9c4d71247ed6f1f8a1da668ee3be42f89fc2db76;hb=62f28c55d444d846579159133dbe091809a2c08b;hp=628b136ff446d26baba8f88d5d145901a9d31f6c;hpb=b76766ed76f1bf26c31e0c73b154e2f6a95b278d;p=nssm.git diff --git a/gui.cpp b/gui.cpp index 628b136..9c4d712 100644 --- a/gui.cpp +++ b/gui.cpp @@ -180,6 +180,7 @@ int nssm_gui(int resource, nssm_service_t *service) { SetDlgItemText(tablist[NSSM_TAB_IO], IDC_STDIN, service->stdin_path); SetDlgItemText(tablist[NSSM_TAB_IO], IDC_STDOUT, service->stdout_path); SetDlgItemText(tablist[NSSM_TAB_IO], IDC_STDERR, service->stderr_path); + if (service->timestamp_log) SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TIMESTAMP, BM_SETCHECK, BST_CHECKED, 0); /* Rotation tab. */ if (service->stdout_disposition == CREATE_ALWAYS) SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_TRUNCATE, BM_SETCHECK, BST_CHECKED, 0); @@ -354,7 +355,7 @@ static inline void set_hook_tab(int event_index, int action_index, bool changed) SetEnvironmentVariable(hook_name, cmd); } else { - GetEnvironmentVariable(hook_name, cmd, _countof(cmd)); + if (! GetEnvironmentVariable(hook_name, cmd, _countof(cmd))) cmd[0] = _T('\0'); SetDlgItemText(tablist[NSSM_TAB_HOOKS], IDC_HOOK, cmd); } } @@ -676,6 +677,8 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service check_io(window, _T("stdin"), service->stdin_path, _countof(service->stdin_path), IDC_STDIN); check_io(window, _T("stdout"), service->stdout_path, _countof(service->stdout_path), IDC_STDOUT); check_io(window, _T("stderr"), service->stderr_path, _countof(service->stderr_path), IDC_STDERR); + if (SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TIMESTAMP, BM_GETCHECK, 0, 0) & BST_CHECKED) service->timestamp_log = true; + else service->timestamp_log = false; /* Override stdout and/or stderr. */ if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_TRUNCATE, BM_GETCHECK, 0, 0) & BST_CHECKED) { @@ -1248,6 +1251,9 @@ INT_PTR CALLBACK nssm_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { tablist[NSSM_TAB_IO] = dialog(MAKEINTRESOURCE(IDD_IO), window, tab_dlg); ShowWindow(tablist[NSSM_TAB_IO], SW_HIDE); + /* Set defaults. */ + SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TIMESTAMP, BM_SETCHECK, BST_UNCHECKED, 0); + /* Rotation tab. */ tab.pszText = message_string(NSSM_GUI_TAB_ROTATION); tab.cchTextMax = (int) _tcslen(tab.pszText) + 1;