[gnome-color-manager] Use the new cd_client_import_profile_sync() when generating profiles



commit 0849fc741d45cffd1c8e4f799ed27e5c558292cd
Author: Richard Hughes <richard hughsie com>
Date:   Mon Aug 22 23:30:12 2011 +0100

    Use the new cd_client_import_profile_sync() when generating profiles

 configure.ac             |    2 +-
 src/gcm-calibrate-main.c |   39 ++++-----------------------------------
 2 files changed, 5 insertions(+), 36 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2d69b4b..9b8b145 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,7 +92,7 @@ PKG_CHECK_MODULES(XORG, xrandr)
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.91.0)
 PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2)
 PKG_CHECK_MODULES(X11, x11)
-PKG_CHECK_MODULES(COLORD, colord >= 0.1.9)
+PKG_CHECK_MODULES(COLORD, colord >= 0.1.12)
 
 dnl **** Check for clutter ****
 AC_ARG_ENABLE(clutter, AS_HELP_STRING([--enable-clutter],[Enable clutter for 3D support]), enable_clutter=$enableval, enable_clutter=yes)
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index 3fbc627..00bafa1 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -417,24 +417,13 @@ out:
 }
 
 static gboolean
-gcm_calib_wait_for_daemon_cb (gpointer user_data)
-{
-	g_main_loop_quit ((GMainLoop *) user_data);
-	return FALSE;
-}
-
-static gboolean
 gcm_calib_start_idle_cb (gpointer user_data)
 {
 	CdProfile *profile = NULL;
 	const gchar *filename;
 	gboolean ret;
-	gchar *destination = NULL;
-	gchar *filename_dest = NULL;
 	GError *error = NULL;
-	GFile *dest = NULL;
 	GFile *file = NULL;
-	GMainLoop *loop;
 	GtkWidget *vbox;
 	GcmCalibratePriv *calib = (GcmCalibratePriv *) user_data;
 	GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
@@ -478,26 +467,10 @@ gcm_calib_start_idle_cb (gpointer user_data)
 
 	/* copy the ICC file to the proper location */
 	file = g_file_new_for_path (filename);
-	dest = gcm_utils_get_profile_destination (file);
-	ret = gcm_utils_mkdir_and_copy (file, dest, &error);
-	if (!ret) {
-		g_warning ("failed to calibrate: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* wait for gnome-settings-daemon to pickup the new file */
-	loop = g_main_loop_new (NULL, FALSE);
-	g_timeout_add_seconds (3, gcm_calib_wait_for_daemon_cb, loop);
-	g_main_loop_run (loop);
-	g_main_loop_unref (loop);
-
-	/* add the new profile as the default */
-	filename_dest = g_file_get_path (dest);
-	profile = cd_client_find_profile_by_filename_sync (calib->client,
-							   filename_dest,
-							   calib->cancellable,
-							   &error);
+	profile = cd_client_import_profile_sync (calib->client,
+						 file,
+						 calib->cancellable,
+						 &error);
 	if (profile == NULL) {
 		g_warning ("failed to find calibration profile: %s",
 			   error->message);
@@ -522,14 +495,10 @@ gcm_calib_start_idle_cb (gpointer user_data)
 	g_unlink (filename);
 
 out:
-	g_free (destination);
-	g_free (filename_dest);
 	if (profile != NULL)
 		g_object_unref (profile);
 	if (file != NULL)
 		g_object_unref (file);
-	if (dest != NULL)
-		g_object_unref (dest);
 	return FALSE;
 }
 



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