diff options
author | Richard Hughes <richard@hughsie.com> | 2013-03-25 21:44:53 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2013-03-25 21:44:53 +0000 |
commit | 0d8bc48863711974379f362a948313c26985f68f (patch) | |
tree | abffea55a7093054b1c30399da02d683aec354be /lib | |
parent | 3b3cf5401aa428e6a2e9ba4a561192390b4bf3b6 (diff) | |
download | colord-0d8bc48863711974379f362a948313c26985f68f.tar.gz |
libcolord: Add the ability to get a CdIcc instance from a CdProfile abstract object
Diffstat (limited to 'lib')
-rw-r--r-- | lib/colord/cd-profile.c | 41 | ||||
-rw-r--r-- | lib/colord/cd-profile.h | 5 |
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/colord/cd-profile.c b/lib/colord/cd-profile.c index 0b5071b..2242748 100644 --- a/lib/colord/cd-profile.c +++ b/lib/colord/cd-profile.c @@ -1148,6 +1148,47 @@ cd_profile_equal (CdProfile *profile1, CdProfile *profile2) return g_strcmp0 (profile1->priv->id, profile2->priv->id) == 0; } +/** + * cd_profile_load_icc: + * @profile: a #CdProfile instance. + * @flags: options for loading the profile + * @cancellable: A #GCancellable, or %NULL + * @error: A #GError or %NULL + * + * Loads a local ICC object from the abstract profile. + * + * Return value: (transfer full): A new #CdIcc object, or %NULL for error + * + * Since: 0.1.8 + **/ +CdIcc * +cd_profile_load_icc (CdProfile *profile, + CdIccLoadFlags flags, + GCancellable *cancellable, + GError **error) +{ + CdIcc *icc = NULL; + CdIcc *icc_tmp; + gboolean ret; + GFile *file; + + g_return_val_if_fail (CD_IS_PROFILE (profile), NULL); + + /* load local instance */ + icc_tmp = cd_icc_new (); + file = g_file_new_for_path (profile->priv->filename); + ret = cd_icc_load_file (icc_tmp, file, flags, cancellable, error); + if (!ret) + goto out; + + /* success */ + icc = g_object_ref (icc_tmp); +out: + g_object_unref (file); + g_object_unref (icc_tmp); + return icc; +} + /* * _cd_profile_set_property: */ diff --git a/lib/colord/cd-profile.h b/lib/colord/cd-profile.h index 2761b48..eb1ec48 100644 --- a/lib/colord/cd-profile.h +++ b/lib/colord/cd-profile.h @@ -30,6 +30,7 @@ #include <gio/gio.h> #include "cd-enum.h" +#include "cd-icc.h" G_BEGIN_DECLS @@ -124,6 +125,10 @@ gchar *cd_profile_to_string (CdProfile *profile); gboolean cd_profile_equal (CdProfile *profile1, CdProfile *profile2); gboolean cd_profile_has_access (CdProfile *profile); +CdIcc *cd_profile_load_icc (CdProfile *profile, + CdIccLoadFlags flags, + GCancellable *cancellable, + GError **error); G_END_DECLS |