printer_enum *pe;
dlg_update_start(ctrl, dlg);
- dlg_listbox_clear(ctrl, dlg);
- dlg_listbox_add(ctrl, dlg, PRINTER_DISABLED_STRING);
- pe = printer_start_enum(&nprinters);
- for (i = 0; i < nprinters; i++)
- dlg_listbox_add(ctrl, dlg, printer_get_name(pe, i));
- printer_finish_enum(pe);
+ /*
+ * Some backends may wish to disable the drop-down list on
+ * this edit box. Be prepared for this.
+ */
+ if (ctrl->editbox.has_list) {
+ dlg_listbox_clear(ctrl, dlg);
+ dlg_listbox_add(ctrl, dlg, PRINTER_DISABLED_STRING);
+ pe = printer_start_enum(&nprinters);
+ for (i = 0; i < nprinters; i++)
+ dlg_listbox_add(ctrl, dlg, printer_get_name(pe, i));
+ printer_finish_enum(pe);
+ }
dlg_editbox_set(ctrl, dlg,
(*cfg->printer ? cfg->printer :
PRINTER_DISABLED_STRING));
Config *cfg = (Config *)data;
if (event == EVENT_REFRESH) {
int i;
- char *cp;
+ const char *cp;
dlg_update_start(ctrl, dlg);
strcpy(cfg->line_codepage,
cp_name(decode_codepage(cfg->line_codepage)));
savedsession[0] = '\0';
}
}
- save_settings(savedsession, !isdef, cfg);
+ {
+ char *errmsg = save_settings(savedsession, !isdef, cfg);
+ if (errmsg) {
+ dlg_error_msg(dlg, errmsg);
+ sfree(errmsg);
+ }
+ }
get_sesslist(ssd->sesslist, FALSE);
get_sesslist(ssd->sesslist, TRUE);
dlg_refresh(ssd->editbox, dlg);
if (ctrl == pfd->addbutton) {
char str[sizeof(cfg->portfwd)];
char *p;
- if (dlg_radiobutton_get(pfd->direction, dlg) == 0)
+ int whichbutton = dlg_radiobutton_get(pfd->direction, dlg);
+ if (whichbutton == 0)
str[0] = 'L';
- else
+ else if (whichbutton == 1)
str[0] = 'R';
+ else
+ str[0] = 'D';
dlg_editbox_get(pfd->sourcebox, dlg, str+1, sizeof(str) - 2);
if (!str[1]) {
dlg_error_msg(dlg, "You need to specify a source port number");
return;
}
p = str + strlen(str);
- *p++ = '\t';
- dlg_editbox_get(pfd->destbox, dlg, p, sizeof(str)-1 - (p - str));
- if (!*p || !strchr(p, ':')) {
- dlg_error_msg(dlg,
- "You need to specify a destination address\n"
- "in the form \"host.name:port\"");
- return;
- }
+ if (str[0] != 'D') {
+ *p++ = '\t';
+ dlg_editbox_get(pfd->destbox, dlg, p,
+ sizeof(str)-1 - (p - str));
+ if (!*p || !strchr(p, ':')) {
+ dlg_error_msg(dlg,
+ "You need to specify a destination address\n"
+ "in the form \"host.name:port\"");
+ return;
+ }
+ } else
+ *p = '\0';
p = cfg->portfwd;
while (*p) {
while (*p)
charclass_handler, P(ccd));
ccd->listbox->listbox.multisel = 1;
ccd->listbox->listbox.ncols = 4;
- ccd->listbox->listbox.percentages = smalloc(4*sizeof(int));
+ ccd->listbox->listbox.percentages = snewn(4, int);
ccd->listbox->listbox.percentages[0] = 15;
ccd->listbox->listbox.percentages[1] = 25;
ccd->listbox->listbox.percentages[2] = 20;
environ_handler, P(ed));
ed->listbox->listbox.height = 3;
ed->listbox->listbox.ncols = 2;
- ed->listbox->listbox.percentages = smalloc(2*sizeof(int));
+ ed->listbox->listbox.percentages = snewn(2, int);
ed->listbox->listbox.percentages[0] = 30;
ed->listbox->listbox.percentages[1] = 70;
}
portfwd_handler, P(pfd));
pfd->listbox->listbox.height = 3;
pfd->listbox->listbox.ncols = 2;
- pfd->listbox->listbox.percentages = smalloc(2*sizeof(int));
+ pfd->listbox->listbox.percentages = snewn(2, int);
pfd->listbox->listbox.percentages[0] = 20;
pfd->listbox->listbox.percentages[1] = 80;
ctrl_tabdelay(s, pfd->rembutton);
pfd->destbox = ctrl_editbox(s, "Destination", 'i', 67,
HELPCTX(ssh_tunnels_portfwd),
portfwd_handler, P(pfd), P(NULL));
- pfd->direction = ctrl_radiobuttons(s, NULL, NO_SHORTCUT, 2,
+ pfd->direction = ctrl_radiobuttons(s, NULL, NO_SHORTCUT, 3,
HELPCTX(ssh_tunnels_portfwd),
portfwd_handler, P(pfd),
"Local", 'l', P(NULL),
- "Remote", 'm', P(NULL), NULL);
+ "Remote", 'm', P(NULL),
+ "Dynamic", 'y', P(NULL),
+ NULL);
ctrl_tabdelay(s, pfd->addbutton);
ctrl_columns(s, 1, 100);