X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/9f7ebadc564a72c01e28dd895d88e171e7952fe7..HEAD:/windows/windlg.c diff --git a/windows/windlg.c b/windows/windlg.c index 3a9d6e57..aadf88ea 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -44,7 +44,7 @@ static struct dlgparam dp; static char **events = NULL; static int nevents = 0, negsize = 0; -extern Config cfg; /* defined in window.c */ +extern Conf *conf; /* defined in window.c */ #define PRINTER_DISABLED_STRING "None (printing disabled)" @@ -322,7 +322,7 @@ static HTREEITEM treeview_insert(struct treeview_faff *faff, newitem = TreeView_InsertItem(faff->treeview, &ins); if (level > 0) TreeView_Expand(faff->treeview, faff->lastat[level - 1], - TVE_EXPAND); + (level > 1 ? TVE_COLLAPSE : TVE_EXPAND)); faff->lastat[level] = newitem; for (i = level + 1; i < 4; i++) faff->lastat[i] = NULL; @@ -648,7 +648,8 @@ int do_config(void) dp_add_tree(&dp, &ctrls_panel); dp.wintitle = dupprintf("%s Configuration", appname); dp.errtitle = dupprintf("%s Error", appname); - dp.data = &cfg; + dp.data = conf; + dlg_auto_set_fixed_pitch_flag(&dp); dp.shortcuts['g'] = TRUE; /* the treeview: `Cate&gory' */ ret = @@ -665,15 +666,15 @@ int do_config(void) int do_reconfig(HWND hwnd, int protcfginfo) { - Config backup_cfg; - int ret; + Conf *backup_conf; + int ret, protocol; - backup_cfg = cfg; /* structure copy */ + backup_conf = conf_copy(conf); ctrlbox = ctrl_new_box(); - setup_config_box(ctrlbox, TRUE, cfg.protocol, protcfginfo); - win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), TRUE, - cfg.protocol); + protocol = conf_get_int(conf, CONF_protocol); + setup_config_box(ctrlbox, TRUE, protocol, protcfginfo); + win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), TRUE, protocol); dp_init(&dp); winctrl_init(&ctrls_base); winctrl_init(&ctrls_panel); @@ -681,7 +682,8 @@ int do_reconfig(HWND hwnd, int protcfginfo) dp_add_tree(&dp, &ctrls_panel); dp.wintitle = dupprintf("%s Reconfiguration", appname); dp.errtitle = dupprintf("%s Error", appname); - dp.data = &cfg; + dp.data = conf; + dlg_auto_set_fixed_pitch_flag(&dp); dp.shortcuts['g'] = TRUE; /* the treeview: `Cate&gory' */ ret = SaneDialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, @@ -693,7 +695,9 @@ int do_reconfig(HWND hwnd, int protcfginfo) dp_cleanup(&dp); if (!ret) - cfg = backup_cfg; /* structure copy */ + conf_copy_into(conf, backup_conf); + + conf_free(backup_conf); return ret; } @@ -786,7 +790,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, if (ret == 0) /* success - key matched OK */ return 1; - if (ret == 2) { /* key was different */ + else if (ret == 2) { /* key was different */ int mbret; char *text = dupprintf(wrongmsg, appname, keytype, fingerprint, appname); @@ -802,9 +806,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, return 1; } else if (mbret == IDNO) return 1; - return 0; - } - if (ret == 1) { /* key was absent */ + } else if (ret == 1) { /* key was absent */ int mbret; char *text = dupprintf(absentmsg, keytype, fingerprint, appname); char *caption = dupprintf(mbtitle, appname); @@ -819,8 +821,8 @@ int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, return 1; } else if (mbret == IDNO) return 1; - return 0; } + return 0; /* abandon the connection */ } /* @@ -856,7 +858,7 @@ int askalg(void *frontend, const char *algtype, const char *algname, * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(void *frontend, Filename filename, +int askappend(void *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx) { static const char msgtemplate[] = @@ -870,7 +872,7 @@ int askappend(void *frontend, Filename filename, char *mbtitle; int mbret; - message = dupprintf(msgtemplate, FILENAME_MAX, filename.path); + message = dupprintf(msgtemplate, FILENAME_MAX, filename->path); mbtitle = dupprintf("%s Log to File", appname); mbret = MessageBox(NULL, message, mbtitle,