~ubuntu-branches/ubuntu/vivid/gnome-color-manager/vivid

« back to all changes in this revision

Viewing changes to src/gcm-enum.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Moya, Rodrigo Moya, Martin Pitt
  • Date: 2011-08-19 16:23:48 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110819162348-p0unefdt677j5ttj
Tags: 3.1.2-0ubuntu1
[ Rodrigo Moya ]
* New upstream release.
* debian/control:
  - Use GTK3 version build dependencies
* debian/rules:
  - Add autoreconf to the rules
* debian/patches/02-fix_build.patch:
  - Add upstream patch to fix build

[ Martin Pitt ]
* Drop 01-libnotify_0.7.patch, obsolete with new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2
 
 *
3
 
 * Copyright (C) 2009-2010 Richard Hughes <richard@hughsie.com>
4
 
 *
5
 
 * Licensed under the GNU General Public License Version 2
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or modify
8
 
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; either version 2 of the License, or
10
 
 * (at your option) any later version.
11
 
 *
12
 
 * This program is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
 
 */
21
 
 
22
 
#include "config.h"
23
 
 
24
 
#include <glib/gi18n.h>
25
 
 
26
 
#include "gcm-enum.h"
27
 
 
28
 
/**
29
 
 * gcm_intent_to_string:
30
 
 **/
31
 
const gchar *
32
 
gcm_intent_to_string (GcmIntent intent)
33
 
{
34
 
        if (intent == GCM_INTENT_PERCEPTUAL)
35
 
                return "perceptual";
36
 
        if (intent == GCM_INTENT_RELATIVE_COLORMETRIC)
37
 
                return "relative-colormetric";
38
 
        if (intent == GCM_INTENT_SATURATION)
39
 
                return "saturation";
40
 
        if (intent == GCM_INTENT_ABSOLUTE_COLORMETRIC)
41
 
                return "absolute-colormetric";
42
 
        return "unknown";
43
 
}
44
 
 
45
 
/**
46
 
 * gcm_intent_from_string:
47
 
 **/
48
 
GcmIntent
49
 
gcm_intent_from_string (const gchar *intent)
50
 
{
51
 
        if (g_strcmp0 (intent, "perceptual") == 0)
52
 
                return GCM_INTENT_PERCEPTUAL;
53
 
        if (g_strcmp0 (intent, "relative-colormetric") == 0)
54
 
                return GCM_INTENT_RELATIVE_COLORMETRIC;
55
 
        if (g_strcmp0 (intent, "saturation") == 0)
56
 
                return GCM_INTENT_SATURATION;
57
 
        if (g_strcmp0 (intent, "absolute-colormetric") == 0)
58
 
                return GCM_INTENT_ABSOLUTE_COLORMETRIC;
59
 
        return GCM_INTENT_UNKNOWN;
60
 
}
61
 
 
62
 
/**
63
 
 * gcm_profile_kind_to_string:
64
 
 **/
65
 
const gchar *
66
 
gcm_profile_kind_to_string (GcmProfileKind kind)
67
 
{
68
 
        if (kind == GCM_PROFILE_KIND_INPUT_DEVICE)
69
 
                return "input-device";
70
 
        if (kind == GCM_PROFILE_KIND_DISPLAY_DEVICE)
71
 
                return "display-device";
72
 
        if (kind == GCM_PROFILE_KIND_OUTPUT_DEVICE)
73
 
                return "output-device";
74
 
        if (kind == GCM_PROFILE_KIND_DEVICELINK)
75
 
                return "devicelink";
76
 
        if (kind == GCM_PROFILE_KIND_COLORSPACE_CONVERSION)
77
 
                return "colorspace-conversion";
78
 
        if (kind == GCM_PROFILE_KIND_ABSTRACT)
79
 
                return "abstract";
80
 
        if (kind == GCM_PROFILE_KIND_NAMED_COLOR)
81
 
                return "named-color";
82
 
        return "unknown";
83
 
}
84
 
 
85
 
/**
86
 
 * gcm_colorspace_to_string:
87
 
 **/
88
 
const gchar *
89
 
gcm_colorspace_to_string (GcmColorspace colorspace)
90
 
{
91
 
        if (colorspace == GCM_COLORSPACE_XYZ)
92
 
                return "xyz";
93
 
        if (colorspace == GCM_COLORSPACE_LAB)
94
 
                return "lab";
95
 
        if (colorspace == GCM_COLORSPACE_LUV)
96
 
                return "luv";
97
 
        if (colorspace == GCM_COLORSPACE_YCBCR)
98
 
                return "ycbcr";
99
 
        if (colorspace == GCM_COLORSPACE_YXY)
100
 
                return "yxy";
101
 
        if (colorspace == GCM_COLORSPACE_RGB)
102
 
                return "rgb";
103
 
        if (colorspace == GCM_COLORSPACE_GRAY)
104
 
                return "gray";
105
 
        if (colorspace == GCM_COLORSPACE_HSV)
106
 
                return "hsv";
107
 
        if (colorspace == GCM_COLORSPACE_CMYK)
108
 
                return "cmyk";
109
 
        if (colorspace == GCM_COLORSPACE_CMY)
110
 
                return "cmy";
111
 
        return "unknown";
112
 
}
113
 
 
114
 
/**
115
 
 * gcm_colorspace_from_string:
116
 
 **/
117
 
GcmColorspace
118
 
gcm_colorspace_from_string (const gchar *colorspace)
119
 
{
120
 
        if (g_strcmp0 (colorspace, "xyz") == 0)
121
 
                return GCM_COLORSPACE_XYZ;
122
 
        if (g_strcmp0 (colorspace, "lab") == 0)
123
 
                return GCM_COLORSPACE_LAB;
124
 
        if (g_strcmp0 (colorspace, "luv") == 0)
125
 
                return GCM_COLORSPACE_LUV;
126
 
        if (g_strcmp0 (colorspace, "ycbcr") == 0)
127
 
                return GCM_COLORSPACE_YCBCR;
128
 
        if (g_strcmp0 (colorspace, "yxy") == 0)
129
 
                return GCM_COLORSPACE_YXY;
130
 
        if (g_strcmp0 (colorspace, "rgb") == 0)
131
 
                return GCM_COLORSPACE_RGB;
132
 
        if (g_strcmp0 (colorspace, "gray") == 0)
133
 
                return GCM_COLORSPACE_GRAY;
134
 
        if (g_strcmp0 (colorspace, "hsv") == 0)
135
 
                return GCM_COLORSPACE_HSV;
136
 
        if (g_strcmp0 (colorspace, "cmyk") == 0)
137
 
                return GCM_COLORSPACE_CMYK;
138
 
        if (g_strcmp0 (colorspace, "cmy") == 0)
139
 
                return GCM_COLORSPACE_CMY;
140
 
        return GCM_COLORSPACE_UNKNOWN;
141
 
}
142