Package: libedataserver1.2-9
Version: 2.22.1-1
Severity: normal
Tags: patch

Hi,

  The deprecated e_source_get_color function returns wrong values if the
  color is saved as 16bits per color. While this function is deprecated it is
  still used by at least dates and gnome-panel, so fixing that would be good
  (and it makes the colors in the panel match the ones in evolution again!)

  See attached patch for a possible fix

    Sjoerd

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=nl_NL (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages libedataserver1.2-9 depends on:
ii  libbonobo2-0               2.22.0-1      Bonobo CORBA interfaces library
ii  libc6                      2.7-10        GNU C Library: Shared libraries
ii  libdb4.6                   4.6.21-7      Berkeley v4.6 Database Libraries [
ii  libgconf2-4                2.22.0-1      GNOME configuration database syste
ii  libglib2.0-0               2.16.3-2      The GLib library of C routines
ii  libnspr4-0d                4.7.0-2       NetScape Portable Runtime Library
ii  liborbit2                  1:2.14.12-0.1 libraries for ORBit2 - a CORBA ORB
ii  libxml2                    2.6.32.dfsg-2 GNOME XML library

libedataserver1.2-9 recommends no packages.

-- no debconf information
--- evolution-data-server-2.22.1.orig/libedataserver/e-source.c
+++ evolution-data-server-2.22.1/libedataserver/e-source.c
@@ -689,7 +689,7 @@
 		    guint32 *color_return)
 {
 	const gchar *color_spec;
-	guint32 color;
+	guint32 color, color0, color1;
 
 	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
 
@@ -698,9 +698,23 @@
 	if (color_spec == NULL)
 		return FALSE;
 
+	/* check for 2 bytes per color */
+	if (strlen(color_spec) == 13 &&
+		sscanf (color_spec, "#%04x%08x", &color0, &color1) != 1) {
+		/* Just toss out the least significant parts,
+		 * should be close enough */
+		color = (color0 >> 8 & 0xff);
+		color <<= 8;
+		color |= (color1 >> 24 & 0xff);
+		color <<= 8;
+		color |= (color1 >> 8 & 0xff);
+		goto done;
+	}
+
 	if (sscanf (color_spec, "#%06x", &color) != 1)
 		return FALSE;
 
+done:
 	if (color_return != NULL)
 		*color_return = color;
 

Reply via email to