[gnome-disk-utility/gnome-3-28] Register inhibitor for benchmark thread (no string change)
- From: Kai Lüke <kailueke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/gnome-3-28] Register inhibitor for benchmark thread (no string change)
- Date: Tue, 8 May 2018 06:37:42 +0000 (UTC)
commit 6c5fe352d67529b60597dc24e9874b996087aff2
Author: Kai Lüke <kailueke riseup net>
Date: Mon Apr 16 18:10:41 2018 +0900
Register inhibitor for benchmark thread (no string change)
The system should not be suspended
during a benchmark or GNOME Disk
be killed with a logout.
Invoke the GtkApplication inhibitor
for the benchmarking thread.
https://bugzilla.gnome.org/show_bug.cgi?id=794485
src/disks/gdubenchmarkdialog.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/disks/gdubenchmarkdialog.c b/src/disks/gdubenchmarkdialog.c
index bf7c29e..4b8d0c6 100644
--- a/src/disks/gdubenchmarkdialog.c
+++ b/src/disks/gdubenchmarkdialog.c
@@ -1168,9 +1168,17 @@ benchmark_thread (gpointer user_data)
long page_size;
guint64 disk_size;
GVariantBuilder options_builder;
+ guint inhibit_cookie;
//g_print ("bm thread start\n");
+ inhibit_cookie = gtk_application_inhibit (GTK_APPLICATION (gdu_window_get_application (data->window)),
+ GTK_WINDOW (data->dialog),
+ GTK_APPLICATION_INHIBIT_SUSPEND |
+ GTK_APPLICATION_INHIBIT_LOGOUT,
+ /* Translators: Reason why suspend/logout is being inhibited */
+ _("Benchmark"));
+
g_variant_builder_init (&options_builder, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&options_builder, "{sv}", "writable", g_variant_new_boolean (data->bm_do_write));
@@ -1440,6 +1448,9 @@ benchmark_thread (gpointer user_data)
data->bm_thread = NULL;
data->bm_state = BM_STATE_NONE;
+ if (inhibit_cookie > 0)
+ gtk_application_uninhibit (GTK_APPLICATION (gdu_window_get_application (data->window)), inhibit_cookie);
+
if (error != NULL)
{
G_LOCK (bm_lock);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]