mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
New command-line option: 'putty --host-ca'.
This causes PuTTY to bring up just the host CA configuration dialog box, and shut down once that box is dismissed. I can imagine it potentially being useful to users, but in the first instance, I expect it to be useful to _me_, because it will greatly streamline testing changes to the UI of that dialog!
This commit is contained in:
parent
89883bf158
commit
259e877b92
@ -4224,6 +4224,7 @@ struct ca_config_box {
|
||||
GtkWidget *window;
|
||||
struct controlbox *cb;
|
||||
struct Shortcuts scs;
|
||||
bool quit_main;
|
||||
dlgparam dp;
|
||||
};
|
||||
static struct ca_config_box *cacfg; /* one of these, cross-instance */
|
||||
@ -4234,8 +4235,10 @@ static void cacfg_destroy(GtkWidget *widget, gpointer data)
|
||||
dlg_cleanup(&cacfg->dp);
|
||||
ctrl_free_box(cacfg->cb);
|
||||
cacfg->cb = NULL;
|
||||
if (cacfg->quit_main)
|
||||
gtk_main_quit();
|
||||
}
|
||||
void show_ca_config_box(dlgparam *dp)
|
||||
static void make_ca_config_box(GtkWidget *spawning_window)
|
||||
{
|
||||
if (!cacfg) {
|
||||
cacfg = snew(struct ca_config_box);
|
||||
@ -4288,8 +4291,8 @@ void show_ca_config_box(dlgparam *dp)
|
||||
|
||||
dlg_refresh(NULL, &cacfg->dp);
|
||||
|
||||
if (dp) {
|
||||
set_transient_window_pos(dp->window, cacfg->window);
|
||||
if (spawning_window) {
|
||||
set_transient_window_pos(spawning_window, cacfg->window);
|
||||
} else {
|
||||
gtk_window_set_position(GTK_WINDOW(cacfg->window), GTK_WIN_POS_CENTER);
|
||||
}
|
||||
@ -4300,3 +4303,15 @@ void show_ca_config_box(dlgparam *dp)
|
||||
g_signal_connect(G_OBJECT(cacfg->window), "key_press_event",
|
||||
G_CALLBACK(win_key_press), &cacfg->dp);
|
||||
}
|
||||
|
||||
void show_ca_config_box(dlgparam *dp)
|
||||
{
|
||||
make_ca_config_box(dp ? dp->window : NULL);
|
||||
}
|
||||
|
||||
void show_ca_config_box_synchronously(void)
|
||||
{
|
||||
make_ca_config_box(NULL);
|
||||
cacfg->quit_main = true;
|
||||
gtk_main();
|
||||
}
|
||||
|
@ -532,6 +532,11 @@ bool do_cmdline(int argc, char **argv, bool do_everything, Conf *conf)
|
||||
pgp_fingerprints();
|
||||
exit(1);
|
||||
|
||||
} else if (!strcmp(p, "-host-ca") || !strcmp(p, "--host-ca") ||
|
||||
!strcmp(p, "-host_ca") || !strcmp(p, "--host_ca")) {
|
||||
show_ca_config_box_synchronously();
|
||||
exit(0);
|
||||
|
||||
} else if (p[0] != '-') {
|
||||
/* Non-option arguments not handled by cmdline.c are errors. */
|
||||
if (do_everything) {
|
||||
|
@ -245,6 +245,7 @@ GtkWidget *create_message_box(
|
||||
bool selectable, const struct message_box_buttons *buttons,
|
||||
post_dialog_fn_t after, void *afterctx);
|
||||
#endif
|
||||
void show_ca_config_box_synchronously(void);
|
||||
|
||||
/* window.c needs this special function in utils */
|
||||
int keysym_to_unicode(int keysym);
|
||||
|
@ -87,6 +87,10 @@ void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
||||
} else if (!strcmp(p, "-pgpfp")) {
|
||||
pgp_fingerprints_msgbox(NULL);
|
||||
exit(1);
|
||||
} else if (!strcmp(p, "-host-ca") || !strcmp(p, "--host-ca") ||
|
||||
!strcmp(p, "-host_ca") || !strcmp(p, "--host_ca")) {
|
||||
show_ca_config_box(NULL);
|
||||
exit(0);
|
||||
} else if (!strcmp(p, "-demo-config-box")) {
|
||||
if (i+1 >= argc) {
|
||||
cmdline_error("%s expects an output filename", p);
|
||||
|
Loading…
Reference in New Issue
Block a user