[gnome-color-manager: 60/80] trivial: move GcmEdid and GcmTables to libcolor-glib



commit 64d5f050b07ddca9c500f92167f89100eaa3a792
Author: Richard Hughes <richard hughsie com>
Date:   Sun Jul 18 09:13:59 2010 +0100

    trivial: move GcmEdid and GcmTables to libcolor-glib

 libcolor-glib/Makefile.am           |   11 +++-
 libcolor-glib/egg-debug.c           |    1 +
 libcolor-glib/egg-debug.h           |    1 +
 {src => libcolor-glib}/gcm-edid.c   |    0
 {src => libcolor-glib}/gcm-edid.h   |    0
 libcolor-glib/gcm-self-test.c       |  115 +++++++++++++++++++++++++++++++++++
 {src => libcolor-glib}/gcm-tables.c |    0
 {src => libcolor-glib}/gcm-tables.h |    0
 po/POTFILES.skip                    |    1 +
 src/Makefile.am                     |   15 +++--
 src/gcm-self-test.c                 |  113 ----------------------------------
 11 files changed, 138 insertions(+), 119 deletions(-)
---
diff --git a/libcolor-glib/Makefile.am b/libcolor-glib/Makefile.am
index cd78ed6..6d651d4 100644
--- a/libcolor-glib/Makefile.am
+++ b/libcolor-glib/Makefile.am
@@ -36,11 +36,15 @@ libcolor_glib_include_HEADERS =					\
 	gcm-ddc-common.h					\
 	gcm-sensor-huey.h					\
 	gcm-sensor.h						\
+	gcm-edid.h						\
+	gcm-tables.h						\
 	gcm-version.h						\
 	$(NULL)
 
 libcolor_glib_la_SOURCES =					\
 	libcolor-glib.h						\
+	egg-debug.c						\
+	egg-debug.h						\
 	gcm-common.c						\
 	gcm-common.h						\
 	gcm-sensor.c						\
@@ -49,6 +53,10 @@ libcolor_glib_la_SOURCES =					\
 	gcm-sensor-huey.h					\
 	gcm-sensor-dummy.c					\
 	gcm-sensor-dummy.h					\
+	gcm-tables.c						\
+	gcm-tables.h						\
+	gcm-edid.c						\
+	gcm-edid.h						\
 	gcm-ddc-client.c					\
 	gcm-ddc-client.h					\
 	gcm-ddc-device.c					\
@@ -62,7 +70,8 @@ libcolor_glib_la_SOURCES =					\
 
 libcolor_glib_la_LIBADD =					\
 	$(USB_LIBS)						\
-	$(GLIB_LIBS)
+	$(GLIB_LIBS)						\
+	-lm
 
 libcolor_glib_la_LDFLAGS =					\
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
diff --git a/libcolor-glib/egg-debug.c b/libcolor-glib/egg-debug.c
new file mode 120000
index 0000000..0a3eb62
--- /dev/null
+++ b/libcolor-glib/egg-debug.c
@@ -0,0 +1 @@
+../src/egg-debug.c
\ No newline at end of file
diff --git a/libcolor-glib/egg-debug.h b/libcolor-glib/egg-debug.h
new file mode 120000
index 0000000..db811d2
--- /dev/null
+++ b/libcolor-glib/egg-debug.h
@@ -0,0 +1 @@
+../src/egg-debug.h
\ No newline at end of file
diff --git a/src/gcm-edid.c b/libcolor-glib/gcm-edid.c
similarity index 100%
rename from src/gcm-edid.c
rename to libcolor-glib/gcm-edid.c
diff --git a/src/gcm-edid.h b/libcolor-glib/gcm-edid.h
similarity index 100%
rename from src/gcm-edid.h
rename to libcolor-glib/gcm-edid.h
diff --git a/libcolor-glib/gcm-self-test.c b/libcolor-glib/gcm-self-test.c
index f3c6525..c581f03 100644
--- a/libcolor-glib/gcm-self-test.c
+++ b/libcolor-glib/gcm-self-test.c
@@ -27,6 +27,8 @@
 #include "gcm-sensor-dummy.h"
 #include "gcm-ddc-client.h"
 #include "gcm-ddc-device.h"
+#include "gcm-edid.h"
+#include "gcm-tables.h"
 
 static void
 gcm_test_common_func (void)
@@ -178,6 +180,117 @@ gcm_test_sensor_func (void)
 	g_object_unref (sensor);
 }
 
+
+typedef struct {
+	const gchar *monitor_name;
+	const gchar *vendor_name;
+	const gchar *serial_number;
+	const gchar *eisa_id;
+	const gchar *checksum;
+	const gchar *pnp_id;
+	guint width;
+	guint height;
+	gfloat gamma;
+} GcmEdidTestData;
+
+static void
+gcm_test_edid_test_parse_edid_file (GcmEdid *edid, const gchar *filename, GcmEdidTestData *test_data)
+{
+	gchar *data;
+	gfloat mygamma;
+	gboolean ret;
+	GError *error = NULL;
+
+	ret = g_file_get_contents (filename, &data, NULL, &error);
+	g_assert_no_error (error);
+	g_assert (ret);
+
+	ret = gcm_edid_parse (edid, (const guint8 *) data, &error);
+	g_assert_no_error (error);
+	g_assert (ret);
+
+	g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, test_data->monitor_name);
+	g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, test_data->vendor_name);
+	g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, test_data->serial_number);
+	g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, test_data->eisa_id);
+	g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, test_data->checksum);
+	g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, test_data->pnp_id);
+	g_assert_cmpint (gcm_edid_get_height (edid), ==, test_data->height);
+	g_assert_cmpint (gcm_edid_get_width (edid), ==, test_data->width);
+	mygamma = gcm_edid_get_gamma (edid);
+	g_assert_cmpfloat (mygamma, >=, test_data->gamma - 0.01);
+	g_assert_cmpfloat (mygamma, <, test_data->gamma + 0.01);
+
+	g_free (data);
+}
+
+static void
+gcm_test_edid_func (void)
+{
+	GcmEdid *edid;
+	GcmEdidTestData test_data;
+
+	edid = gcm_edid_new ();
+	g_assert (edid != NULL);
+
+	/* LG 21" LCD panel */
+	test_data.monitor_name = "L225W";
+	test_data.vendor_name = "Goldstar Company Ltd";
+	test_data.serial_number = "34398";
+	test_data.eisa_id = NULL;
+	test_data.checksum = "80b7dda4c74b06366abb8fa23e71d645";
+	test_data.pnp_id = "GSM";
+	test_data.height = 30;
+	test_data.width = 47;
+	test_data.gamma = 2.2f;
+	gcm_test_edid_test_parse_edid_file (edid, TESTDATADIR "/LG-L225W-External.bin", &test_data);
+
+	/* Lenovo T61 Intel Panel */
+	test_data.monitor_name = NULL;
+	test_data.vendor_name = "IBM France";
+	test_data.serial_number = NULL;
+	test_data.eisa_id = "LTN154P2-L05";
+	test_data.checksum = "c585d9e80adc65c54f0a52597e850f83";
+	test_data.pnp_id = "IBM";
+	test_data.height = 21;
+	test_data.width = 33;
+	test_data.gamma = 2.2f;
+	gcm_test_edid_test_parse_edid_file (edid, TESTDATADIR "/Lenovo-T61-Internal.bin", &test_data);
+
+	g_object_unref (edid);
+}
+
+
+static void
+gcm_test_tables_func (void)
+{
+	GcmTables *tables;
+	GError *error = NULL;
+	gchar *vendor;
+
+	tables = gcm_tables_new ();
+	g_assert (tables != NULL);
+
+	vendor = gcm_tables_get_pnp_id (tables, "IBM", &error);
+	g_assert_no_error (error);
+	g_assert (vendor != NULL);
+	g_assert_cmpstr (vendor, ==, "IBM France");
+	g_free (vendor);
+
+	vendor = gcm_tables_get_pnp_id (tables, "MIL", &error);
+	g_assert_no_error (error);
+	g_assert (vendor != NULL);
+	g_assert_cmpstr (vendor, ==, "Marconi Instruments Ltd");
+	g_free (vendor);
+
+	vendor = gcm_tables_get_pnp_id (tables, "XXX", &error);
+	g_assert_error (error, 1, 0);
+	g_assert_cmpstr (vendor, ==, NULL);
+	g_free (vendor);
+
+	g_object_unref (tables);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -190,6 +303,8 @@ main (int argc, char **argv)
 	g_test_add_func ("/libcolor-glib/ddc-device", gcm_test_ddc_device_func);
 	g_test_add_func ("/libcolor-glib/ddc-client", gcm_test_ddc_client_func);
 	g_test_add_func ("/libcolor-glib/sensor", gcm_test_sensor_func);
+	g_test_add_func ("/color/edid", gcm_test_edid_func);
+	g_test_add_func ("/color/tables", gcm_test_tables_func);
 
 	return g_test_run ();
 }
diff --git a/src/gcm-tables.c b/libcolor-glib/gcm-tables.c
similarity index 100%
rename from src/gcm-tables.c
rename to libcolor-glib/gcm-tables.c
diff --git a/src/gcm-tables.h b/libcolor-glib/gcm-tables.h
similarity index 100%
rename from src/gcm-tables.h
rename to libcolor-glib/gcm-tables.h
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index e69de29..477ef37 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -0,0 +1 @@
+libcolor-glib/egg-debug.c
diff --git a/src/Makefile.am b/src/Makefile.am
index e2b47e1..3ce91d6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,12 +56,8 @@ libgcmshared_a_SOURCES =				\
 	gcm-enum.h					\
 	gcm-clut.c					\
 	gcm-clut.h					\
-	gcm-edid.c					\
-	gcm-edid.h					\
 	gcm-dmi.c					\
 	gcm-dmi.h					\
-	gcm-tables.c					\
-	gcm-tables.h					\
 	gcm-xserver.c					\
 	gcm-xserver.h					\
 	gcm-client.c					\
@@ -106,6 +102,9 @@ libgcmshared_a_SOURCES +=				\
 libgcmshared_a_CFLAGS =					\
 	$(WARNINGFLAGS_C)
 
+libgcmshared_a_LIBADD =					\
+	$(COLOR_GLIB_LIBS)
+
 sbin_PROGRAMS =						\
 	gcm-install-system-wide
 
@@ -152,6 +151,7 @@ gcm_dump_edid_LDADD =					\
 	$(GTK_LIBS)					\
 	$(SANE_LIBS)					\
 	$(CUPS_LIBS)					\
+	$(COLOR_GLIB_LIBS)				\
 	-lm
 
 gcm_dump_edid_CFLAGS =					\
@@ -171,6 +171,7 @@ gcm_dump_profile_LDADD =				\
 	$(GTK_LIBS)					\
 	$(SANE_LIBS)					\
 	$(CUPS_LIBS)					\
+	$(COLOR_GLIB_LIBS)				\
 	-lm
 
 gcm_dump_profile_CFLAGS =				\
@@ -224,6 +225,7 @@ gcm_apply_LDADD =					\
 	$(GTK_LIBS)					\
 	$(SANE_LIBS)					\
 	$(CUPS_LIBS)					\
+	$(COLOR_GLIB_LIBS)				\
 	-lm
 
 gcm_apply_CFLAGS =					\
@@ -290,6 +292,7 @@ gcm_picker_LDADD =					\
 	$(TIFF_LIBS)					\
 	$(EXIF_LIBS)					\
 	$(CANBERRA_LIBS)				\
+	$(COLOR_GLIB_LIBS)				\
 	-lm
 
 gcm_picker_CFLAGS =					\
@@ -312,6 +315,7 @@ gcm_session_LDADD =					\
 	$(SANE_LIBS)					\
 	$(NOTIFY_LIBS)					\
 	$(CUPS_LIBS)					\
+	$(COLOR_GLIB_LIBS)				\
 	-lm
 
 gcm_session_CFLAGS =					\
@@ -339,7 +343,8 @@ libcolor_la_LIBADD =					\
 	$(NOTIFY_LIBS)					\
 	$(CUPS_LIBS)					\
 	$(CANBERRA_LIBS)				\
-	$(CONTROL_CENTER_LIBS)
+	$(CONTROL_CENTER_LIBS)				\
+	$(COLOR_GLIB_LIBS)
 
 libcolor_la_LDFLAGS = -avoid-version -module
 libcolor_la_CFLAGS = $(WARNINGFLAGS_C)
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index c8375cd..502d037 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -34,14 +34,12 @@
 #include "gcm-device-udev.h"
 #include "gcm-device-xrandr.h"
 #include "gcm-dmi.h"
-#include "gcm-edid.h"
 #include "gcm-exif.h"
 #include "gcm-gamma-widget.h"
 #include "gcm-image.h"
 #include "gcm-print.h"
 #include "gcm-profile.h"
 #include "gcm-profile-store.h"
-#include "gcm-tables.h"
 #include "gcm-trc-widget.h"
 #include "gcm-utils.h"
 #include "gcm-xyz.h"
@@ -514,85 +512,6 @@ gcm_test_dmi_func (void)
 	g_object_unref (dmi);
 }
 
-typedef struct {
-	const gchar *monitor_name;
-	const gchar *vendor_name;
-	const gchar *serial_number;
-	const gchar *eisa_id;
-	const gchar *checksum;
-	const gchar *pnp_id;
-	guint width;
-	guint height;
-	gfloat gamma;
-} GcmEdidTestData;
-
-static void
-gcm_test_edid_test_parse_edid_file (GcmEdid *edid, const gchar *filename, GcmEdidTestData *test_data)
-{
-	gchar *data;
-	gfloat mygamma;
-	gboolean ret;
-	GError *error = NULL;
-
-	ret = g_file_get_contents (filename, &data, NULL, &error);
-	g_assert_no_error (error);
-	g_assert (ret);
-
-	ret = gcm_edid_parse (edid, (const guint8 *) data, &error);
-	g_assert_no_error (error);
-	g_assert (ret);
-
-	g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, test_data->monitor_name);
-	g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, test_data->vendor_name);
-	g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, test_data->serial_number);
-	g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, test_data->eisa_id);
-	g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, test_data->checksum);
-	g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, test_data->pnp_id);
-	g_assert_cmpint (gcm_edid_get_height (edid), ==, test_data->height);
-	g_assert_cmpint (gcm_edid_get_width (edid), ==, test_data->width);
-	mygamma = gcm_edid_get_gamma (edid);
-	g_assert_cmpfloat (mygamma, >=, test_data->gamma - 0.01);
-	g_assert_cmpfloat (mygamma, <, test_data->gamma + 0.01);
-
-	g_free (data);
-}
-
-static void
-gcm_test_edid_func (void)
-{
-	GcmEdid *edid;
-	GcmEdidTestData test_data;
-
-	edid = gcm_edid_new ();
-	g_assert (edid != NULL);
-
-	/* LG 21" LCD panel */
-	test_data.monitor_name = "L225W";
-	test_data.vendor_name = "Goldstar Company Ltd";
-	test_data.serial_number = "34398";
-	test_data.eisa_id = NULL;
-	test_data.checksum = "80b7dda4c74b06366abb8fa23e71d645";
-	test_data.pnp_id = "GSM";
-	test_data.height = 30;
-	test_data.width = 47;
-	test_data.gamma = 2.2f;
-	gcm_test_edid_test_parse_edid_file (edid, TESTDATADIR "/LG-L225W-External.bin", &test_data);
-
-	/* Lenovo T61 Intel Panel */
-	test_data.monitor_name = NULL;
-	test_data.vendor_name = "IBM France";
-	test_data.serial_number = NULL;
-	test_data.eisa_id = "LTN154P2-L05";
-	test_data.checksum = "c585d9e80adc65c54f0a52597e850f83";
-	test_data.pnp_id = "IBM";
-	test_data.height = 21;
-	test_data.width = 33;
-	test_data.gamma = 2.2f;
-	gcm_test_edid_test_parse_edid_file (edid, TESTDATADIR "/Lenovo-T61-Internal.bin", &test_data);
-
-	g_object_unref (edid);
-}
-
 static void
 gcm_test_exif_func (void)
 {
@@ -874,36 +793,6 @@ gcm_test_profile_store_func (void)
 }
 
 static void
-gcm_test_tables_func (void)
-{
-	GcmTables *tables;
-	GError *error = NULL;
-	gchar *vendor;
-
-	tables = gcm_tables_new ();
-	g_assert (tables != NULL);
-
-	vendor = gcm_tables_get_pnp_id (tables, "IBM", &error);
-	g_assert_no_error (error);
-	g_assert (vendor != NULL);
-	g_assert_cmpstr (vendor, ==, "IBM France");
-	g_free (vendor);
-
-	vendor = gcm_tables_get_pnp_id (tables, "MIL", &error);
-	g_assert_no_error (error);
-	g_assert (vendor != NULL);
-	g_assert_cmpstr (vendor, ==, "Marconi Instruments Ltd");
-	g_free (vendor);
-
-	vendor = gcm_tables_get_pnp_id (tables, "XXX", &error);
-	g_assert_error (error, 1, 0);
-	g_assert_cmpstr (vendor, ==, NULL);
-	g_free (vendor);
-
-	g_object_unref (tables);
-}
-
-static void
 gcm_test_trc_widget_func (void)
 {
 	GtkWidget *widget;
@@ -1157,9 +1046,7 @@ main (int argc, char **argv)
 	g_test_add_func ("/color/client", gcm_test_client_func);
 	g_test_add_func ("/color/dmi", gcm_test_dmi_func);
 	g_test_add_func ("/color/calibrate", gcm_test_calibrate_func);
-	g_test_add_func ("/color/edid", gcm_test_edid_func);
 	g_test_add_func ("/color/exif", gcm_test_exif_func);
-	g_test_add_func ("/color/tables", gcm_test_tables_func);
 	g_test_add_func ("/color/utils", gcm_test_utils_func);
 	g_test_add_func ("/color/device", gcm_test_device_func);
 	g_test_add_func ("/color/profile", gcm_test_profile_func);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]