Index: libedataserverui/e-source-combo-box.c
===================================================================
--- libedataserverui/e-source-combo-box.c	(revision 8146)
+++ libedataserverui/e-source-combo-box.c	(working copy)
@@ -23,6 +23,7 @@
 #endif
 
 #include "e-source-combo-box.h"
+#include "e-cell-renderer-color.h"
 
 #define E_SOURCE_COMBO_BOX_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -43,6 +44,7 @@
 	COLUMN_NAME,		/* G_TYPE_STRING */
 	COLUMN_SENSITIVE,	/* G_TYPE_BOOLEAN */
 	COLUMN_SOURCE,		/* G_TYPE_OBJECT */
+	COLUMN_COLOR,		/* GDK_TYPE_COLOR */
 	NUM_COLUMNS
 };
 
@@ -88,19 +90,27 @@
 			COLUMN_NAME, name,
 			COLUMN_SENSITIVE, FALSE,
 			COLUMN_SOURCE, groups->data,
+			COLUMN_COLOR, NULL,
 			-1);
 
 		for (sources = e_source_group_peek_sources (groups->data);
 			sources != NULL; sources = sources->next) {
+			const char *colour;
+			GdkColor c;
 
 			name = e_source_peek_name (sources->data);
 			indented_name = g_strconcat ("    ", name, NULL);
+			colour = e_source_peek_color_spec (sources->data);
+			if (colour)
+				gdk_color_parse (colour, &c);
+
 			gtk_list_store_append (store, &iter);
 			gtk_list_store_set (
 				store, &iter,
 				COLUMN_NAME, indented_name,
 				COLUMN_SENSITIVE, TRUE,
 				COLUMN_SOURCE, sources->data,
+				COLUMN_COLOR, colour ? &c : NULL,
 				-1);
 			g_free (indented_name);
 
@@ -127,10 +137,19 @@
 		type, n_construct_properties, construct_properties);
 
 	store = gtk_list_store_new (
-		NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_OBJECT);
+		NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_OBJECT, GDK_TYPE_COLOR);
 	gtk_combo_box_set_model (
 		GTK_COMBO_BOX (object), GTK_TREE_MODEL (store));
 
+	renderer = e_cell_renderer_color_new ();
+	gtk_cell_layout_pack_start (
+		GTK_CELL_LAYOUT (object), renderer, FALSE);
+	gtk_cell_layout_set_attributes (
+		GTK_CELL_LAYOUT (object), renderer,
+		"color", COLUMN_COLOR,
+		"sensitive", COLUMN_SENSITIVE,
+		NULL);
+
 	renderer = gtk_cell_renderer_text_new ();
 	gtk_cell_layout_pack_start (
 		GTK_CELL_LAYOUT (object), renderer, TRUE);
Index: libedataserverui/ChangeLog
===================================================================
--- libedataserverui/ChangeLog	(revision 8146)
+++ libedataserverui/ChangeLog	(working copy)
@@ -1,3 +1,15 @@
+2007-10-24  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #460649
+
+	* Makefile.am:
+	* e-cell-renderer-color.h:
+	* e-cell-renderer-color.c:
+	New source files to render color in cell.
+	* e-source-combo-box.c: (source_list_changed_cb),
+	(e_source_combo_box_constructor):
+	New column to render also color of the source.
+
 2007-10-22  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes part of bug #417999
Index: libedataserverui/e-cell-renderer-color.c
===================================================================
--- libedataserverui/e-cell-renderer-color.c	(revision 0)
+++ libedataserverui/e-cell-renderer-color.c	(revision 0)
@@ -0,0 +1,249 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-cell-renderer-color.c
+ *
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+ 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-cell-renderer-color.h"
+
+#define E_CELL_RENDERER_COLOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), E_TYPE_CELL_RENDERER_COLOR, ECellRendererColorPrivate))
+
+struct _ECellRendererColorPrivate
+{
+	gboolean have_color;
+	GdkColor color;
+};
+
+static void e_cell_renderer_color_get_property  (GObject                    *object,
+						 guint                       param_id,
+						 GValue                     *value,
+						 GParamSpec                 *pspec);
+static void e_cell_renderer_color_set_property  (GObject                    *object,
+						 guint                       param_id,
+						 const GValue               *value,
+						 GParamSpec                 *pspec);
+static void e_cell_renderer_color_finalize   (GObject                    *object);
+static void e_cell_renderer_color_get_size   (GtkCellRenderer              *cell,
+					      GtkWidget                    *widget,
+					      GdkRectangle                 *rectangle,
+					      gint                         *x_offset,
+					      gint                         *y_offset,
+					      gint                         *width,
+					      gint                         *height);
+static void e_cell_renderer_color_render     (GtkCellRenderer              *cell,
+					      GdkDrawable                  *window,
+					      GtkWidget                    *widget,
+					      GdkRectangle                 *background_area,
+					      GdkRectangle                 *cell_area,
+					      GdkRectangle                 *expose_area,
+					      GtkCellRendererState          flags);
+
+
+enum {
+	PROP_ZERO,
+	PROP_COLOR
+};
+
+G_DEFINE_TYPE (ECellRendererColor, e_cell_renderer_color, GTK_TYPE_CELL_RENDERER)
+
+static void
+e_cell_renderer_color_class_init (ECellRendererColorClass *class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (class);
+	GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
+
+	g_type_class_add_private (class, sizeof (ECellRendererColor));
+
+	object_class->finalize = e_cell_renderer_color_finalize;
+
+	object_class->get_property = e_cell_renderer_color_get_property;
+	object_class->set_property = e_cell_renderer_color_set_property;
+
+	cell_class->get_size = e_cell_renderer_color_get_size;
+	cell_class->render = e_cell_renderer_color_render;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_COLOR,
+		g_param_spec_boxed (
+			"color",
+			("Color Info"),
+			("The color to render"),
+			GDK_TYPE_COLOR,
+			G_PARAM_READWRITE));
+}
+
+static void
+e_cell_renderer_color_init (ECellRendererColor *cellcolor)
+{
+	((GtkCellRenderer*)cellcolor)->xpad = 4;
+
+	cellcolor->priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cellcolor);
+
+	cellcolor->priv->have_color = FALSE;
+}
+
+static void
+e_cell_renderer_color_finalize (GObject *object)
+{
+	(* G_OBJECT_CLASS (e_cell_renderer_color_parent_class)->finalize) (object);
+}
+
+static void
+e_cell_renderer_color_get_property (GObject        *object,
+				    guint           param_id,
+				    GValue         *value,
+				    GParamSpec     *pspec)
+{
+	ECellRendererColor *cellcolor = E_CELL_RENDERER_COLOR (object);
+	ECellRendererColorPrivate *priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cellcolor);
+
+	switch (param_id) {
+	case PROP_COLOR: {
+		GdkColor color = priv->color;
+
+		if (!priv->have_color) {
+			color.pixel = 0;
+			color.red = 0;
+			color.green = 0;
+			color.blue = 0;
+		}
+
+		g_value_set_boxed (value, &color);
+	} break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+	break;
+    }
+}
+
+static void
+e_cell_renderer_color_set_property (GObject      *object,
+				    guint         param_id,
+				    const GValue *value,
+				    GParamSpec   *pspec)
+{
+	ECellRendererColor *cellcolor = E_CELL_RENDERER_COLOR (object);
+	ECellRendererColorPrivate *priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cellcolor);
+  
+	switch (param_id) {
+	case PROP_COLOR: {
+		GdkColor *color = g_value_get_boxed (value);
+
+		priv->have_color = color != NULL;
+		if (color)
+			priv->color = *color;
+	} break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+	break;
+    }
+}
+
+GtkCellRenderer *
+e_cell_renderer_color_new (void)
+{
+	return g_object_new (E_TYPE_CELL_RENDERER_COLOR, NULL);
+}
+
+static void
+e_cell_renderer_color_get_size (GtkCellRenderer *cell,
+				GtkWidget       *widget,
+				GdkRectangle    *cell_area,
+				gint            *x_offset,
+				gint            *y_offset,
+				gint            *width,
+				gint            *height)
+{
+	gint color_width  = 16;
+	gint color_height = 16;
+	gint calc_width;
+	gint calc_height;
+
+	calc_width  = (gint) cell->xpad * 2 + color_width;
+	calc_height = (gint) cell->ypad * 2 + color_height;
+  
+	if (cell_area && color_width > 0 && color_height > 0) {
+		if (x_offset) {
+			*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
+					(1.0 - cell->xalign) : cell->xalign) * 
+					(cell_area->width - calc_width));
+			*x_offset = MAX (*x_offset, 0);
+		}
+
+		if (y_offset) {
+			*y_offset = (cell->yalign *
+				(cell_area->height - calc_height));
+			*y_offset = MAX (*y_offset, 0);
+		}
+	} else {
+		if (x_offset) *x_offset = 0;
+		if (y_offset) *y_offset = 0;
+	}
+
+	if (width)
+		*width = calc_width;
+
+	if (height)
+		*height = calc_height;
+}
+
+static void
+e_cell_renderer_color_render (GtkCellRenderer      *cell,
+			      GdkWindow            *window,
+			      GtkWidget            *widget,
+			      GdkRectangle         *background_area,
+			      GdkRectangle         *cell_area,
+			      GdkRectangle         *expose_area,
+			      GtkCellRendererState  flags)
+
+{
+	ECellRendererColor *cellcolor = E_CELL_RENDERER_COLOR (cell);
+	ECellRendererColorPrivate *priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cellcolor);
+	GdkRectangle pix_rect;
+	GdkRectangle draw_rect;
+	GdkGC *gc;
+
+	if (!priv->have_color)
+		return;
+
+	e_cell_renderer_color_get_size (cell, widget, cell_area,
+					&pix_rect.x,
+					&pix_rect.y,
+					&pix_rect.width,
+					&pix_rect.height);
+
+	pix_rect.x += cell_area->x + cell->xpad;
+	pix_rect.y += cell_area->y + cell->ypad;
+	pix_rect.width  -= cell->xpad * 2;
+	pix_rect.height -= cell->ypad * 2;
+
+	if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) ||
+	    !gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
+		return;
+
+	gdk_colormap_alloc_color (gdk_colormap_get_system(), &priv->color, FALSE, TRUE);
+	
+	gc = gdk_gc_new (window);
+	gdk_gc_set_foreground (gc, &priv->color);
+	gdk_draw_rectangle (window, gc, TRUE, pix_rect.x, pix_rect.y, draw_rect.width, draw_rect.height);
+	g_object_unref (gc);
+}
Index: libedataserverui/e-cell-renderer-color.h
===================================================================
--- libedataserverui/e-cell-renderer-color.h	(revision 0)
+++ libedataserverui/e-cell-renderer-color.h	(revision 0)
@@ -0,0 +1,64 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-cell-renderer-color.h
+ *
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 details.
+ *
+ * You should have received a copy of the GNU Lesser 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 _E_CELL_RENDERER_COLOR_H_
+#define _E_CELL_RENDERER_COLOR_H_
+
+
+#include <glib.h>
+#include <gtk/gtkcellrenderer.h>
+
+#define E_TYPE_CELL_RENDERER_COLOR		(e_cell_renderer_color_get_type ())
+#define E_CELL_RENDERER_COLOR(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CELL_RENDERER_COLOR, ECellRendererColor))
+#define E_CELL_RENDERER_COLOR_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CELL_RENDERER_COLOR, ECellRendererColorClass))
+#define E_IS_CELL_RENDERER_COLOR(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CELL_RENDERER_COLOR))
+#define E_IS_CELL_RENDERER_COLOR_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CELL_RENDERER_COLOR))
+#define E_CELL_RENDERER_COLOR_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CELL_RENDERER_COLOR, ECellRendererColorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECellRendererColor ECellRendererColor;
+typedef struct _ECellRendererColorClass ECellRendererColorClass;
+typedef struct _ECellRendererColorPrivate ECellRendererColorPrivate;
+
+struct _ECellRendererColor
+{
+	GtkCellRenderer parent;
+
+	ECellRendererColorPrivate *priv;
+};
+
+struct _ECellRendererColorClass
+{
+	GtkCellRendererClass parent_class;
+
+	/* Padding for future expansion */
+	void (*_gtk_reserved1) (void);
+	void (*_gtk_reserved2) (void);
+	void (*_gtk_reserved3) (void);
+	void (*_gtk_reserved4) (void);
+};
+
+GType            e_cell_renderer_color_get_type (void);
+GtkCellRenderer *e_cell_renderer_color_new      (void);
+
+G_END_DECLS
+
+#endif /* _E_CELL_RENDERER_COLOR_H_ */
Index: libedataserverui/Makefile.am
===================================================================
--- libedataserverui/Makefile.am	(revision 8146)
+++ libedataserverui/Makefile.am	(working copy)
@@ -33,7 +33,8 @@
 	e-source-selector-dialog.c	\
 	e-source-combo-box.c		\
 	e-source-option-menu.c		\
-	e-tree-model-generator.c
+	e-tree-model-generator.c	\
+	e-cell-renderer-color.c
 
 libedataserverui_1_2_la_LIBADD = 				\
 	$(top_builddir)/addressbook/libebook/libebook-1.2.la	\
@@ -60,7 +61,8 @@
 	e-source-selector-dialog.h	\
 	e-source-combo-box.h		\
 	e-source-option-menu.h		\
-	e-tree-model-generator.h
+	e-tree-model-generator.h	\
+	e-cell-renderer-color.h
 
 # Test programs
 test_source_selector_SOURCES = test-source-selector.c
