mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22:47 -05:00
Make the configuration dialog non-modal.
Now every call to do_config_box is replaced with a call to create_config_box, which returns immediately having constructed the new GTK window object, and is passed a callback function which it will arrange to be called when the dialog terminates (whether by OK or by Cancel). That callback is now what triggers the construction of a session window after 'Open' is pressed in the initial config box, or the actual mid-session reconfiguration action after 'Apply' is pressed in a Change Settings box. We were already prepared to ignore the re-selection of 'Change Settings' from the context menu of a window that already had a Change Settings box open (and not accidentally create a second config box for the same window); but now we do slightly better, by finding the existing config box and un-minimising and raising it, in case the user had forgotten it was there. That's a useful featurelet, but not the main purpose of this change. The mani point, of course, is that now the multi-window GtkApplication based front ends now don't do anything confusing to the nesting of gtk_main() when config boxes are involved. Whether you're changing the settings of one (or more than one) of your already-running sessions, preparing to start up a new PuTTY connection, or both at once, we stay in the same top-level instance of gtk_main() and all sessions' top- level callbacks continue to run sensibly.
This commit is contained in:
@ -142,6 +142,7 @@ GtkWidget *make_gtk_toplevel_window(void *frontend) { return NULL; }
|
||||
void launch_duplicate_session(Conf *conf) {}
|
||||
void launch_new_session(void) {}
|
||||
void launch_saved_session(const char *str) {}
|
||||
void session_window_closed(void) {}
|
||||
#else /* GTK_CHECK_VERSION(3,0,0) */
|
||||
|
||||
static void startup(GApplication *app, gpointer user_data)
|
||||
@ -190,8 +191,6 @@ GtkWidget *make_gtk_toplevel_window(void *frontend)
|
||||
return win;
|
||||
}
|
||||
|
||||
extern int cfgbox(Conf *conf);
|
||||
|
||||
void launch_duplicate_session(Conf *conf)
|
||||
{
|
||||
extern const int dup_check_launchable;
|
||||
@ -199,12 +198,20 @@ void launch_duplicate_session(Conf *conf)
|
||||
new_session_window(conf_copy(conf), NULL);
|
||||
}
|
||||
|
||||
void launch_new_session(void)
|
||||
void session_window_closed(void)
|
||||
{
|
||||
Conf *conf = conf_new();
|
||||
do_defaults(NULL, conf);
|
||||
if (conf_launchable(conf) || cfgbox(conf)) {
|
||||
g_application_release(G_APPLICATION(app));
|
||||
}
|
||||
|
||||
static void post_initial_config_box(void *vctx, int result)
|
||||
{
|
||||
Conf *conf = (Conf *)vctx;
|
||||
|
||||
if (result) {
|
||||
new_session_window(conf, NULL);
|
||||
} else {
|
||||
conf_free(conf);
|
||||
g_application_release(G_APPLICATION(app));
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,11 +219,23 @@ void launch_saved_session(const char *str)
|
||||
{
|
||||
Conf *conf = conf_new();
|
||||
do_defaults(str, conf);
|
||||
if (conf_launchable(conf) || cfgbox(conf)) {
|
||||
|
||||
g_application_hold(G_APPLICATION(app));
|
||||
|
||||
if (!conf_launchable(conf)) {
|
||||
initial_config_box(conf, post_initial_config_box, conf);
|
||||
} else {
|
||||
new_session_window(conf, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void launch_new_session(void)
|
||||
{
|
||||
/* Same as launch_saved_session except that we pass NULL to
|
||||
* do_defaults. */
|
||||
launch_saved_session(NULL);
|
||||
}
|
||||
|
||||
void new_app_win(GtkApplication *app)
|
||||
{
|
||||
launch_new_session();
|
||||
|
Reference in New Issue
Block a user