[gnome-color-manager] trivial: put all the enumerated values in to a common namespace and file
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: put all the enumerated values in to a common namespace and file
- Date: Tue, 12 Jan 2010 12:27:05 +0000 (UTC)
commit 228aa464363685bce456e01599ab45b4b63de6c3
Author: Richard Hughes <richard hughsie com>
Date: Tue Jan 12 12:18:19 2010 +0000
trivial: put all the enumerated values in to a common namespace and file
src/Makefile.am | 2 +
src/gcm-apply.c | 4 +-
src/gcm-brightness.c | 4 -
src/gcm-client.c | 10 ++--
src/gcm-dbus.c | 10 ++--
src/gcm-device.c | 48 +++++++-------
src/gcm-device.h | 11 ---
src/gcm-dump-profile.c | 5 +-
src/gcm-enum.c | 113 ++++++++++++++++++++++++++++++
src/gcm-enum.h | 80 ++++++++++++++++++++++
src/gcm-inspect.c | 6 +-
src/gcm-prefs.c | 174 +++++++++++++++++++++++-----------------------
src/gcm-profile-lcms1.c | 46 ++++++------
src/gcm-profile.c | 72 +++-----------------
src/gcm-profile.h | 29 --------
src/gcm-utils.c | 84 +++++++----------------
src/gcm-utils.h | 18 +----
17 files changed, 385 insertions(+), 331 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index cb1a440..0ee2838 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,8 @@ libgcmshared_a_SOURCES = \
gcm-xyz.h \
gcm-utils.c \
gcm-utils.h \
+ gcm-enum.c \
+ gcm-enum.h \
gcm-clut.c \
gcm-clut.h \
gcm-edid.c \
diff --git a/src/gcm-apply.c b/src/gcm-apply.c
index 937e0f2..5c20ecb 100644
--- a/src/gcm-apply.c
+++ b/src/gcm-apply.c
@@ -45,7 +45,7 @@ main (int argc, char **argv)
guint i;
GcmClient *client = NULL;
GcmDevice *device;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
setlocale (LC_ALL, "");
@@ -79,7 +79,7 @@ main (int argc, char **argv)
NULL);
/* not a xrandr panel */
- if (type != GCM_DEVICE_TYPE_DISPLAY)
+ if (type != GCM_DEVICE_TYPE_ENUM_DISPLAY)
continue;
/* set gamma for device */
diff --git a/src/gcm-brightness.c b/src/gcm-brightness.c
index e23a50c..ffeffb1 100644
--- a/src/gcm-brightness.c
+++ b/src/gcm-brightness.c
@@ -29,10 +29,6 @@
#include "config.h"
#include <glib-object.h>
-//#include <math.h>
-//#include <string.h>
-//#include <gio/gio.h>
-//#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include "gcm-brightness.h"
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 99e7d95..c99de74 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -185,7 +185,7 @@ out:
* gcm_client_gudev_add_type:
**/
static void
-gcm_client_gudev_add_type (GcmClient *client, GUdevDevice *udev_device, GcmDeviceType type)
+gcm_client_gudev_add_type (GcmClient *client, GUdevDevice *udev_device, GcmDeviceTypeEnum type)
{
gchar *title;
GcmDevice *device = NULL;
@@ -292,7 +292,7 @@ gcm_client_gudev_add (GcmClient *client, GUdevDevice *udev_device)
if (value != NULL) {
value = g_udev_device_get_property (udev_device, "GCM_TYPE");
egg_debug ("found %s device: %s", value, g_udev_device_get_sysfs_path (udev_device));
- gcm_client_gudev_add_type (client, udev_device, gcm_device_type_from_text (value));
+ gcm_client_gudev_add_type (client, udev_device, gcm_device_type_enum_from_string (value));
}
}
@@ -708,7 +708,7 @@ gcm_client_xrandr_add (GcmClient *client, GnomeRROutput *output)
device = gcm_device_new ();
title = gcm_client_get_output_name (client, output);
g_object_set (device,
- "type", GCM_DEVICE_TYPE_DISPLAY,
+ "type", GCM_DEVICE_TYPE_ENUM_DISPLAY,
"id", id,
"connected", TRUE,
"serial", serial,
@@ -783,7 +783,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
{
gchar *title;
gchar *type_text = NULL;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
GcmDevice *device = NULL;
gboolean ret;
GError *error = NULL;
@@ -794,7 +794,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
if (title == NULL)
goto out;
type_text = g_key_file_get_string (keyfile, id, "type", NULL);
- type = gcm_device_type_from_text (type_text);
+ type = gcm_device_type_enum_from_string (type_text);
/* create device */
device = gcm_device_new ();
diff --git a/src/gcm-dbus.c b/src/gcm-dbus.c
index a8f0dd9..c863918 100644
--- a/src/gcm-dbus.c
+++ b/src/gcm-dbus.c
@@ -224,12 +224,12 @@ gcm_dbus_get_profiles_for_device_internal (GcmDbus *dbus, const gchar *sysfs_pat
* gcm_dbus_get_profiles_for_type_internal:
**/
static GPtrArray *
-gcm_dbus_get_profiles_for_type_internal (GcmDbus *dbus, GcmDeviceType type)
+gcm_dbus_get_profiles_for_type_internal (GcmDbus *dbus, GcmDeviceTypeEnum type)
{
guint i;
GcmProfile *profile;
- GcmProfileType profile_type;
- GcmProfileType type_tmp;
+ GcmProfileTypeEnum profile_type;
+ GcmProfileTypeEnum type_tmp;
GPtrArray *array;
GPtrArray *profile_array;
@@ -322,12 +322,12 @@ gcm_dbus_get_profiles_for_type (GcmDbus *dbus, const gchar *type, const gchar *o
guint i;
GPtrArray *array_structs;
GValue *value;
- GcmDeviceType type_enum;
+ GcmDeviceTypeEnum type_enum;
egg_debug ("getting profiles for %s", type);
/* get array of profile filenames */
- type_enum = gcm_device_type_from_text (type);
+ type_enum = gcm_device_type_enum_from_string (type);
array_profiles = gcm_dbus_get_profiles_for_type_internal (dbus, type_enum);
/* copy data to dbus struct */
diff --git a/src/gcm-device.c b/src/gcm-device.c
index 071ef6f..cd0c680 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -56,7 +56,7 @@ struct _GcmDevicePrivate
gfloat gamma;
gfloat brightness;
gfloat contrast;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
gchar *id;
gchar *serial;
gchar *manufacturer;
@@ -90,35 +90,35 @@ enum {
G_DEFINE_TYPE (GcmDevice, gcm_device, G_TYPE_OBJECT)
/**
- * gcm_device_type_from_text:
+ * gcm_device_type_enum_from_string:
**/
-GcmDeviceType
-gcm_device_type_from_text (const gchar *type)
+GcmDeviceTypeEnum
+gcm_device_type_enum_from_string (const gchar *type)
{
if (g_strcmp0 (type, "display") == 0)
- return GCM_DEVICE_TYPE_DISPLAY;
+ return GCM_DEVICE_TYPE_ENUM_DISPLAY;
if (g_strcmp0 (type, "scanner") == 0)
- return GCM_DEVICE_TYPE_SCANNER;
+ return GCM_DEVICE_TYPE_ENUM_SCANNER;
if (g_strcmp0 (type, "printer") == 0)
- return GCM_DEVICE_TYPE_PRINTER;
+ return GCM_DEVICE_TYPE_ENUM_PRINTER;
if (g_strcmp0 (type, "camera") == 0)
- return GCM_DEVICE_TYPE_CAMERA;
- return GCM_DEVICE_TYPE_UNKNOWN;
+ return GCM_DEVICE_TYPE_ENUM_CAMERA;
+ return GCM_DEVICE_TYPE_ENUM_UNKNOWN;
}
/**
- * gcm_device_type_to_text:
+ * gcm_device_type_enum_to_string:
**/
const gchar *
-gcm_device_type_to_text (GcmDeviceType type)
+gcm_device_type_enum_to_string (GcmDeviceTypeEnum type)
{
- if (type == GCM_DEVICE_TYPE_DISPLAY)
+ if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY)
return "display";
- if (type == GCM_DEVICE_TYPE_SCANNER)
+ if (type == GCM_DEVICE_TYPE_ENUM_SCANNER)
return "scanner";
- if (type == GCM_DEVICE_TYPE_PRINTER)
+ if (type == GCM_DEVICE_TYPE_ENUM_PRINTER)
return "printer";
- if (type == GCM_DEVICE_TYPE_CAMERA)
+ if (type == GCM_DEVICE_TYPE_ENUM_CAMERA)
return "camera";
return "unknown";
}
@@ -363,7 +363,7 @@ gcm_device_save (GcmDevice *device, GError **error)
/* save other properties we'll need if we add this device offline */
if (device->priv->title != NULL)
g_key_file_set_string (keyfile, device->priv->id, "title", device->priv->title);
- g_key_file_set_string (keyfile, device->priv->id, "type", gcm_device_type_to_text (device->priv->type));
+ g_key_file_set_string (keyfile, device->priv->id, "type", gcm_device_type_enum_to_string (device->priv->type));
/* convert to string */
data = g_key_file_to_data (keyfile, NULL, &error_local);
@@ -729,7 +729,7 @@ gcm_device_test (EggTest *test)
gchar *profile;
gchar *data;
const gchar *type;
- GcmDeviceType type_enum;
+ GcmDeviceTypeEnum type_enum;
if (!egg_test_start (test, "GcmDevice"))
return;
@@ -741,17 +741,17 @@ gcm_device_test (EggTest *test)
/************************************************************/
egg_test_title (test, "convert to recognised enum");
- type_enum = gcm_device_type_from_text ("scanner");
- egg_test_assert (test, (type_enum == GCM_DEVICE_TYPE_SCANNER));
+ type_enum = gcm_device_type_enum_from_string ("scanner");
+ egg_test_assert (test, (type_enum == GCM_DEVICE_TYPE_ENUM_SCANNER));
/************************************************************/
egg_test_title (test, "convert to unrecognised enum");
- type_enum = gcm_device_type_from_text ("xxx");
- egg_test_assert (test, (type_enum == GCM_DEVICE_TYPE_UNKNOWN));
+ type_enum = gcm_device_type_enum_from_string ("xxx");
+ egg_test_assert (test, (type_enum == GCM_DEVICE_TYPE_ENUM_UNKNOWN));
/************************************************************/
egg_test_title (test, "convert from recognised enum");
- type = gcm_device_type_to_text (GCM_DEVICE_TYPE_SCANNER);
+ type = gcm_device_type_enum_to_string (GCM_DEVICE_TYPE_ENUM_SCANNER);
if (g_strcmp0 (type, "scanner") == 0)
egg_test_success (test, NULL);
else
@@ -759,7 +759,7 @@ gcm_device_test (EggTest *test)
/************************************************************/
egg_test_title (test, "convert from unrecognised enum");
- type = gcm_device_type_to_text (GCM_DEVICE_TYPE_UNKNOWN);
+ type = gcm_device_type_enum_to_string (GCM_DEVICE_TYPE_ENUM_UNKNOWN);
if (g_strcmp0 (type, "unknown") == 0)
egg_test_success (test, NULL);
else
@@ -767,7 +767,7 @@ gcm_device_test (EggTest *test)
/* set some properties */
g_object_set (device,
- "type", GCM_DEVICE_TYPE_SCANNER,
+ "type", GCM_DEVICE_TYPE_ENUM_SCANNER,
"id", "sysfs_dummy_device",
"connected", TRUE,
"serial", "0123456789",
diff --git a/src/gcm-device.h b/src/gcm-device.h
index 22ce30a..33252a3 100644
--- a/src/gcm-device.h
+++ b/src/gcm-device.h
@@ -54,15 +54,6 @@ struct _GcmDeviceClass
void (*_gcm_reserved5) (void);
};
-typedef enum {
- GCM_DEVICE_TYPE_UNKNOWN,
- GCM_DEVICE_TYPE_DISPLAY,
- GCM_DEVICE_TYPE_SCANNER,
- GCM_DEVICE_TYPE_PRINTER,
- GCM_DEVICE_TYPE_CAMERA,
- GCM_DEVICE_TYPE_LAST
-} GcmDeviceType;
-
GType gcm_device_get_type (void);
GcmDevice *gcm_device_new (void);
const gchar *gcm_device_get_id (GcmDevice *device);
@@ -70,8 +61,6 @@ gboolean gcm_device_load (GcmDevice *device,
GError **error);
gboolean gcm_device_save (GcmDevice *device,
GError **error);
-GcmDeviceType gcm_device_type_from_text (const gchar *type);
-const gchar *gcm_device_type_to_text (GcmDeviceType type);
G_END_DECLS
diff --git a/src/gcm-dump-profile.c b/src/gcm-dump-profile.c
index c365d64..e948cf8 100644
--- a/src/gcm-dump-profile.c
+++ b/src/gcm-dump-profile.c
@@ -27,6 +27,7 @@
#include "egg-debug.h"
+#include "gcm-enum.h"
#include "gcm-profile.h"
/**
@@ -71,8 +72,8 @@ gcm_dump_profile_filename (const gchar *filename)
NULL);
/* print what we know */
- g_print ("Type:\t%s\n", gcm_profile_type_to_text (profile_type));
- g_print ("Colorspace:\t%s\n", gcm_profile_colorspace_to_text (colorspace));
+ g_print ("Type:\t%s\n", gcm_profile_type_enum_to_string (profile_type));
+ g_print ("Colorspace:\t%s\n", gcm_colorspace_enum_to_string (colorspace));
g_print ("Size:\t%i bytes\n", size);
g_print ("Has VCGT:\t%s\n", has_vcgt ? "Yes" : "No");
if (description != NULL)
diff --git a/src/gcm-enum.c b/src/gcm-enum.c
new file mode 100644
index 0000000..9a3478c
--- /dev/null
+++ b/src/gcm-enum.c
@@ -0,0 +1,113 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more utils.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "gcm-enum.h"
+
+/**
+ * gcm_intent_enum_to_string:
+ **/
+const gchar *
+gcm_intent_enum_to_string (GcmIntentEnum intent)
+{
+ if (intent == GCM_INTENT_ENUM_PERCEPTUAL)
+ return "perceptual";
+ if (intent == GCM_INTENT_ENUM_RELATIVE_COLORMETRIC)
+ return "relative-colormetric";
+ if (intent == GCM_INTENT_ENUM_SATURATION)
+ return "saturation";
+ if (intent == GCM_INTENT_ENUM_ABSOLUTE_COLORMETRIC)
+ return "absolute-colormetric";
+ return "unknown";
+}
+
+/**
+ * gcm_intent_enum_from_string:
+ **/
+GcmIntentEnum
+gcm_intent_enum_from_string (const gchar *intent)
+{
+ if (g_strcmp0 (intent, "perceptual") == 0)
+ return GCM_INTENT_ENUM_PERCEPTUAL;
+ if (g_strcmp0 (intent, "relative-colormetric") == 0)
+ return GCM_INTENT_ENUM_RELATIVE_COLORMETRIC;
+ if (g_strcmp0 (intent, "saturation") == 0)
+ return GCM_INTENT_ENUM_SATURATION;
+ if (g_strcmp0 (intent, "absolute-colormetric") == 0)
+ return GCM_INTENT_ENUM_ABSOLUTE_COLORMETRIC;
+ return GCM_INTENT_ENUM_UNKNOWN;
+}
+
+/**
+ * gcm_profile_type_enum_to_string:
+ **/
+const gchar *
+gcm_profile_type_enum_to_string (GcmProfileTypeEnum type)
+{
+ if (type == GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE)
+ return "input-device";
+ if (type == GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE)
+ return "display-device";
+ if (type == GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE)
+ return "output-device";
+ if (type == GCM_PROFILE_TYPE_ENUM_DEVICELINK)
+ return "devicelink";
+ if (type == GCM_PROFILE_TYPE_ENUM_COLORSPACE_CONVERSION)
+ return "colorspace-conversion";
+ if (type == GCM_PROFILE_TYPE_ENUM_ABSTRACT)
+ return "abstract";
+ if (type == GCM_PROFILE_TYPE_ENUM_NAMED_COLOR)
+ return "named-color";
+ return "unknown";
+}
+
+/**
+ * gcm_colorspace_enum_to_string:
+ **/
+const gchar *
+gcm_colorspace_enum_to_string (GcmColorspaceEnum type)
+{
+ if (type == GCM_COLORSPACE_ENUM_XYZ)
+ return "xyz";
+ if (type == GCM_COLORSPACE_ENUM_LAB)
+ return "lab";
+ if (type == GCM_COLORSPACE_ENUM_LUV)
+ return "luv";
+ if (type == GCM_COLORSPACE_ENUM_YCBCR)
+ return "ycbcr";
+ if (type == GCM_COLORSPACE_ENUM_YXY)
+ return "yxy";
+ if (type == GCM_COLORSPACE_ENUM_RGB)
+ return "rgb";
+ if (type == GCM_COLORSPACE_ENUM_GRAY)
+ return "gray";
+ if (type == GCM_COLORSPACE_ENUM_HSV)
+ return "hsv";
+ if (type == GCM_COLORSPACE_ENUM_CMYK)
+ return "cmyk";
+ if (type == GCM_COLORSPACE_ENUM_CMY)
+ return "cmy";
+ return "unknown";
+}
+
diff --git a/src/gcm-enum.h b/src/gcm-enum.h
new file mode 100644
index 0000000..3533224
--- /dev/null
+++ b/src/gcm-enum.h
@@ -0,0 +1,80 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009-2010 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more utils.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GCM_ENUM_H
+#define __GCM_ENUM_H
+
+#include <glib/gi18n.h>
+
+typedef enum {
+ GCM_INTENT_ENUM_UNKNOWN,
+ GCM_INTENT_ENUM_PERCEPTUAL,
+ GCM_INTENT_ENUM_RELATIVE_COLORMETRIC,
+ GCM_INTENT_ENUM_SATURATION,
+ GCM_INTENT_ENUM_ABSOLUTE_COLORMETRIC,
+ GCM_INTENT_ENUM_LAST
+} GcmIntentEnum;
+
+typedef enum {
+ GCM_PROFILE_TYPE_ENUM_UNKNOWN,
+ GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE,
+ GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE,
+ GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE,
+ GCM_PROFILE_TYPE_ENUM_DEVICELINK,
+ GCM_PROFILE_TYPE_ENUM_COLORSPACE_CONVERSION,
+ GCM_PROFILE_TYPE_ENUM_ABSTRACT,
+ GCM_PROFILE_TYPE_ENUM_NAMED_COLOR,
+ GCM_PROFILE_TYPE_ENUM_LAST
+} GcmProfileTypeEnum;
+
+typedef enum {
+ GCM_COLORSPACE_ENUM_UNKNOWN,
+ GCM_COLORSPACE_ENUM_XYZ,
+ GCM_COLORSPACE_ENUM_LAB,
+ GCM_COLORSPACE_ENUM_LUV,
+ GCM_COLORSPACE_ENUM_YCBCR,
+ GCM_COLORSPACE_ENUM_YXY,
+ GCM_COLORSPACE_ENUM_RGB,
+ GCM_COLORSPACE_ENUM_GRAY,
+ GCM_COLORSPACE_ENUM_HSV,
+ GCM_COLORSPACE_ENUM_CMYK,
+ GCM_COLORSPACE_ENUM_CMY,
+ GCM_COLORSPACE_ENUM_LAST
+} GcmColorspaceEnum;
+
+typedef enum {
+ GCM_DEVICE_TYPE_ENUM_UNKNOWN,
+ GCM_DEVICE_TYPE_ENUM_DISPLAY,
+ GCM_DEVICE_TYPE_ENUM_SCANNER,
+ GCM_DEVICE_TYPE_ENUM_PRINTER,
+ GCM_DEVICE_TYPE_ENUM_CAMERA,
+ GCM_DEVICE_TYPE_ENUM_LAST
+} GcmDeviceTypeEnum;
+
+GcmIntentEnum gcm_intent_enum_from_string (const gchar *intent);
+const gchar *gcm_intent_enum_to_string (GcmIntentEnum intent);
+const gchar *gcm_profile_type_enum_to_string (GcmProfileTypeEnum profile_type);
+const gchar *gcm_colorspace_enum_to_string (GcmColorspaceEnum colorspace);
+GcmDeviceTypeEnum gcm_device_type_enum_from_string (const gchar *type);
+const gchar *gcm_device_type_enum_to_string (GcmDeviceTypeEnum type);
+
+#endif /* __GCM_ENUM_H */
+
diff --git a/src/gcm-inspect.c b/src/gcm-inspect.c
index 333d2c6..fad9700 100644
--- a/src/gcm-inspect.c
+++ b/src/gcm-inspect.c
@@ -447,7 +447,7 @@ main (int argc, char **argv)
guint xid = 0;
gchar *sysfs_path = NULL;
gchar *type = NULL;
- GcmDeviceType type_enum;
+ GcmDeviceTypeEnum type_enum;
guint retval = 0;
GOptionContext *context;
@@ -493,8 +493,8 @@ main (int argc, char **argv)
if (xid != 0)
gcm_inspect_show_profile_for_window (xid);
if (type != NULL) {
- type_enum = gcm_device_type_from_text (type);
- if (type_enum == GCM_DEVICE_TYPE_UNKNOWN) {
+ type_enum = gcm_device_type_enum_from_string (type);
+ if (type_enum == GCM_DEVICE_TYPE_ENUM_UNKNOWN) {
/* TRANSLATORS: this is when the user does --type=mickeymouse */
g_print ("%s\n", _("Device type not recognized"));
} else {
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index b77ce76..5422e05 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -177,7 +177,7 @@ gcm_prefs_default_cb (GtkWidget *widget, gpointer data)
{
GPtrArray *array = NULL;
GcmDevice *device;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
gboolean ret;
guint i;
@@ -190,7 +190,7 @@ gcm_prefs_default_cb (GtkWidget *widget, gpointer data)
NULL);
/* not a xrandr panel */
- if (type != GCM_DEVICE_TYPE_DISPLAY)
+ if (type != GCM_DEVICE_TYPE_ENUM_DISPLAY)
continue;
/* set for this device */
@@ -643,15 +643,15 @@ out:
* gcm_prefs_profile_type_to_icon_name:
**/
static const gchar *
-gcm_prefs_profile_type_to_icon_name (GcmProfileType type)
+gcm_prefs_profile_type_to_icon_name (GcmProfileTypeEnum type)
{
- if (type == GCM_PROFILE_TYPE_DISPLAY_DEVICE)
+ if (type == GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE)
return "video-display";
- if (type == GCM_PROFILE_TYPE_INPUT_DEVICE)
+ if (type == GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE)
return "scanner";
- if (type == GCM_PROFILE_TYPE_OUTPUT_DEVICE)
+ if (type == GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE)
return "printer";
- if (type == GCM_PROFILE_TYPE_COLORSPACE_CONVERSION)
+ if (type == GCM_PROFILE_TYPE_ENUM_COLORSPACE_CONVERSION)
return "view-refresh";
return "image-missing";
}
@@ -660,13 +660,13 @@ gcm_prefs_profile_type_to_icon_name (GcmProfileType type)
* gcm_prefs_profile_get_sort_string:
**/
static const gchar *
-gcm_prefs_profile_get_sort_string (GcmProfileType type)
+gcm_prefs_profile_get_sort_string (GcmProfileTypeEnum type)
{
- if (type == GCM_PROFILE_TYPE_DISPLAY_DEVICE)
+ if (type == GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE)
return "1";
- if (type == GCM_PROFILE_TYPE_INPUT_DEVICE)
+ if (type == GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE)
return "2";
- if (type == GCM_PROFILE_TYPE_OUTPUT_DEVICE)
+ if (type == GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE)
return "3";
return "4";
}
@@ -680,7 +680,7 @@ gcm_prefs_update_profile_list (void)
GtkTreeIter iter;
gchar *description;
const gchar *icon_name;
- GcmProfileType profile_type = GCM_PROFILE_TYPE_UNKNOWN;
+ GcmProfileTypeEnum profile_type = GCM_PROFILE_TYPE_ENUM_UNKNOWN;
GcmProfile *profile;
guint i;
gchar *filename = NULL;
@@ -1021,7 +1021,7 @@ static void
gcm_prefs_calibrate_cb (GtkWidget *widget, gpointer data)
{
GcmCalibrate *calibrate = NULL;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
gboolean ret;
GError *error = NULL;
gchar *filename = NULL;
@@ -1046,11 +1046,11 @@ gcm_prefs_calibrate_cb (GtkWidget *widget, gpointer data)
/* choose the correct type of calibration */
switch (type) {
- case GCM_DEVICE_TYPE_DISPLAY:
+ case GCM_DEVICE_TYPE_ENUM_DISPLAY:
ret = gcm_prefs_calibrate_display (calibrate);
break;
- case GCM_DEVICE_TYPE_SCANNER:
- case GCM_DEVICE_TYPE_CAMERA:
+ case GCM_DEVICE_TYPE_ENUM_SCANNER:
+ case GCM_DEVICE_TYPE_ENUM_CAMERA:
ret = gcm_prefs_calibrate_device (calibrate);
break;
default:
@@ -1263,7 +1263,7 @@ gcm_prefs_set_calibrate_button_sensitivity (void)
{
gboolean ret = FALSE;
GtkWidget *widget;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
gboolean connected;
/* no device selected */
@@ -1281,7 +1281,7 @@ gcm_prefs_set_calibrate_button_sensitivity (void)
goto out;
/* are we a display */
- if (type == GCM_DEVICE_TYPE_DISPLAY) {
+ if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY) {
/* find whether we have hardware installed */
g_object_get (color_device,
@@ -1291,8 +1291,8 @@ gcm_prefs_set_calibrate_button_sensitivity (void)
egg_debug ("overriding device presence %i with TRUE", ret);
ret = TRUE;
#endif
- } else if (type == GCM_DEVICE_TYPE_SCANNER ||
- type == GCM_DEVICE_TYPE_CAMERA) {
+ } else if (type == GCM_DEVICE_TYPE_ENUM_SCANNER ||
+ type == GCM_DEVICE_TYPE_ENUM_CAMERA) {
/* TODO: find out if we can scan using gnome-scan */
ret = TRUE;
@@ -1311,11 +1311,11 @@ out:
* gcm_prefs_is_profile_suitable_for_device_type:
**/
static gboolean
-gcm_prefs_is_profile_suitable_for_device_type (GcmProfile *profile, GcmDeviceType type)
+gcm_prefs_is_profile_suitable_for_device_type (GcmProfile *profile, GcmDeviceTypeEnum type)
{
- GcmProfileType profile_type_tmp;
- GcmProfileType profile_type;
- GcmProfileColorspace colorspace;
+ GcmProfileTypeEnum profile_type_tmp;
+ GcmProfileTypeEnum profile_type;
+ GcmColorspaceEnum colorspace;
gboolean has_vcgt;
gboolean ret = FALSE;
@@ -1327,7 +1327,7 @@ gcm_prefs_is_profile_suitable_for_device_type (GcmProfile *profile, GcmDeviceTyp
NULL);
/* ignore LAB profiles */
- if (colorspace == GCM_PROFILE_COLORSPACE_LAB)
+ if (colorspace == GCM_COLORSPACE_ENUM_LAB)
goto out;
/* not the correct type */
@@ -1336,7 +1336,7 @@ gcm_prefs_is_profile_suitable_for_device_type (GcmProfile *profile, GcmDeviceTyp
goto out;
/* no VCGT for a display (is a crap profile) */
- if (profile_type_tmp == GCM_PROFILE_TYPE_DISPLAY_DEVICE && !has_vcgt)
+ if (profile_type_tmp == GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE && !has_vcgt)
goto out;
/* success */
@@ -1349,7 +1349,7 @@ out:
* gcm_prefs_add_profiles_suitable_for_devices:
**/
static void
-gcm_prefs_add_profiles_suitable_for_devices (GtkWidget *widget, GcmDeviceType type, const gchar *profile_filename)
+gcm_prefs_add_profiles_suitable_for_devices (GtkWidget *widget, GcmDeviceTypeEnum type, const gchar *profile_filename)
{
GtkTreeModel *model;
guint i;
@@ -1419,7 +1419,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
gfloat contrast;
gboolean connected;
gchar *id = NULL;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
gchar *device_serial = NULL;
gchar *device_model = NULL;
gchar *device_manufacturer = NULL;
@@ -1449,7 +1449,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
NULL);
/* not a xrandr device */
- if (type != GCM_DEVICE_TYPE_DISPLAY) {
+ if (type != GCM_DEVICE_TYPE_ENUM_DISPLAY) {
widget = GTK_WIDGET (gtk_builder_get_object (builder, "expander1"));
gtk_widget_set_sensitive (widget, FALSE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_reset"));
@@ -1538,36 +1538,36 @@ out:
}
/**
- * gcm_prefs_profile_type_to_text:
+ * gcm_prefs_profile_type_to_string:
**/
static gchar *
-gcm_prefs_profile_type_to_text (GcmProfileType type)
+gcm_prefs_profile_type_to_string (GcmProfileTypeEnum type)
{
- if (type == GCM_PROFILE_TYPE_INPUT_DEVICE) {
+ if (type == GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE) {
/* TRANSLATORS: this the ICC profile type */
return _("Input device");
}
- if (type == GCM_PROFILE_TYPE_DISPLAY_DEVICE) {
+ if (type == GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE) {
/* TRANSLATORS: this the ICC profile type */
return _("Display device");
}
- if (type == GCM_PROFILE_TYPE_OUTPUT_DEVICE) {
+ if (type == GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE) {
/* TRANSLATORS: this the ICC profile type */
return _("Output device");
}
- if (type == GCM_PROFILE_TYPE_DEVICELINK) {
+ if (type == GCM_PROFILE_TYPE_ENUM_DEVICELINK) {
/* TRANSLATORS: this the ICC profile type */
return _("Devicelink");
}
- if (type == GCM_PROFILE_TYPE_COLORSPACE_CONVERSION) {
+ if (type == GCM_PROFILE_TYPE_ENUM_COLORSPACE_CONVERSION) {
/* TRANSLATORS: this the ICC profile type */
return _("Colorspace conversion");
}
- if (type == GCM_PROFILE_TYPE_ABSTRACT) {
+ if (type == GCM_PROFILE_TYPE_ENUM_ABSTRACT) {
/* TRANSLATORS: this the ICC profile type */
return _("Abstract");
}
- if (type == GCM_PROFILE_TYPE_NAMED_COLOR) {
+ if (type == GCM_PROFILE_TYPE_ENUM_NAMED_COLOR) {
/* TRANSLATORS: this the ICC profile type */
return _("Named color");
}
@@ -1576,48 +1576,48 @@ gcm_prefs_profile_type_to_text (GcmProfileType type)
}
/**
- * gcm_prefs_profile_colorspace_to_text:
+ * gcm_prefs_profile_colorspace_to_string:
**/
static gchar *
-gcm_prefs_profile_colorspace_to_text (GcmProfileColorspace type)
+gcm_prefs_profile_colorspace_to_string (GcmColorspaceEnum type)
{
- if (type == GCM_PROFILE_COLORSPACE_XYZ) {
+ if (type == GCM_COLORSPACE_ENUM_XYZ) {
/* TRANSLATORS: this the ICC colorspace type */
return _("XYZ");
}
- if (type == GCM_PROFILE_COLORSPACE_LAB) {
+ if (type == GCM_COLORSPACE_ENUM_LAB) {
/* TRANSLATORS: this the ICC colorspace type */
return _("LAB");
}
- if (type == GCM_PROFILE_COLORSPACE_LUV) {
+ if (type == GCM_COLORSPACE_ENUM_LUV) {
/* TRANSLATORS: this the ICC colorspace type */
return _("LUV");
}
- if (type == GCM_PROFILE_COLORSPACE_YCBCR) {
+ if (type == GCM_COLORSPACE_ENUM_YCBCR) {
/* TRANSLATORS: this the ICC colorspace type */
return _("YCbCr");
}
- if (type == GCM_PROFILE_COLORSPACE_YXY) {
+ if (type == GCM_COLORSPACE_ENUM_YXY) {
/* TRANSLATORS: this the ICC colorspace type */
return _("Yxy");
}
- if (type == GCM_PROFILE_COLORSPACE_RGB) {
+ if (type == GCM_COLORSPACE_ENUM_RGB) {
/* TRANSLATORS: this the ICC colorspace type */
return _("RGB");
}
- if (type == GCM_PROFILE_COLORSPACE_GRAY) {
+ if (type == GCM_COLORSPACE_ENUM_GRAY) {
/* TRANSLATORS: this the ICC colorspace type */
return _("Gray");
}
- if (type == GCM_PROFILE_COLORSPACE_HSV) {
+ if (type == GCM_COLORSPACE_ENUM_HSV) {
/* TRANSLATORS: this the ICC colorspace type */
return _("HSV");
}
- if (type == GCM_PROFILE_COLORSPACE_CMYK) {
+ if (type == GCM_COLORSPACE_ENUM_CMYK) {
/* TRANSLATORS: this the ICC colorspace type */
return _("CMYK");
}
- if (type == GCM_PROFILE_COLORSPACE_CMY) {
+ if (type == GCM_COLORSPACE_ENUM_CMY) {
/* TRANSLATORS: this the ICC colorspace type */
return _("CMY");
}
@@ -1648,8 +1648,8 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
gchar *filename = NULL;
gchar *basename = NULL;
gchar *size_text = NULL;
- GcmProfileType profile_type;
- GcmProfileColorspace profile_colorspace;
+ GcmProfileTypeEnum profile_type;
+ GcmColorspaceEnum profile_colorspace;
const gchar *profile_type_text;
const gchar *profile_colorspace_text;
gboolean ret;
@@ -1725,29 +1725,29 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
/* set type */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_type"));
- if (profile_type == GCM_PROFILE_TYPE_UNKNOWN) {
+ if (profile_type == GCM_PROFILE_TYPE_ENUM_UNKNOWN) {
gtk_widget_hide (widget);
} else {
gtk_widget_show (widget);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_type"));
- profile_type_text = gcm_prefs_profile_type_to_text (profile_type);
+ profile_type_text = gcm_prefs_profile_type_to_string (profile_type);
gtk_label_set_label (GTK_LABEL (widget), profile_type_text);
}
/* set colorspace */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_colorspace"));
- if (profile_colorspace == GCM_PROFILE_COLORSPACE_UNKNOWN) {
+ if (profile_colorspace == GCM_COLORSPACE_ENUM_UNKNOWN) {
gtk_widget_hide (widget);
} else {
gtk_widget_show (widget);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_colorspace"));
- profile_colorspace_text = gcm_prefs_profile_colorspace_to_text (profile_colorspace);
+ profile_colorspace_text = gcm_prefs_profile_colorspace_to_string (profile_colorspace);
gtk_label_set_label (GTK_LABEL (widget), profile_colorspace_text);
}
/* set vcgt */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_vcgt"));
- gtk_widget_set_visible (widget, (profile_type == GCM_PROFILE_TYPE_DISPLAY_DEVICE));
+ gtk_widget_set_visible (widget, (profile_type == GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE));
widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_vcgt"));
if (has_vcgt) {
gtk_label_set_label (GTK_LABEL (widget), _("Yes"));
@@ -1843,18 +1843,18 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
}
/**
- * gcm_device_type_to_text:
+ * gcm_device_type_enum_to_string:
**/
static const gchar *
-gcm_prefs_device_type_to_text (GcmDeviceType type)
+gcm_prefs_device_type_to_string (GcmDeviceTypeEnum type)
{
- if (type == GCM_DEVICE_TYPE_DISPLAY)
+ if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY)
return "1";
- if (type == GCM_DEVICE_TYPE_SCANNER)
+ if (type == GCM_DEVICE_TYPE_ENUM_SCANNER)
return "2";
- if (type == GCM_DEVICE_TYPE_CAMERA)
+ if (type == GCM_DEVICE_TYPE_ENUM_CAMERA)
return "3";
- if (type == GCM_DEVICE_TYPE_PRINTER)
+ if (type == GCM_DEVICE_TYPE_ENUM_PRINTER)
return "4";
return "5";
}
@@ -1904,7 +1904,7 @@ gcm_prefs_add_device_xrandr (GcmDevice *device)
/* create sort order */
sort = g_strdup_printf ("%s%s",
- gcm_prefs_device_type_to_text (GCM_DEVICE_TYPE_DISPLAY),
+ gcm_prefs_device_type_to_string (GCM_DEVICE_TYPE_ENUM_DISPLAY),
title);
/* add to list */
@@ -1958,7 +1958,7 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
GError *error = NULL;
GcmProfile *profile = NULL;
gboolean changed;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -2005,7 +2005,7 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
}
/* set the gamma for display types */
- if (type == GCM_DEVICE_TYPE_DISPLAY) {
+ if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY) {
ret = gcm_utils_set_gamma_for_device (current_device, &error);
if (!ret) {
egg_warning ("failed to set output gamma: %s", error->message);
@@ -2082,15 +2082,15 @@ gcm_prefs_color_device_changed_cb (GcmColorDevice *_color_device, gpointer user_
* gcm_prefs_device_type_to_icon_name:
**/
static const gchar *
-gcm_prefs_device_type_to_icon_name (GcmDeviceType type)
+gcm_prefs_device_type_to_icon_name (GcmDeviceTypeEnum type)
{
- if (type == GCM_DEVICE_TYPE_DISPLAY)
+ if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY)
return "video-display";
- if (type == GCM_DEVICE_TYPE_SCANNER)
+ if (type == GCM_DEVICE_TYPE_ENUM_SCANNER)
return "scanner";
- if (type == GCM_DEVICE_TYPE_PRINTER)
+ if (type == GCM_DEVICE_TYPE_ENUM_PRINTER)
return "printer";
- if (type == GCM_DEVICE_TYPE_CAMERA)
+ if (type == GCM_DEVICE_TYPE_ENUM_CAMERA)
return "camera-photo";
return "image-missing";
}
@@ -2106,7 +2106,7 @@ gcm_prefs_add_device_type (GcmDevice *device)
GString *string;
gchar *id;
gchar *sort = NULL;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
const gchar *icon_name;
gboolean connected;
@@ -2132,7 +2132,7 @@ gcm_prefs_add_device_type (GcmDevice *device)
/* create sort order */
sort = g_strdup_printf ("%s%s",
- gcm_prefs_device_type_to_text (type),
+ gcm_prefs_device_type_to_string (type),
string->str);
/* add to list */
@@ -2191,7 +2191,7 @@ gcm_prefs_remove_device (GcmDevice *gcm_device)
static gboolean
gcm_prefs_added_idle_cb (GcmDevice *device)
{
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
GtkTreePath *path;
GtkWidget *widget;
egg_debug ("added: %s", gcm_device_get_id (device));
@@ -2205,7 +2205,7 @@ gcm_prefs_added_idle_cb (GcmDevice *device)
NULL);
/* add the device */
- if (type == GCM_DEVICE_TYPE_DISPLAY)
+ if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY)
gcm_prefs_add_device_xrandr (device);
else
gcm_prefs_add_device_type (device);
@@ -2300,13 +2300,13 @@ gcm_prefs_startup_phase2_idle_cb (gpointer user_data)
* gcm_prefs_setup_space_combobox:
**/
static void
-gcm_prefs_setup_space_combobox (GtkWidget *widget, GcmProfileColorspace colorspace, const gchar *profile_filename)
+gcm_prefs_setup_space_combobox (GtkWidget *widget, GcmColorspaceEnum colorspace, const gchar *profile_filename)
{
GcmProfile *profile;
guint i;
gchar *filename;
gchar *description;
- GcmProfileColorspace colorspace_tmp;
+ GcmColorspaceEnum colorspace_tmp;
guint added_count = 0;
gboolean has_vcgt;
gchar *text = NULL;
@@ -2314,7 +2314,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget, GcmProfileColorspace colorspa
GPtrArray *profile_array = NULL;
/* search is a way to reduce to number of profiles */
- if (colorspace == GCM_PROFILE_COLORSPACE_CMYK)
+ if (colorspace == GCM_COLORSPACE_ENUM_CMYK)
search = "CMYK";
/* get new list */
@@ -2333,7 +2333,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget, GcmProfileColorspace colorspa
/* only for correct type */
if (!has_vcgt &&
colorspace == colorspace_tmp &&
- (colorspace == GCM_PROFILE_COLORSPACE_CMYK ||
+ (colorspace == GCM_COLORSPACE_ENUM_CMYK ||
g_strstr_len (description, -1, search) != NULL)) {
gcm_prefs_combobox_add_profile (widget, profile);
@@ -2417,7 +2417,7 @@ gcm_prefs_renderer_combo_changed_cb (GtkWidget *widget, gpointer data)
gconf_key = GCM_SETTINGS_RENDERING_INTENT_SOFTPROOF;
/* save to GConf */
- value = gcm_rendering_intent_to_text (active+1);
+ value = gcm_intent_enum_to_string (active+1);
egg_debug ("changed rendering intent to %s", value);
gconf_client_set_string (gconf_client, gconf_key, value, NULL);
}
@@ -2432,10 +2432,10 @@ gcm_prefs_setup_rendering_combobox (GtkWidget *widget, const gchar *intent)
gboolean ret = FALSE;
const gchar *text;
- for (i=1; i<GCM_RENDERING_INTENT_LAST; i++) {
- text = gcm_rendering_intent_to_localized_text (i);
+ for (i=1; i<GCM_INTENT_ENUM_LAST; i++) {
+ text = gcm_intent_enum_to_localized_text (i);
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), text);
- text = gcm_rendering_intent_to_text (i);
+ text = gcm_intent_enum_to_string (i);
if (g_strcmp0 (text, intent) == 0) {
ret = TRUE;
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i-1);
@@ -2464,7 +2464,7 @@ gcm_prefs_startup_phase1_idle_cb (gpointer user_data)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_space_rgb"));
colorspace_rgb = gconf_client_get_string (gconf_client, GCM_SETTINGS_COLORSPACE_RGB, NULL);
gcm_prefs_set_combo_simple_text (widget);
- gcm_prefs_setup_space_combobox (widget, GCM_PROFILE_COLORSPACE_RGB, colorspace_rgb);
+ gcm_prefs_setup_space_combobox (widget, GCM_COLORSPACE_ENUM_RGB, colorspace_rgb);
g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (gcm_prefs_space_combo_changed_cb), NULL);
@@ -2472,7 +2472,7 @@ gcm_prefs_startup_phase1_idle_cb (gpointer user_data)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_space_cmyk"));
colorspace_cmyk = gconf_client_get_string (gconf_client, GCM_SETTINGS_COLORSPACE_CMYK, NULL);
gcm_prefs_set_combo_simple_text (widget);
- gcm_prefs_setup_space_combobox (widget, GCM_PROFILE_COLORSPACE_CMYK, colorspace_cmyk);
+ gcm_prefs_setup_space_combobox (widget, GCM_COLORSPACE_ENUM_CMYK, colorspace_cmyk);
g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (gcm_prefs_space_combo_changed_cb), (gpointer) "cmyk");
@@ -2529,7 +2529,7 @@ gcm_prefs_reset_devices_idle_cb (gpointer user_data)
{
GPtrArray *array = NULL;
GcmDevice *device;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
GError *error = NULL;
gboolean ret;
guint i;
@@ -2543,7 +2543,7 @@ gcm_prefs_reset_devices_idle_cb (gpointer user_data)
NULL);
/* not a xrandr panel */
- if (type != GCM_DEVICE_TYPE_DISPLAY)
+ if (type != GCM_DEVICE_TYPE_ENUM_DISPLAY)
continue;
/* set gamma for device */
diff --git a/src/gcm-profile-lcms1.c b/src/gcm-profile-lcms1.c
index 8613e2c..95ba346 100644
--- a/src/gcm-profile-lcms1.c
+++ b/src/gcm-profile-lcms1.c
@@ -435,8 +435,8 @@ gcm_profile_lcms1_parse_data (GcmProfile *profile, const guint8 *data, gsize len
guint tag_offset;
icProfileClassSignature profile_class;
icColorSpaceSignature color_space;
- GcmProfileColorspace colorspace;
- GcmProfileType profile_type;
+ GcmColorspaceEnum colorspace;
+ GcmProfileTypeEnum profile_type;
cmsCIEXYZ cie_xyz;
cmsCIEXYZTRIPLE cie_illum;
struct tm created;
@@ -498,28 +498,28 @@ gcm_profile_lcms1_parse_data (GcmProfile *profile, const guint8 *data, gsize len
profile_class = cmsGetDeviceClass (priv->lcms_profile);
switch (profile_class) {
case icSigInputClass:
- profile_type = GCM_PROFILE_TYPE_INPUT_DEVICE;
+ profile_type = GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE;
break;
case icSigDisplayClass:
- profile_type = GCM_PROFILE_TYPE_DISPLAY_DEVICE;
+ profile_type = GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE;
break;
case icSigOutputClass:
- profile_type = GCM_PROFILE_TYPE_OUTPUT_DEVICE;
+ profile_type = GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE;
break;
case icSigLinkClass:
- profile_type = GCM_PROFILE_TYPE_DEVICELINK;
+ profile_type = GCM_PROFILE_TYPE_ENUM_DEVICELINK;
break;
case icSigColorSpaceClass:
- profile_type = GCM_PROFILE_TYPE_COLORSPACE_CONVERSION;
+ profile_type = GCM_PROFILE_TYPE_ENUM_COLORSPACE_CONVERSION;
break;
case icSigAbstractClass:
- profile_type = GCM_PROFILE_TYPE_ABSTRACT;
+ profile_type = GCM_PROFILE_TYPE_ENUM_ABSTRACT;
break;
case icSigNamedColorClass:
- profile_type = GCM_PROFILE_TYPE_NAMED_COLOR;
+ profile_type = GCM_PROFILE_TYPE_ENUM_NAMED_COLOR;
break;
default:
- profile_type = GCM_PROFILE_TYPE_UNKNOWN;
+ profile_type = GCM_PROFILE_TYPE_ENUM_UNKNOWN;
}
g_object_set (profile,
"type", profile_type,
@@ -529,37 +529,37 @@ gcm_profile_lcms1_parse_data (GcmProfile *profile, const guint8 *data, gsize len
color_space = cmsGetColorSpace (priv->lcms_profile);
switch (color_space) {
case icSigXYZData:
- colorspace = GCM_PROFILE_COLORSPACE_XYZ;
+ colorspace = GCM_COLORSPACE_ENUM_XYZ;
break;
case icSigLabData:
- colorspace = GCM_PROFILE_COLORSPACE_LAB;
+ colorspace = GCM_COLORSPACE_ENUM_LAB;
break;
case icSigLuvData:
- colorspace = GCM_PROFILE_COLORSPACE_LUV;
+ colorspace = GCM_COLORSPACE_ENUM_LUV;
break;
case icSigYCbCrData:
- colorspace = GCM_PROFILE_COLORSPACE_YCBCR;
+ colorspace = GCM_COLORSPACE_ENUM_YCBCR;
break;
case icSigYxyData:
- colorspace = GCM_PROFILE_COLORSPACE_YXY;
+ colorspace = GCM_COLORSPACE_ENUM_YXY;
break;
case icSigRgbData:
- colorspace = GCM_PROFILE_COLORSPACE_RGB;
+ colorspace = GCM_COLORSPACE_ENUM_RGB;
break;
case icSigGrayData:
- colorspace = GCM_PROFILE_COLORSPACE_GRAY;
+ colorspace = GCM_COLORSPACE_ENUM_GRAY;
break;
case icSigHsvData:
- colorspace = GCM_PROFILE_COLORSPACE_HSV;
+ colorspace = GCM_COLORSPACE_ENUM_HSV;
break;
case icSigCmykData:
- colorspace = GCM_PROFILE_COLORSPACE_CMYK;
+ colorspace = GCM_COLORSPACE_ENUM_CMYK;
break;
case icSigCmyData:
- colorspace = GCM_PROFILE_COLORSPACE_CMY;
+ colorspace = GCM_COLORSPACE_ENUM_CMY;
break;
default:
- colorspace = GCM_PROFILE_COLORSPACE_UNKNOWN;
+ colorspace = GCM_COLORSPACE_ENUM_UNKNOWN;
}
g_object_set (profile,
"colorspace", colorspace,
@@ -870,7 +870,7 @@ gcm_profile_lcms1_generate_curve (GcmProfile *profile, guint size)
cmsHPROFILE srgb_profile_lcms1 = NULL;
cmsHTRANSFORM transform = NULL;
guint type;
- GcmProfileColorspace colorspace;
+ GcmColorspaceEnum colorspace;
GcmProfileLcms1 *profile_lcms1 = GCM_PROFILE_LCMS1 (profile);
GcmProfileLcms1Private *priv = profile_lcms1->priv;
@@ -880,7 +880,7 @@ gcm_profile_lcms1_generate_curve (GcmProfile *profile, guint size)
NULL);
/* run through the profile_lcms1 */
- if (colorspace == GCM_PROFILE_COLORSPACE_RGB) {
+ if (colorspace == GCM_COLORSPACE_ENUM_RGB) {
/* RGB */
component_width = 3;
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 2839642..4b44133 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -51,8 +51,8 @@ static void gcm_profile_finalize (GObject *object);
**/
struct _GcmProfilePrivate
{
- GcmProfileType profile_type;
- GcmProfileColorspace colorspace;
+ GcmProfileTypeEnum profile_type;
+ GcmColorspaceEnum colorspace;
guint size;
gboolean has_vcgt;
gchar *description;
@@ -229,58 +229,6 @@ out:
}
/**
- * gcm_profile_type_to_text:
- **/
-const gchar *
-gcm_profile_type_to_text (GcmProfileType type)
-{
- if (type == GCM_PROFILE_TYPE_INPUT_DEVICE)
- return "input-device";
- if (type == GCM_PROFILE_TYPE_DISPLAY_DEVICE)
- return "display-device";
- if (type == GCM_PROFILE_TYPE_OUTPUT_DEVICE)
- return "output-device";
- if (type == GCM_PROFILE_TYPE_DEVICELINK)
- return "devicelink";
- if (type == GCM_PROFILE_TYPE_COLORSPACE_CONVERSION)
- return "colorspace-conversion";
- if (type == GCM_PROFILE_TYPE_ABSTRACT)
- return "abstract";
- if (type == GCM_PROFILE_TYPE_NAMED_COLOR)
- return "named-color";
- return "unknown";
-}
-
-/**
- * gcm_profile_colorspace_to_text:
- **/
-const gchar *
-gcm_profile_colorspace_to_text (GcmProfileColorspace type)
-{
- if (type == GCM_PROFILE_COLORSPACE_XYZ)
- return "xyz";
- if (type == GCM_PROFILE_COLORSPACE_LAB)
- return "lab";
- if (type == GCM_PROFILE_COLORSPACE_LUV)
- return "luv";
- if (type == GCM_PROFILE_COLORSPACE_YCBCR)
- return "ycbcr";
- if (type == GCM_PROFILE_COLORSPACE_YXY)
- return "yxy";
- if (type == GCM_PROFILE_COLORSPACE_RGB)
- return "rgb";
- if (type == GCM_PROFILE_COLORSPACE_GRAY)
- return "gray";
- if (type == GCM_PROFILE_COLORSPACE_HSV)
- return "hsv";
- if (type == GCM_PROFILE_COLORSPACE_CMYK)
- return "cmyk";
- if (type == GCM_PROFILE_COLORSPACE_CMY)
- return "cmy";
- return "unknown";
-}
-
-/**
* gcm_profile_file_monitor_changed_cb:
**/
static void
@@ -607,8 +555,8 @@ gcm_profile_init (GcmProfile *profile)
{
profile->priv = GCM_PROFILE_GET_PRIVATE (profile);
profile->priv->monitor = NULL;
- profile->priv->profile_type = GCM_PROFILE_TYPE_UNKNOWN;
- profile->priv->colorspace = GCM_PROFILE_COLORSPACE_UNKNOWN;
+ profile->priv->profile_type = GCM_PROFILE_TYPE_ENUM_UNKNOWN;
+ profile->priv->colorspace = GCM_COLORSPACE_ENUM_UNKNOWN;
profile->priv->white_point = gcm_xyz_new ();
profile->priv->black_point = gcm_xyz_new ();
profile->priv->luminance_red = gcm_xyz_new ();
@@ -683,8 +631,8 @@ typedef struct {
const gchar *model;
const gchar *datetime;
const gchar *description;
- GcmProfileType type;
- GcmProfileColorspace colorspace;
+ GcmProfileTypeEnum type;
+ GcmColorspaceEnum colorspace;
gfloat luminance;
} GcmProfileTestData;
@@ -833,8 +781,8 @@ gcm_profile_test (EggTest *test)
test_data.manufacturer = "IEC http://www.iec.ch";
test_data.model = "IEC 61966-2.1 Default RGB colour space - sRGB";
test_data.description = "Blueish Test";
- test_data.type = GCM_PROFILE_TYPE_DISPLAY_DEVICE;
- test_data.colorspace = GCM_PROFILE_COLORSPACE_RGB;
+ test_data.type = GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE;
+ test_data.colorspace = GCM_COLORSPACE_ENUM_RGB;
test_data.luminance = 0.648454;
test_data.datetime = "February 9 1998, 06:49:00 AM";
gcm_profile_test_parse_file (test, "bluish.icc", &test_data);
@@ -844,8 +792,8 @@ gcm_profile_test (EggTest *test)
test_data.manufacturer = "IEC http://www.iec.ch";
test_data.model = "IEC 61966-2.1 Default RGB colour space - sRGB";
test_data.description = "ADOBEGAMMA-Test";
- test_data.type = GCM_PROFILE_TYPE_DISPLAY_DEVICE;
- test_data.colorspace = GCM_PROFILE_COLORSPACE_RGB;
+ test_data.type = GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE;
+ test_data.colorspace = GCM_COLORSPACE_ENUM_RGB;
test_data.luminance = 0.648446;
test_data.datetime = "August 16 2005, 09:49:54 PM";
gcm_profile_test_parse_file (test, "AdobeGammaTest.icm", &test_data);
diff --git a/src/gcm-profile.h b/src/gcm-profile.h
index b6cbbf6..5d05bb6 100644
--- a/src/gcm-profile.h
+++ b/src/gcm-profile.h
@@ -67,33 +67,6 @@ struct _GcmProfileClass
void (*_gcm_reserved5) (void);
};
-typedef enum {
- GCM_PROFILE_TYPE_UNKNOWN,
- GCM_PROFILE_TYPE_INPUT_DEVICE,
- GCM_PROFILE_TYPE_DISPLAY_DEVICE,
- GCM_PROFILE_TYPE_OUTPUT_DEVICE,
- GCM_PROFILE_TYPE_DEVICELINK,
- GCM_PROFILE_TYPE_COLORSPACE_CONVERSION,
- GCM_PROFILE_TYPE_ABSTRACT,
- GCM_PROFILE_TYPE_NAMED_COLOR,
- GCM_PROFILE_TYPE_LAST
-} GcmProfileType;
-
-typedef enum {
- GCM_PROFILE_COLORSPACE_UNKNOWN,
- GCM_PROFILE_COLORSPACE_XYZ,
- GCM_PROFILE_COLORSPACE_LAB,
- GCM_PROFILE_COLORSPACE_LUV,
- GCM_PROFILE_COLORSPACE_YCBCR,
- GCM_PROFILE_COLORSPACE_YXY,
- GCM_PROFILE_COLORSPACE_RGB,
- GCM_PROFILE_COLORSPACE_GRAY,
- GCM_PROFILE_COLORSPACE_HSV,
- GCM_PROFILE_COLORSPACE_CMYK,
- GCM_PROFILE_COLORSPACE_CMY,
- GCM_PROFILE_COLORSPACE_LAST
-} GcmProfileColorspace;
-
GType gcm_profile_get_type (void);
GcmProfile *gcm_profile_new (void);
GcmProfile *gcm_profile_default_new (void);
@@ -111,8 +84,6 @@ GcmClut *gcm_profile_generate_vcgt (GcmProfile *profile,
guint size);
GcmClut *gcm_profile_generate_curve (GcmProfile *profile,
guint size);
-const gchar *gcm_profile_type_to_text (GcmProfileType type);
-const gchar *gcm_profile_colorspace_to_text (GcmProfileColorspace type);
G_END_DECLS
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 6d1333f..3605d45 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -403,7 +403,7 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
gboolean use_global;
gboolean use_atom;
gboolean leftmost_screen = FALSE;
- GcmDeviceType type;
+ GcmDeviceTypeEnum type;
GnomeRRScreen *rr_screen = NULL;
GConfClient *gconf_client = NULL;
@@ -425,7 +425,7 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
NULL);
/* do no set the gamma for non-display types */
- if (type != GCM_DEVICE_TYPE_DISPLAY) {
+ if (type != GCM_DEVICE_TYPE_ENUM_DISPLAY) {
if (error != NULL)
*error = g_error_new (1, 0, "not a display: %s", id);
goto out;
@@ -745,24 +745,24 @@ gcm_utils_get_default_config_location (void)
/**
* gcm_utils_device_type_to_profile_type:
**/
-GcmProfileType
-gcm_utils_device_type_to_profile_type (GcmDeviceType type)
+GcmProfileTypeEnum
+gcm_utils_device_type_to_profile_type (GcmDeviceTypeEnum type)
{
- GcmProfileType profile_type;
+ GcmProfileTypeEnum profile_type;
switch (type) {
- case GCM_DEVICE_TYPE_DISPLAY:
- profile_type = GCM_PROFILE_TYPE_DISPLAY_DEVICE;
+ case GCM_DEVICE_TYPE_ENUM_DISPLAY:
+ profile_type = GCM_PROFILE_TYPE_ENUM_DISPLAY_DEVICE;
break;
- case GCM_DEVICE_TYPE_CAMERA:
- case GCM_DEVICE_TYPE_SCANNER:
- profile_type = GCM_PROFILE_TYPE_INPUT_DEVICE;
+ case GCM_DEVICE_TYPE_ENUM_CAMERA:
+ case GCM_DEVICE_TYPE_ENUM_SCANNER:
+ profile_type = GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE;
break;
- case GCM_DEVICE_TYPE_PRINTER:
- profile_type = GCM_PROFILE_TYPE_OUTPUT_DEVICE;
+ case GCM_DEVICE_TYPE_ENUM_PRINTER:
+ profile_type = GCM_PROFILE_TYPE_ENUM_OUTPUT_DEVICE;
break;
default:
egg_warning ("unknown type: %i", type);
- profile_type = GCM_PROFILE_TYPE_UNKNOWN;
+ profile_type = GCM_PROFILE_TYPE_ENUM_UNKNOWN;
}
return profile_type;
}
@@ -782,64 +782,30 @@ gcm_utils_format_date_time (const struct tm *created)
}
/**
- * gcm_rendering_intent_to_text:
+ * gcm_intent_enum_to_localized_text:
**/
const gchar *
-gcm_rendering_intent_to_text (GcmRenderingIntent intent)
+gcm_intent_enum_to_localized_text (GcmIntentEnum intent)
{
- if (intent == GCM_RENDERING_INTENT_PERCEPTUAL)
- return "perceptual";
- if (intent == GCM_RENDERING_INTENT_RELATIVE_COLORMETRIC)
- return "relative-colormetric";
- if (intent == GCM_RENDERING_INTENT_SATURATION)
- return "saturation";
- if (intent == GCM_RENDERING_INTENT_ABSOLUTE_COLORMETRIC)
- return "absolute-colormetric";
- return "unknown";
-}
-
-/**
- * gcm_rendering_intent_to_localized_text:
- **/
-const gchar *
-gcm_rendering_intent_to_localized_text (GcmRenderingIntent intent)
-{
- if (intent == GCM_RENDERING_INTENT_PERCEPTUAL) {
+ if (intent == GCM_INTENT_ENUM_PERCEPTUAL) {
/* TRANSLATORS: rendering intent: you probably want to google this */
return _("Perceptual");
}
- if (intent == GCM_RENDERING_INTENT_RELATIVE_COLORMETRIC) {
+ if (intent == GCM_INTENT_ENUM_RELATIVE_COLORMETRIC) {
/* TRANSLATORS: rendering intent: you probably want to google this */
return _("Relative colormetric");
}
- if (intent == GCM_RENDERING_INTENT_SATURATION) {
+ if (intent == GCM_INTENT_ENUM_SATURATION) {
/* TRANSLATORS: rendering intent: you probably want to google this */
return _("Saturation");
}
- if (intent == GCM_RENDERING_INTENT_ABSOLUTE_COLORMETRIC) {
+ if (intent == GCM_INTENT_ENUM_ABSOLUTE_COLORMETRIC) {
/* TRANSLATORS: rendering intent: you probably want to google this */
return _("Absolute colormetric");
}
return "unknown";
}
-/**
- * gcm_rendering_intent_from_text:
- **/
-GcmRenderingIntent
-gcm_rendering_intent_from_text (const gchar *intent)
-{
- if (g_strcmp0 (intent, "perceptual") == 0)
- return GCM_RENDERING_INTENT_PERCEPTUAL;
- if (g_strcmp0 (intent, "relative-colormetric") == 0)
- return GCM_RENDERING_INTENT_RELATIVE_COLORMETRIC;
- if (g_strcmp0 (intent, "saturation") == 0)
- return GCM_RENDERING_INTENT_SATURATION;
- if (g_strcmp0 (intent, "absolute-colormetric") == 0)
- return GCM_RENDERING_INTENT_ABSOLUTE_COLORMETRIC;
- return GCM_RENDERING_INTENT_UNKNOWN;
-}
-
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
@@ -854,8 +820,8 @@ gcm_utils_test (EggTest *test)
GPtrArray *array;
gchar *text;
gchar *filename;
- GcmProfileType profile_type;
- GcmDeviceType device_type;
+ GcmProfileTypeEnum profile_type;
+ GcmDeviceTypeEnum device_type;
if (!egg_test_start (test, "GcmUtils"))
return;
@@ -948,13 +914,13 @@ gcm_utils_test (EggTest *test)
/************************************************************/
egg_test_title (test, "convert valid device type to profile type");
- profile_type = gcm_utils_device_type_to_profile_type (GCM_DEVICE_TYPE_SCANNER);
- egg_test_assert (test, (profile_type == GCM_PROFILE_TYPE_INPUT_DEVICE));
+ profile_type = gcm_utils_device_type_to_profile_type (GCM_DEVICE_TYPE_ENUM_SCANNER);
+ egg_test_assert (test, (profile_type == GCM_PROFILE_TYPE_ENUM_INPUT_DEVICE));
/************************************************************/
egg_test_title (test, "convert invalid device type to profile type");
- profile_type = gcm_utils_device_type_to_profile_type (GCM_DEVICE_TYPE_UNKNOWN);
- egg_test_assert (test, (profile_type == GCM_PROFILE_TYPE_UNKNOWN));
+ profile_type = gcm_utils_device_type_to_profile_type (GCM_DEVICE_TYPE_ENUM_UNKNOWN);
+ egg_test_assert (test, (profile_type == GCM_PROFILE_TYPE_ENUM_UNKNOWN));
egg_test_end (test);
}
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index f07cac5..93749b7 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -27,6 +27,7 @@
#include "gcm-device.h"
#include "gcm-profile.h"
+#include "gcm-enum.h"
#define GCM_STOCK_ICON "gnome-color-manager"
#define GCM_PROFILE_PATH "/.color/icc"
@@ -40,15 +41,6 @@
#define GCM_SETTINGS_COLORSPACE_RGB "/apps/gnome-color-manager/colorspace_rgb"
#define GCM_SETTINGS_COLORSPACE_CMYK "/apps/gnome-color-manager/colorspace_cmyk"
-typedef enum {
- GCM_RENDERING_INTENT_UNKNOWN,
- GCM_RENDERING_INTENT_PERCEPTUAL,
- GCM_RENDERING_INTENT_RELATIVE_COLORMETRIC,
- GCM_RENDERING_INTENT_SATURATION,
- GCM_RENDERING_INTENT_ABSOLUTE_COLORMETRIC,
- GCM_RENDERING_INTENT_LAST
-} GcmRenderingIntent;
-
gboolean gcm_utils_set_gamma_for_device (GcmDevice *device,
GError **error);
GPtrArray *gcm_utils_get_profile_filenames (void);
@@ -63,18 +55,14 @@ gboolean gcm_utils_output_is_lcd (const gchar *output_name);
void gcm_utils_alphanum_lcase (gchar *string);
void gcm_utils_ensure_sensible_filename (gchar *string);
gchar *gcm_utils_get_default_config_location (void);
-GcmProfileType gcm_utils_device_type_to_profile_type (GcmDeviceType type);
+GcmProfileTypeEnum gcm_utils_device_type_to_profile_type (GcmDeviceTypeEnum type);
gchar *gcm_utils_format_date_time (const struct tm *created);
gboolean gcm_utils_install_package (const gchar *package_name,
GtkWindow *window);
-void gcm_utils_ensure_sane_length (gchar *text,
- guint max_length);
void gcm_utils_ensure_printable (gchar *text);
gboolean gcm_utils_is_icc_profile (const gchar *filename);
gchar *gcm_utils_linkify (const gchar *text);
-GcmRenderingIntent gcm_rendering_intent_from_text (const gchar *intent);
-const gchar *gcm_rendering_intent_to_localized_text (GcmRenderingIntent intent);
-const gchar *gcm_rendering_intent_to_text (GcmRenderingIntent intent);
+const gchar *gcm_intent_enum_to_localized_text (GcmIntentEnum intent);
#endif /* __GCM_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]