[gnome-color-manager/gnome-3-6] Inhibit the screensaver and user switching when calibrating
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager/gnome-3-6] Inhibit the screensaver and user switching when calibrating
- Date: Wed, 13 Feb 2013 15:25:00 +0000 (UTC)
commit 4def75c2b78209c988316f67d7d054caa4e77c04
Author: Richard Hughes <richard hughsie com>
Date: Wed Feb 13 14:40:18 2013 +0000
Inhibit the screensaver and user switching when calibrating
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=884551
configure.ac | 2 +-
src/gcm-calibrate-main.c | 55 +++++++++++++++++++++++++++++----------------
2 files changed, 36 insertions(+), 21 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e64163f..bb05fe2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,7 @@ dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.31.10 gobject-2.0 gthread-2.0 gio-2.0 >= 2.25.9)
PKG_CHECK_MODULES(XORG, xrandr)
-PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.91.0)
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.4.0)
PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2)
PKG_CHECK_MODULES(X11, x11)
PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0)
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index f47e003..7206994 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -73,6 +73,7 @@ typedef struct {
gboolean has_pending_interaction;
gboolean started_calibration;
GcmCalibratePage current_page;
+ gint inhibit_cookie;
} GcmCalibratePriv;
/**
@@ -432,47 +433,57 @@ gcm_calib_start_idle_cb (gpointer user_data)
CdProfile *profile = NULL;
const gchar *filename;
gboolean ret;
+ GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
GError *error = NULL;
GFile *file = NULL;
+ gint inhibit_cookie;
+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
GtkWidget *vbox;
- GcmCalibratePriv *calib = (GcmCalibratePriv *) user_data;
- GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
- /* actuall do the action */
- calib->started_calibration = TRUE;
- ret = gcm_calibrate_device (calib->calibrate,
- calib->device,
- calib->main_window,
+ /* inhibit */
+ inhibit_cookie = gtk_application_inhibit (priv->application,
+ priv->main_window,
+ GTK_APPLICATION_INHIBIT_LOGOUT |
+ GTK_APPLICATION_INHIBIT_SWITCH |
+ GTK_APPLICATION_INHIBIT_SUSPEND |
+ GTK_APPLICATION_INHIBIT_IDLE,
+ "Calibration in progress");
+
+ /* actually do the action */
+ priv->started_calibration = TRUE;
+ ret = gcm_calibrate_device (priv->calibrate,
+ priv->device,
+ priv->main_window,
&error);
if (!ret) {
- gcm_calibrate_set_title (calib->calibrate,
+ gcm_calibrate_set_title (priv->calibrate,
_("Failed to calibrate"),
GCM_CALIBRATE_UI_ERROR);
- gcm_calibrate_set_message (calib->calibrate,
+ gcm_calibrate_set_message (priv->calibrate,
error->message,
GCM_CALIBRATE_UI_ERROR);
- gcm_calibrate_set_image (calib->calibrate, NULL);
+ gcm_calibrate_set_image (priv->calibrate, NULL);
g_warning ("failed to calibrate: %s",
error->message);
g_error_free (error);
/* mark this box as the end */
- vbox = gcm_calib_get_vbox_for_page (calib, GCM_CALIBRATE_PAGE_ACTION);
+ vbox = gcm_calib_get_vbox_for_page (priv, GCM_CALIBRATE_PAGE_ACTION);
gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
gtk_assistant_set_page_complete (assistant, vbox, TRUE);
goto out;
}
/* get profile */
- filename = gcm_calibrate_get_filename_result (calib->calibrate);
+ filename = gcm_calibrate_get_filename_result (priv->calibrate);
if (filename == NULL) {
g_warning ("failed to get filename from calibration");
goto out;
}
/* set some private properties */
- ret = gcm_calib_set_extra_metadata (calib, filename, &error);
+ ret = gcm_calib_set_extra_metadata (priv, filename, &error);
if (!ret) {
g_warning ("failed to set extra metadata: %s",
error->message);
@@ -481,13 +492,13 @@ gcm_calib_start_idle_cb (gpointer user_data)
}
/* inform the sensor about the last successful profile */
- gcm_calib_set_sensor_options (calib, filename);
+ gcm_calib_set_sensor_options (priv, filename);
/* copy the ICC file to the proper location */
file = g_file_new_for_path (filename);
- profile = cd_client_import_profile_sync (calib->client,
+ profile = cd_client_import_profile_sync (priv->client,
file,
- calib->cancellable,
+ priv->cancellable,
&error);
if (profile == NULL) {
g_warning ("failed to find calibration profile: %s",
@@ -495,15 +506,15 @@ gcm_calib_start_idle_cb (gpointer user_data)
g_error_free (error);
goto out;
}
- ret = cd_device_add_profile_sync (calib->device,
+ ret = cd_device_add_profile_sync (priv->device,
CD_DEVICE_RELATION_HARD,
profile,
- calib->cancellable,
+ priv->cancellable,
&error);
if (!ret) {
g_warning ("failed to add %s to %s: %s",
cd_profile_get_object_path (profile),
- cd_device_get_object_path (calib->device),
+ cd_device_get_object_path (priv->device),
error->message);
g_error_free (error);
goto out;
@@ -513,7 +524,7 @@ gcm_calib_start_idle_cb (gpointer user_data)
g_unlink (filename);
/* allow forward */
- vbox = gcm_calib_get_vbox_for_page (calib,
+ vbox = gcm_calib_get_vbox_for_page (priv,
GCM_CALIBRATE_PAGE_ACTION);
gtk_assistant_set_page_complete (assistant,
vbox, TRUE);
@@ -522,6 +533,10 @@ gcm_calib_start_idle_cb (gpointer user_data)
gtk_assistant_set_current_page (assistant,
gtk_assistant_get_n_pages (assistant) - 1);
out:
+ if (inhibit_cookie != 0) {
+ gtk_application_uninhibit (priv->application,
+ priv->inhibit_cookie);
+ }
if (profile != NULL)
g_object_unref (profile);
if (file != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]