[colord] Backport some fixes from upstream for gnome-settings-daemon.

Richard Hughes rhughes at fedoraproject.org
Fri Jan 18 15:23:08 UTC 2013


commit a3c0c15f1320cc543b7a4a2f080b92e45366cb5a
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Jan 18 15:22:53 2013 +0000

    Backport some fixes from upstream for gnome-settings-daemon.

 colord-upstream-fixes.patch |  236 +++++++++++++++++++++++++++++++++++++++++++
 colord.spec                 |    9 ++-
 2 files changed, 244 insertions(+), 1 deletions(-)
---
diff --git a/colord-upstream-fixes.patch b/colord-upstream-fixes.patch
new file mode 100644
index 0000000..fe13c4e
--- /dev/null
+++ b/colord-upstream-fixes.patch
@@ -0,0 +1,236 @@
+diff --git a/src/cd-main.c b/src/cd-main.c
+index a5e0ff6..ce4de30 100644
+--- a/src/cd-main.c
++++ b/src/cd-main.c
+@@ -265,25 +265,16 @@ out:
+ }
+ 
+ /**
+- * cd_main_device_auto_add_profile_md:
++ * cd_main_auto_add_from_md:
+  **/
+ static gboolean
+-cd_main_device_auto_add_profile_md (CdDevice *device, CdProfile *profile)
++cd_main_auto_add_from_md (CdMainPrivate *priv,
++			  CdDevice *device,
++			  CdProfile *profile)
+ {
+-	const gchar *device_id;
+ 	gboolean ret = FALSE;
+ 	GError *error = NULL;
+ 
+-	/* does the profile have device metadata */
+-	device_id = cd_profile_get_metadata_item (profile,
+-						  CD_PROFILE_METADATA_MAPPING_DEVICE_ID);
+-	if (device_id == NULL)
+-		goto out;
+-
+-	/* does this device match? */
+-	if (g_strcmp0 (cd_device_get_id (device), device_id) != 0)
+-		goto out;
+-
+ 	/* auto-add soft relationship */
+ 	g_debug ("CdMain: Automatically MD add %s to %s",
+ 		 cd_profile_get_id (profile),
+@@ -307,12 +298,12 @@ out:
+ }
+ 
+ /**
+- * cd_main_device_auto_add_profile_db:
++ * cd_main_auto_add_from_db:
+  **/
+ static gboolean
+-cd_main_device_auto_add_profile_db (CdMainPrivate *priv,
+-				    CdDevice *device,
+-				    CdProfile *profile)
++cd_main_auto_add_from_db (CdMainPrivate *priv,
++			  CdDevice *device,
++			  CdProfile *profile)
+ {
+ 	gboolean ret = FALSE;
+ 	GError *error = NULL;
+@@ -350,36 +341,37 @@ out:
+ }
+ 
+ /**
+- * cd_main_device_auto_add_profile:
++ * cd_main_device_auto_add_from_md:
+  **/
+-static gboolean
+-cd_main_device_auto_add_profile (CdMainPrivate *priv,
+-				 CdDevice *device,
+-				 CdProfile *profile)
++static void
++cd_main_device_auto_add_from_md (CdMainPrivate *priv,
++				 CdDevice *device)
+ {
+-	gboolean ret;
+-
+-	/* try adding devices from the mapping db -- we do this first
+-	 * as the database entries might be hard */
+-	ret = cd_main_device_auto_add_profile_db (priv, device, profile);
+-	if (ret)
+-		goto out;
++	CdProfile *profile_tmp;
++	GPtrArray *array;
++	guint i;
+ 
+-	/* first try finding profile metadata to the device,
+-	 * which will be added soft */
+-	ret = cd_main_device_auto_add_profile_md (device, profile);
+-	if (ret)
++	/* get all the profiles, and check to see if any of them contain
++	 * MAPPING_device_id that matches the device */
++	array = cd_profile_array_get_by_metadata (priv->profiles_array,
++						  CD_PROFILE_METADATA_MAPPING_DEVICE_ID,
++						  cd_device_get_id (device));
++	if (array == NULL)
+ 		goto out;
++	for (i = 0; i < array->len; i++) {
++		profile_tmp = g_ptr_array_index (array, i);
++		cd_main_auto_add_from_md (priv, device, profile_tmp);
++	}
+ out:
+-	return ret;
++	if (array != NULL)
++		g_ptr_array_unref (array);
+ }
+ 
+ /**
+- * cd_main_device_auto_add_profiles:
++ * cd_main_device_auto_add_from_db:
+  **/
+ static void
+-cd_main_device_auto_add_profiles (CdMainPrivate *priv,
+-				  CdDevice *device)
++cd_main_device_auto_add_from_db (CdMainPrivate *priv, CdDevice *device)
+ {
+ 	CdProfile *profile_tmp;
+ 	const gchar *object_id_tmp;
+@@ -404,15 +396,15 @@ cd_main_device_auto_add_profiles (CdMainPrivate *priv,
+ 		profile_tmp = cd_profile_array_get_by_id_owner (priv->profiles_array,
+ 								object_id_tmp,
+ 								cd_device_get_owner (device));
+-		if (profile_tmp != NULL) {
+-			cd_main_device_auto_add_profile (priv,
+-							 device,
+-							 profile_tmp);
+-			g_object_unref (profile_tmp);
+-		} else {
+-			g_debug ("CdMain: profile %s is not (yet) available",
+-				 object_id_tmp);
++		if (profile_tmp == NULL) {
++			g_debug ("CdMain: profile %s with owner %i is not (yet) available",
++				 object_id_tmp, cd_device_get_owner (device));
++			continue;
+ 		}
++
++		/* does the profile have the correct device metadata */
++		cd_main_auto_add_from_db (priv, device, profile_tmp);
++		g_object_unref (profile_tmp);
+ 	}
+ out:
+ 	if (array != NULL)
+@@ -493,8 +485,9 @@ cd_main_device_add (CdMainPrivate *priv,
+ 	/* add to array */
+ 	cd_device_array_add (priv->devices_array, device);
+ 
+-	/* auto add profiles from the database */
+-	cd_main_device_auto_add_profiles (priv, device);
++	/* auto add profiles from the database and metadata */
++	cd_main_device_auto_add_from_db (priv, device);
++	cd_main_device_auto_add_from_md (priv, device);
+ out:
+ 	return ret;
+ }
+@@ -656,11 +649,11 @@ cd_main_sensor_array_to_variant (GPtrArray *array)
+ }
+ 
+ /**
+- * cd_main_profile_auto_add_to_device:
++ * cd_main_profile_auto_add_from_db:
+  **/
+ static void
+-cd_main_profile_auto_add_to_device (CdMainPrivate *priv,
+-				    CdProfile *profile)
++cd_main_profile_auto_add_from_db (CdMainPrivate *priv,
++				  CdProfile *profile)
+ {
+ 	CdDevice *device_tmp;
+ 	const gchar *device_id_tmp;
+@@ -692,15 +685,12 @@ cd_main_profile_auto_add_to_device (CdMainPrivate *priv,
+ 		device_tmp = cd_device_array_get_by_id_owner (priv->devices_array,
+ 							      device_id_tmp,
+ 							      cd_profile_get_owner (profile));
+-		if (device_tmp != NULL) {
+-			cd_main_device_auto_add_profile (priv,
+-							 device_tmp,
+-							 profile);
+-			g_object_unref (device_tmp);
+-		} else {
+-			g_debug ("CdMain: device %s is not (yet) available",
+-				 device_id_tmp);
+-		}
++		if (device_tmp == NULL)
++			continue;
++
++		/* hard add */
++		cd_main_auto_add_from_db (priv, device_tmp, profile);
++		g_object_unref (device_tmp);
+ 	}
+ out:
+ 	if (array != NULL)
+@@ -708,6 +698,32 @@ out:
+ }
+ 
+ /**
++ * cd_main_profile_auto_add_from_md:
++ **/
++static void
++cd_main_profile_auto_add_from_md (CdMainPrivate *priv,
++				  CdProfile *profile)
++{
++	CdDevice *device = NULL;
++	const gchar *device_id;
++
++	/* does the device exists that matches the md */
++	device_id = cd_profile_get_metadata_item (profile,
++						  CD_PROFILE_METADATA_MAPPING_DEVICE_ID);
++	if (device_id == NULL)
++		goto out;
++	device = cd_device_array_get_by_id_owner (priv->devices_array,
++						  device_id,
++						  cd_profile_get_owner (profile));
++	if (device == NULL)
++		goto out;
++	cd_main_auto_add_from_md (priv, device, profile);
++out:
++	if (device != NULL)
++		g_object_unref (device);
++}
++
++/**
+  * cd_main_profile_register_on_bus:
+  **/
+ static gboolean
+@@ -1375,9 +1391,6 @@ cd_main_daemon_method_call (GDBusConnection *connection, const gchar *sender,
+ 			goto out;
+ 		}
+ 
+-		/* auto add profiles from the database */
+-		cd_main_profile_auto_add_to_device (priv, profile);
+-
+ 		/* get any file descriptor in the message */
+ 		message = g_dbus_method_invocation_get_message (invocation);
+ 		fd_list = g_dbus_message_get_unix_fd_list (message);
+@@ -1421,6 +1434,10 @@ cd_main_daemon_method_call (GDBusConnection *connection, const gchar *sender,
+ 			}
+ 		}
+ 
++		/* auto add profiles from the database and metadata */
++		cd_main_profile_auto_add_from_db (priv, profile);
++		cd_main_profile_auto_add_from_md (priv, profile);
++
+ 		/* register on bus */
+ 		ret = cd_main_profile_register_on_bus (priv, profile, &error);
+ 		if (!ret) {
diff --git a/colord.spec b/colord.spec
index c017e38..3b2159c 100644
--- a/colord.spec
+++ b/colord.spec
@@ -15,11 +15,14 @@
 Summary:   Color daemon
 Name:      colord
 Version:   0.1.28
-Release:   1%{?dist}
+Release:   2%{?dist}
 License:   GPLv2+ and LGPLv2+
 URL:       http://www.freedesktop.org/software/colord/
 Source0:   http://www.freedesktop.org/software/colord/releases/%{name}-%{version}.tar.xz
 
+# Upstream fixes required for g-s-d
+Patch0:    colord-upstream-fixes.patch
+
 BuildRequires: dbus-devel
 BuildRequires: docbook-utils
 BuildRequires: gettext
@@ -92,6 +95,7 @@ This may be useful for CMYK soft-proofing or for extra device support.
 
 %prep
 %setup -q
+%patch0 -p1 -b .upstream-fixes
 
 %build
 # we can't use _hardened_build here, see
@@ -239,6 +243,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
 %{_datadir}/gtk-doc/html/colord/*
 
 %changelog
+* Fri Jan 16 2013 Richard Hughes <richard at hughsie.com> 0.1.28-2
+- Backport some fixes from upstream for gnome-settings-daemon.
+
 * Wed Jan 16 2013 Richard Hughes <richard at hughsie.com> 0.1.28-1
 - New upstream version
 - Add some default GSetting schema values for the calibration helper


More information about the scm-commits mailing list