From c0f7ed73692fa6b522e52eeac6d7431e620871d2 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 21 May 2014 10:03:47 +0100 Subject: Allow users to rename session and system ICC profiles This does not actually modify the ICC for several reasons: * This may be a system profile that other users may have set up mappings from * Changing the ID or the MD5 of well-known profiles may break other applications * Different users may want more or less technical descriptions * We only get a readonly mapped file when creating profiles from the session ...so instead use the existing storage.db sqlite database to define per-uid overrides for the 'Title' property. Users can 'modify' the title shown in applications using colord by calling something like this: $ colormgr profile-set-property icc-c2d76 Title 'Sony TV' For applications using lcms2 directly to parse the file, the original description will be shown. Additionally, there is no authentication step for setting an overriden title on the profile, as it is only shown for that one specific user. Titles can only be between 3 and 4096 chars in length and also have to be valid UTF-8 strings. --- lib/colord/cd-enum.c | 6 +++++- lib/colord/cd-enum.h | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/colord/cd-enum.c b/lib/colord/cd-enum.c index 934b87e..d098470 100644 --- a/lib/colord/cd-enum.c +++ b/lib/colord/cd-enum.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * - * Copyright (C) 2010-2013 Richard Hughes + * Copyright (C) 2010-2014 Richard Hughes * * Licensed under the GNU Lesser General Public License Version 2.1 * @@ -724,6 +724,8 @@ cd_profile_error_to_string (CdProfileError error_enum) return CD_DBUS_INTERFACE_PROFILE ".FailedToAuthenticate"; if (error_enum == CD_PROFILE_ERROR_PROPERTY_INVALID) return CD_DBUS_INTERFACE_PROFILE ".PropertyInvalid"; + if (error_enum == CD_PROFILE_ERROR_FAILED_TO_GET_UID) + return CD_DBUS_INTERFACE_PROFILE ".FailedToGetUid"; return NULL; } @@ -753,6 +755,8 @@ cd_profile_error_from_string (const gchar *error_desc) return CD_PROFILE_ERROR_FAILED_TO_AUTHENTICATE; if (g_strcmp0 (error_desc, CD_DBUS_INTERFACE_PROFILE ".PropertyInvalid") == 0) return CD_PROFILE_ERROR_PROPERTY_INVALID; + if (g_strcmp0 (error_desc, CD_DBUS_INTERFACE_PROFILE ".FailedToGetUid") == 0) + return CD_PROFILE_ERROR_FAILED_TO_GET_UID; return CD_PROFILE_ERROR_LAST; } diff --git a/lib/colord/cd-enum.h b/lib/colord/cd-enum.h index c4d3b26..2a942b2 100644 --- a/lib/colord/cd-enum.h +++ b/lib/colord/cd-enum.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * - * Copyright (C) 2010-2013 Richard Hughes + * Copyright (C) 2010-2014 Richard Hughes * * Licensed under the GNU Lesser General Public License Version 2.1 * @@ -340,6 +340,7 @@ typedef enum { * @CD_PROFILE_ERROR_FAILED_TO_READ: The profile could not be read * @CD_PROFILE_ERROR_FAILED_TO_AUTHENTICATE: Authentication failed * @CD_PROFILE_ERROR_PROPERTY_INVALID: One or more of the properties was invalid + * @CD_PROFILE_ERROR_FAILED_TO_GET_UID: Failed to get UID for sender * * Errors that can be thrown */ @@ -352,6 +353,7 @@ typedef enum CD_PROFILE_ERROR_FAILED_TO_READ, /* Since: 0.1.26 */ CD_PROFILE_ERROR_FAILED_TO_AUTHENTICATE, /* Since: 0.1.26 */ CD_PROFILE_ERROR_PROPERTY_INVALID, /* Since: 0.1.31 */ + CD_PROFILE_ERROR_FAILED_TO_GET_UID, /* Since: 1.2.1 */ /*< private >*/ CD_PROFILE_ERROR_LAST } CdProfileError; -- cgit v1.2.1