diff options
| author | Leandro Pereira <leandro@hardinfo.org> | 2020-05-18 14:36:49 -0700 | 
|---|---|---|
| committer | Leandro Pereira <leandro@hardinfo.org> | 2020-05-18 14:36:49 -0700 | 
| commit | 0505ce104c2a8df27226c6b40aa38854ca8b00b5 (patch) | |
| tree | b9128a0c9244c09f805a02a49850e78c4bcce23f /modules | |
| parent | be5fb4fcfcba7605ee7aa1130ca5dadd3f8d80e3 (diff) | |
Benchmarks can't be cancelled during sync, so remove Cancel button
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/benchmark.c | 23 | 
1 files changed, 14 insertions, 9 deletions
| diff --git a/modules/benchmark.c b/modules/benchmark.c index af06dd27..aa88e7df 100644 --- a/modules/benchmark.c +++ b/modules/benchmark.c @@ -689,16 +689,21 @@ static void do_benchmark(void (*benchmark_function)(void), int entry)          gtk_widget_show(bench_image);          bench_dialog = gtk_message_dialog_new( -            GTK_WINDOW(shell_get_main_shell()->window), GTK_DIALOG_MODAL, +            GTK_WINDOW(shell_get_main_shell()->transient_dialog), GTK_DIALOG_MODAL,              GTK_MESSAGE_INFO, GTK_BUTTONS_NONE,              _("Benchmarking. Please do not move your mouse "                "or press any keys.")); -        gtk_window_set_transient_for(GTK_WINDOW(bench_dialog), -                                     GTK_WINDOW(shell_get_main_shell()->transient_dialog)); -        gtk_widget_set_sensitive(GTK_WIDGET(shell_get_main_shell()->transient_dialog), -                                 FALSE); -        gtk_dialog_add_buttons(GTK_DIALOG(bench_dialog), _("Cancel"), -                               GTK_RESPONSE_ACCEPT, NULL); + +        gtk_widget_set_sensitive( +            GTK_WIDGET(shell_get_main_shell()->transient_dialog), FALSE); + +        if (GTK_WINDOW(shell_get_main_shell()->transient_dialog) == +            GTK_WINDOW(shell_get_main_shell()->window)) { +            gtk_dialog_add_buttons(GTK_DIALOG(bench_dialog), _("Cancel"), +                                   GTK_RESPONSE_ACCEPT, NULL); +        } else { +            gtk_window_set_deletable(GTK_WINDOW(bench_dialog), FALSE); +        }          G_GNUC_BEGIN_IGNORE_DEPRECATIONS          gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(bench_dialog), @@ -746,8 +751,8 @@ static void do_benchmark(void (*benchmark_function)(void), int entry)              g_io_channel_unref(channel);              shell_view_set_enabled(TRUE);              shell_status_set_enabled(TRUE); -            gtk_widget_set_sensitive(GTK_WIDGET(shell_get_main_shell()->transient_dialog), -                                     TRUE); +            gtk_widget_set_sensitive( +                GTK_WIDGET(shell_get_main_shell()->transient_dialog), TRUE);              g_free(benchmark_dialog);              shell_status_update(_("Done.")); | 
