[gnome-color-manager] trivial: remove gcm_utils_is_icc_profile() as it's being done by cd_client_import_profile()



commit 473bdad653d6948eccc2d5cc3425d7c0418f377e
Author: Richard Hughes <richard hughsie com>
Date:   Tue Aug 23 20:51:45 2011 +0100

    trivial: remove gcm_utils_is_icc_profile() as it's being done by cd_client_import_profile()

 src/gcm-self-test.c |    6 -----
 src/gcm-utils.c     |   52 ---------------------------------------------------
 src/gcm-utils.h     |    1 -
 src/gcm-viewer.c    |   12 +++-------
 4 files changed, 4 insertions(+), 67 deletions(-)
---
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index 308995e..f4599a9 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -673,7 +673,6 @@ gcm_test_utils_func (void)
 	gboolean ret;
 	gchar *text;
 	gchar *filename;
-	GFile *file;
 	GFile *dest;
 
 	text = gcm_utils_linkify ("http://www.dave.org is text http://www.hughsie.com that needs to be linked to http://www.bbc.co.uk really");
@@ -690,11 +689,6 @@ gcm_test_utils_func (void)
 	g_object_unref (file);
 	g_object_unref (dest);
 
-	file = g_file_new_for_path (TESTDATADIR "/bluish.icc");
-	ret = gcm_utils_is_icc_profile (file);
-	g_assert (ret);
-	g_object_unref (file);
-
 	ret = gcm_utils_output_is_lcd_internal ("LVDS1");
 	g_assert (ret);
 
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 54fb103..ed47a74 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -82,58 +82,6 @@ gcm_utils_linkify (const gchar *hostile_text)
 }
 
 /**
- * gcm_utils_is_icc_profile:
- **/
-gboolean
-gcm_utils_is_icc_profile (GFile *file)
-{
-	GFileInfo *info;
-	const gchar *type;
-	GError *error = NULL;
-	gboolean ret = FALSE;
-	gchar *filename = NULL;
-
-	/* get content type for file */
-	filename = g_file_get_uri (file);
-	if (filename == NULL)
-		filename = g_file_get_path (file);
-	info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, &error);
-	if (info != NULL) {
-		type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
-		if (g_strcmp0 (type, "application/vnd.iccprofile") == 0) {
-			ret = TRUE;
-			goto out;
-		}
-	} else {
-		g_warning ("failed to get content type of %s: %s", filename, error->message);
-		g_error_free (error);
-	}
-
-	/* fall back if we have not got a new enought s-m-i */
-	if (g_str_has_suffix (filename, ".icc")) {
-		ret = TRUE;
-		goto out;
-	}
-	if (g_str_has_suffix (filename, ".icm")) {
-		ret = TRUE;
-		goto out;
-	}
-	if (g_str_has_suffix (filename, ".ICC")) {
-		ret = TRUE;
-		goto out;
-	}
-	if (g_str_has_suffix (filename, ".ICM")) {
-		ret = TRUE;
-		goto out;
-	}
-out:
-	if (info != NULL)
-		g_object_unref (info);
-	g_free (filename);
-	return ret;
-}
-
-/**
  * gcm_utils_install_package:
  **/
 gboolean
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index e94a3be..6cbadd3 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -50,7 +50,6 @@ void		 gcm_utils_ensure_sensible_filename	(gchar			*string);
 CdProfileKind	 gcm_utils_device_kind_to_profile_kind	(CdDeviceKind		 kind);
 gboolean	 gcm_utils_install_package		(const gchar		*package_name,
 							 GtkWindow		*window);
-gboolean	 gcm_utils_is_icc_profile		(GFile			*file);
 gchar		*gcm_utils_linkify			(const gchar		*text);
 const gchar	*cd_rendering_intent_to_localized_text		(CdRenderingIntent	 intent);
 const gchar	*cd_rendering_intent_to_localized_description	(CdRenderingIntent	 intent);
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index fe010e7..f1dcc9a 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -396,17 +396,10 @@ gcm_viewer_file_chooser_get_icc_profile (GcmViewerPrivate *viewer)
 static gboolean
 gcm_viewer_profile_import_file (GcmViewerPrivate *viewer, GFile *file)
 {
-	gboolean ret;
+	gboolean ret = FALSE;
 	GError *error = NULL;
 	CdProfile *profile_tmp = NULL;
 
-	/* check if correct type */
-	ret = gcm_utils_is_icc_profile (file);
-	if (!ret) {
-		g_debug ("not a ICC profile");
-		goto out;
-	}
-
 	/* copy icc file to users profile path */
 	profile_tmp = cd_client_import_profile_sync (viewer->client,
 						     file, NULL, &error);
@@ -416,6 +409,9 @@ gcm_viewer_profile_import_file (GcmViewerPrivate *viewer, GFile *file)
 		g_error_free (error);
 		goto out;
 	}
+
+	/* success */
+	ret = TRUE;
 out:
 	if (profile_tmp != NULL)
 		g_object_unref (profile_tmp);



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