Author: post
Date: 2011-03-13 22:38:07 +0100 (Sun, 13 Mar 2011)
New Revision: 3874
Modified:
trunk/librawstudio/rs-profile-factory.c
trunk/librawstudio/rs-profile-factory.h
Log:
Add method to retrieve ICC profile based on filename.
Modified: trunk/librawstudio/rs-profile-factory.c
===================================================================
--- trunk/librawstudio/rs-profile-factory.c 2011-03-13 21:36:41 UTC (rev
3873)
+++ trunk/librawstudio/rs-profile-factory.c 2011-03-13 21:38:07 UTC (rev
3874)
@@ -263,8 +263,7 @@
FACTORY_MODEL_COLUMN_PROFILE, &dcp,
-1);
- /* FIXME: Deal with ICC */
- g_assert(RS_IS_DCP_FILE(dcp));
+ g_assert(RS_IS_ICC_PROFILE(dcp) ||
RS_IS_DCP_FILE(dcp));
ret = g_slist_append (ret, dcp);
}
@@ -291,6 +290,24 @@
return ret;
}
+RSIccProfile *
+rs_profile_factory_find_icc_from_filename(RSProfileFactory *factory, const
gchar *id)
+{
+ RSIccProfile *ret = NULL;
+ g_assert(RS_IS_PROFILE_FACTORY(factory));
+ GSList *profiles = rs_profile_factory_find_from_column(factory, id,
FACTORY_MODEL_COLUMN_ID);
+ gint nprofiles = g_slist_length(profiles);
+
+ if (nprofiles >= 1)
+ {
+ ret = profiles->data;
+ if (nprofiles > 1)
+ g_warning("Found %d profiles when searching for unique
profile: %s. Using the first one.", nprofiles, id);
+ }
+ g_slist_free(profiles);
+ return ret;
+}
+
GSList *
rs_profile_factory_find_from_model(RSProfileFactory *factory, const gchar *id)
{
Modified: trunk/librawstudio/rs-profile-factory.h
===================================================================
--- trunk/librawstudio/rs-profile-factory.h 2011-03-13 21:36:41 UTC (rev
3873)
+++ trunk/librawstudio/rs-profile-factory.h 2011-03-13 21:38:07 UTC (rev
3874)
@@ -67,6 +67,8 @@
RSDcpFile *rs_profile_factory_find_from_id(RSProfileFactory *factory, const
gchar *path);
+RSIccProfile *rs_profile_factory_find_icc_from_filename(RSProfileFactory
*factory, const gchar *path);
+
GSList *rs_profile_factory_find_from_model(RSProfileFactory *factory, const
gchar *id);
void rs_profile_factory_set_embedded_profile(RSProfileFactory *factory, const
RSIccProfile *profile);
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit