[gnome-color-manager/gnome-3-4] Show the actual ICC profile after calibration if the user is using a LiveCD
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager/gnome-3-4] Show the actual ICC profile after calibration if the user is using a LiveCD
- Date: Tue, 17 Apr 2012 17:57:23 +0000 (UTC)
commit 55e1de5f472e3754f3a143da0bea45270aec57e2
Author: Richard Hughes <richard hughsie com>
Date: Sat Apr 14 13:43:17 2012 +0100
Show the actual ICC profile after calibration if the user is using a LiveCD
src/gcm-calibrate-main.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index ce71392..c30db54 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -679,11 +679,60 @@ 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
gcm_calib_setup_page_summary (GcmCalibratePriv *calib)
{
+ gboolean ret;
GtkWidget *vbox;
GtkWidget *content;
GtkWidget *image;
@@ -739,6 +788,11 @@ 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]