[gnome-color-manager/gnome-3-4] trivial: show the nautilus window only when the calibration has *completed*



commit 41015f1acd508a8e5879fe748c0db3affbaa82fc
Author: Richard Hughes <richard hughsie com>
Date:   Thu May 10 10:35:27 2012 +0100

    trivial: show the nautilus window only when the calibration has *completed*

 src/gcm-calibrate-main.c |  107 +++++++++++++++++++++++-----------------------
 1 files changed, 54 insertions(+), 53 deletions(-)
---
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index 90674f1..d76eba2 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -481,6 +481,54 @@ gcm_calib_assistant_page_forward_cb (gint current_page, gpointer user_data)
 }
 
 /**
+ * gcm_calibrate_show_profile_location:
+ **/
+static void
+gcm_calibrate_show_profile_location (void)
+{
+	gboolean ret;
+	gchar *command_line;
+	GError *error = NULL;
+
+	/* just hardcode nautilus to open the folder */
+	command_line = g_strdup_printf ("nautilus %s/%s",
+					g_get_user_data_dir (),
+					"icc");
+	ret = g_spawn_command_line_async (command_line, &error);
+	if (!ret) {
+		g_warning ("failed to show profile: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+out:
+	g_free (command_line);
+}
+
+/**
+ * gcm_calibrate_is_livecd:
+ **/
+static gboolean
+gcm_calibrate_is_livecd (void)
+{
+	gboolean ret;
+	gchar *data = NULL;
+	GError *error = NULL;
+
+	/* get the kernel commandline */
+	ret = g_file_get_contents ("/proc/cmdline", &data, NULL, &error);
+	if (!ret) {
+		g_warning ("failed to get kernel command line: %s",
+			   error->message);
+		g_error_free (error);
+		goto out;
+	}
+	ret = g_strstr_len (data, -1, "liveimg") != NULL;
+out:
+	g_free (data);
+	return ret;
+}
+
+/**
  * gcm_calib_assistant_prepare_cb:
  **/
 static gboolean
@@ -488,11 +536,17 @@ gcm_calib_assistant_prepare_cb (GtkAssistant *assistant,
 				GtkWidget *page_widget,
 				GcmCalibratePriv *calib)
 {
+	gboolean ret;
 	calib->current_page = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (page_widget),
 								   "GcmCalibrateMain::Index"));
 	switch (calib->current_page) {
 	case GCM_CALIBRATE_PAGE_LAST:
 		gcm_calib_play_sound (calib);
+
+		/* show the user the profile to copy off the live system */
+		ret = gcm_calibrate_is_livecd ();
+		if (ret)
+			gcm_calibrate_show_profile_location ();
 		break;
 	case GCM_CALIBRATE_PAGE_ACTION:
 		g_debug ("lights! camera! action!");
@@ -679,54 +733,6 @@ gcm_calib_setup_page_intro (GcmCalibratePriv *calib)
 }
 
 /**
- * gcm_calibrate_is_livecd:
- **/
-static gboolean
-gcm_calibrate_is_livecd (void)
-{
-	gboolean ret;
-	gchar *data = NULL;
-	GError *error = NULL;
-
-	/* get the kernel commandline */
-	ret = g_file_get_contents ("/proc/cmdline", &data, NULL, &error);
-	if (!ret) {
-		g_warning ("failed to get kernel command line: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-	ret = g_strstr_len (data, -1, "liveimg") != NULL;
-out:
-	g_free (data);
-	return ret;
-}
-
-/**
- * gcm_calibrate_show_profile_location:
- **/
-static void
-gcm_calibrate_show_profile_location (void)
-{
-	gboolean ret;
-	gchar *command_line;
-	GError *error = NULL;
-
-	/* just hardcode nautilus to open the folder */
-	command_line = g_strdup_printf ("nautilus %s/%s",
-					g_get_user_data_dir (),
-					"icc");
-	ret = g_spawn_command_line_async (command_line, &error);
-	if (!ret) {
-		g_warning ("failed to show profile: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-out:
-	g_free (command_line);
-}
-
-/**
  * gcm_calib_setup_page_summary:
  **/
 static void
@@ -788,11 +794,6 @@ gcm_calib_setup_page_summary (GcmCalibratePriv *calib)
 			   "GcmCalibrateMain::Index",
 			   GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_LAST));
 
-	/* show the user the profile to copy off the live system */
-	ret = gcm_calibrate_is_livecd ();
-	if (ret)
-		gcm_calibrate_show_profile_location ();
-
 	/* show page */
 	gtk_widget_show_all (vbox);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]