Index: ChangeLog
===================================================================
--- ChangeLog	(revision 7842)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2007-06-27  Milan Crha  <mcrha@redhat.com>
+
+	* libedataserver/e-categories.c: (e_categories_get_icon_file_for):
+	Removed runtime warning message during work on bug #308815.
+
 2007-06-19  Karsten Bräckelmann  <guenther@rudersport.de>
 
 	* configure.in: Correct the comment for --enable-gnome-keyring,
Index: libedataserverui/e-categories-dialog.c
===================================================================
--- libedataserverui/e-categories-dialog.c	(revision 7842)
+++ libedataserverui/e-categories-dialog.c	(working copy)
@@ -36,6 +36,7 @@
 #include <gtk/gtkstock.h>
 #include <gtk/gtktreeselection.h>
 #include <gtk/gtktreeview.h>
+#include <gtk/gtkcolorbutton.h>
 #include <glade/glade-xml.h>
 #include <libedataserver/e-categories.h>
 #include <libedataserver/libedataserver-private.h>
@@ -269,10 +270,18 @@
 				gtk_widget_destroy (error_dialog);
 				g_free (correct_category_name);
 			} else {
-				/* FIXME: get color */
+				GdkColor color;
+				gchar *category_color = NULL;
+
+				gtk_color_button_get_color (GTK_COLOR_BUTTON (prop_dialog->category_color), &color);
+				if (color.red || color.green || color.blue)
+					category_color = g_strdup_printf ("#%04x%04x%04x", color.red, color.green, color.blue);
 				category_icon = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon));
 
-				e_categories_add (correct_category_name, NULL, category_icon ? category_icon : NULL, TRUE);
+				e_categories_add (correct_category_name, 
+						  category_color ? category_color : NULL, 
+						  category_icon ? category_icon : NULL,
+						  TRUE);
 
 				gtk_list_store_append (
 					GTK_LIST_STORE (gtk_tree_view_get_model (
@@ -284,6 +293,7 @@
 					&iter, 0, FALSE, 1, correct_category_name, -1);
 
 				g_free (correct_category_name);
+				g_free (category_color);
 
 				break;
 			}
@@ -303,6 +313,7 @@
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	char *category_name;
+	const char *tmp;
 
 	dialog = user_data;
 	priv = dialog->priv;
@@ -322,17 +333,35 @@
 	gtk_tree_model_get (model, &iter, 1, &category_name, -1);
 	gtk_entry_set_text (GTK_ENTRY (prop_dialog->category_name), category_name);
 	gtk_widget_set_sensitive (prop_dialog->category_name, FALSE);
-	gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon), 
-				       e_categories_get_icon_file_for (category_name));
+	
+	tmp = e_categories_get_icon_file_for (category_name);
+	if(tmp)
+		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon), tmp);
 
+	tmp = e_categories_get_color_for (category_name);
+	if (tmp) {
+		GdkColor color;
+
+		if (gdk_color_parse (tmp, &color))
+			gtk_color_button_set_color (GTK_COLOR_BUTTON (prop_dialog->category_color), &color);
+	}
+
 	if (gtk_dialog_run (GTK_DIALOG (prop_dialog->the_dialog)) == GTK_RESPONSE_OK) {
 		const char *category_icon;
+		GdkColor color;
+		gchar *category_color = NULL;
 
-		/* FIXME: get color */
+		gtk_color_button_get_color (GTK_COLOR_BUTTON (prop_dialog->category_color), &color);
+		if (color.red || color.green || color.blue)
+			category_color = g_strdup_printf ("#%04x%04x%04x", color.red, color.green, color.blue);
 		category_icon = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon));
 
 		if (category_icon)
 			e_categories_set_icon_file_for (category_name, category_icon);
+
+		e_categories_set_color_for (category_name, category_color);
+
+		g_free (category_color);
 	}
 
 	g_free (category_name);
Index: libedataserverui/ChangeLog
===================================================================
--- libedataserverui/ChangeLog	(revision 7842)
+++ libedataserverui/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2007-06-27  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #308815
+
+	* e-categories-dialog.c: (new_button_clicked_cb),
+	(edit_button_clicked_cb):
+	Gets/sets color to category to/from dialog.
+
 2007-06-15  Matthew Barnes  <mbarnes@redhat.com>
 
 	* e-passwords.c (ep_forget_password_keyring),
Index: libedataserver/e-categories.c
===================================================================
--- libedataserver/e-categories.c	(revision 7842)
+++ libedataserver/e-categories.c	(working copy)
@@ -563,8 +563,10 @@
 		initialize_categories ();
 
 	cat_info = g_hash_table_lookup (categories_table, category);
-	g_return_val_if_fail (cat_info != NULL, NULL);
 
+	if (cat_info == NULL)
+		return NULL;
+
 	return cat_info->icon_file;
 }
 
