Index: ChangeLog
===================================================================
--- ChangeLog	(revision 8185)
+++ ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2007-11-05  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #308815
+
+	* libedataserver/e-categories.h:
+	* libedataserver/e-categories.c: Dropped colors for categories,
+	so marking those functions as deprecated, and making deprecated
+	parameter 'color' of 'e_categories_add' together with its rename
+	to 'unused'.
+
 2007-10-29  Srinivasa Ragavan  <sragavan@novell.com>
 
 	* NEWS, configure.in: Evolution Data Server 2.21.1 release.
Index: libedataserverui/e-categories-dialog.glade
===================================================================
--- libedataserverui/e-categories-dialog.glade	(revision 8185)
+++ libedataserverui/e-categories-dialog.glade	(working copy)
@@ -389,31 +389,6 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkLabel" id="label5">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Category _Color</property>
-	      <property name="use_underline">True</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <property name="mnemonic_widget">category-color</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkLabel" id="label6">
 	      <property name="visible">True</property>
 	      <property name="label" translatable="yes">Category _Icon</property>
@@ -460,23 +435,6 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkColorButton" id="category-color">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="use_alpha">False</property>
-	      <property name="focus_on_click">True</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options"></property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkFileChooserButton" id="category-icon">
 	      <property name="visible">True</property>
 	      <property name="title" translatable="yes">Category Icon</property>
Index: libedataserverui/e-categories-dialog.c
===================================================================
--- libedataserverui/e-categories-dialog.c	(revision 8185)
+++ libedataserverui/e-categories-dialog.c	(working copy)
@@ -69,7 +69,6 @@
 	GladeXML *gui;
 	GtkWidget *the_dialog;
 	GtkWidget *category_name;
-	GtkWidget *category_color;
 	GtkWidget *category_icon;
 } CategoryPropertiesDialog;
 
@@ -98,7 +97,6 @@
 	gtk_window_set_transient_for (GTK_WINDOW (prop_dialog->the_dialog), GTK_WINDOW (parent));
 
 	prop_dialog->category_name = glade_xml_get_widget (prop_dialog->gui, "category-name");
-	prop_dialog->category_color = glade_xml_get_widget (prop_dialog->gui, "category-color");
 	prop_dialog->category_icon = glade_xml_get_widget (prop_dialog->gui, "category-icon");
 
 	return prop_dialog;
@@ -284,12 +282,12 @@
 				GdkPixbuf *icon = NULL;
 				GtkListStore *list_store = GTK_LIST_STORE (
 								gtk_tree_view_get_model (GTK_TREE_VIEW (prop_dialog->parent->priv->categories_list)));
-				/* FIXME: get color */
+
 				category_icon = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon));
 				if (category_icon)
 					icon = gdk_pixbuf_new_from_file (category_icon, NULL);
 
-				e_categories_add (correct_category_name, NULL, category_icon ? category_icon : NULL, TRUE);
+				e_categories_add (correct_category_name, NULL, category_icon, TRUE);
 
 				gtk_list_store_append (list_store, &iter);
 				gtk_list_store_set (list_store, &iter,
@@ -322,6 +320,7 @@
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	char *category_name;
+	const char *icon_file;
 
 	dialog = user_data;
 	priv = dialog->priv;
@@ -341,13 +340,14 @@
 	gtk_tree_model_get (model, &iter, COLUMN_CATEGORY, &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));
 
+	icon_file = e_categories_get_icon_file_for (category_name);
+	if (icon_file)
+		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon), icon_file);
+
 	if (gtk_dialog_run (GTK_DIALOG (prop_dialog->the_dialog)) == GTK_RESPONSE_OK) {
 		gchar *category_icon;
 
-		/* FIXME: get color */
 		category_icon = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon));
 
 		if (category_icon) {
Index: libedataserverui/ChangeLog
===================================================================
--- libedataserverui/ChangeLog	(revision 8185)
+++ libedataserverui/ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2007-11-05  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #308815
+
+	* e-categories-dialog.glade:
+	* e-categories-dialog.c: Dropped colors for categories. (deprecated)
+
+	* e-categories-dialog.c: (edit_button_clicked_cb): Fixed runtime
+	critical warning for file chooser and category without icon.
+
 2007-11-05  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #318842
Index: libedataserver/e-categories.c
===================================================================
--- libedataserver/e-categories.c	(revision 8185)
+++ libedataserver/e-categories.c	(working copy)
@@ -33,7 +33,9 @@
 typedef struct {
 	char *category;
 	char *icon_file;
+	#ifndef EDS_DISABLE_DEPRECATED
 	char *color;
+	#endif
 	gboolean searchable;
 } CategoryInfo;
 
@@ -81,7 +83,9 @@
 {
 	g_free (cat_info->category);
 	g_free (cat_info->icon_file);
+	#ifndef EDS_DISABLE_DEPRECATED
 	g_free (cat_info->color);
+	#endif
 	g_free (cat_info);
 }
 
@@ -133,9 +137,11 @@
 		g_string_append_printf (
 			string, " icon=\"%s\"", cat_info->icon_file);
 
+	#ifndef EDS_DISABLE_DEPRECATED
 	if (cat_info->color != NULL)
 		g_string_append_printf (
 			string, " color=\"%s\"", cat_info->color);
+	#endif
 
 	g_string_append_printf (
 		string, " searchable=\"%d\"", cat_info->searchable);
@@ -208,17 +214,26 @@
 	}
 
 	for (node = node->xmlChildrenNode; node != NULL; node = node->next) {
-		xmlChar *category, *icon, *color, *searchable;
+		xmlChar *category, *icon, *searchable;
+		#ifndef EDS_DISABLE_DEPRECATED
+		xmlChar *color;
+		#endif
 
 		category = xmlGetProp (node, (xmlChar *) "a");
 		icon = xmlGetProp (node, (xmlChar *) "icon");
+		#ifndef EDS_DISABLE_DEPRECATED
 		color = xmlGetProp (node, (xmlChar *) "color");
+		#endif
 		searchable = xmlGetProp (node, (xmlChar *) "searchable");
 
 		if (category != NULL) {
 			e_categories_add (
 				(gchar *) category,
+				#ifndef EDS_DISABLE_DEPRECATED
 				(gchar *) color,
+				#else
+				NULL,
+				#endif
 				(gchar *) icon,
 				(searchable != NULL) &&
 				strcmp ((gchar *) searchable, "0") != 0);
@@ -227,7 +242,9 @@
 
 		xmlFree (category);
 		xmlFree (icon);
+		#ifndef EDS_DISABLE_DEPRECATED
 		xmlFree (color);
+		#endif
 		xmlFree (searchable);
 	}
 
@@ -336,7 +353,12 @@
 			cat_info->icon_file = g_build_filename (E_DATA_SERVER_IMAGESDIR, cat_info->icon_file, NULL);
 		e_categories_add (
 			gettext (cat_info->category),
-			NULL, cat_info->icon_file, TRUE);
+			#ifndef EDS_DISABLE_DEPRECATED
+			cat_info->color,
+			#else
+			NULL,
+			#endif
+			cat_info->icon_file, TRUE);
 		g_free (cat_info->icon_file);
 		cat_info++;
 	}
@@ -429,15 +451,15 @@
 /**
  * e_categories_add:
  * @category: name of category to add.
- * @color: associated color.
+ * @unused: DEPRECATED! associated color. DEPRECATED!
  * @icon_file: full path of the icon associated to the category.
  * @searchable: whether the category can be used for searching in the GUI.
  *
- * Adds a new category, with its corresponding color and icon, to the
+ * Adds a new category, with its corresponding icon, to the
  * configuration database.
  */
 void
-e_categories_add (const char *category, const char *color, const char *icon_file, gboolean searchable)
+e_categories_add (const char *category, const char *unused, const char *icon_file, gboolean searchable)
 {
 	CategoryInfo *cat_info;
 
@@ -449,7 +471,9 @@
 	/* add the new category */
 	cat_info = g_new0 (CategoryInfo, 1);
 	cat_info->category = g_strdup (category);
-	cat_info->color = g_strdup (color);
+#ifndef EDS_DISABLE_DEPRECATED
+	cat_info->color = g_strdup (unused);
+#endif
 	cat_info->icon_file = g_strdup (icon_file);
 	cat_info->searchable = searchable;
 
@@ -495,6 +519,7 @@
 	return (g_hash_table_lookup (categories_table, category) != NULL);
 }
 
+#ifndef EDS_DISABLE_DEPRECATED
 /**
  * e_categories_get_color_for:
  * @category: category to retrieve the color for.
@@ -502,6 +527,8 @@
  * Gets the color associated with the given category.
  *
  * Return value: a string representation of the color.
+ *
+ * DEPRECATED!
  */
 const char *
 e_categories_get_color_for (const char *category)
@@ -526,6 +553,8 @@
  * @color: X color.
  *
  * Sets the color associated with the given category.
+ *
+ * DEPRECATED!
  */
 void
 e_categories_set_color_for (const char *category, const char *color)
@@ -544,6 +573,7 @@
 	cat_info->color = g_strdup (color);
 	save_categories ();
 }
+#endif /* EDS_DISABLE_DEPRECATED */
 
 /**
  * e_categories_get_icon_file_for:
@@ -551,7 +581,7 @@
  *
  * Gets the icon file associated with the given category.
  *
- * Return value: a string representation of the color.
+ * Return value: icon file name.
  */
 const char *
 e_categories_get_icon_file_for (const char *category)
@@ -573,7 +603,7 @@
 /**
  * e_categories_set_icon_file_for:
  * @category: category to set the icon file for.
- * @color: X color.
+ * @icon_file: icon file.
  *
  * Sets the icon file associated with the given category.
  */
Index: libedataserver/e-categories.h
===================================================================
--- libedataserver/e-categories.h	(revision 8185)
+++ libedataserver/e-categories.h	(working copy)
@@ -27,12 +27,16 @@
 
 GList      *e_categories_get_list (void);
 
-void        e_categories_add (const char *category, const char *color, const char *icon_file, gboolean searchable);
+/* 'unused' parameter was 'icon', but it is deprecated now (see bug #308815) */
+void        e_categories_add (const char *category, const char *unused, const char *icon_file, gboolean searchable);
+
 void        e_categories_remove (const char *category);
 
 gboolean    e_categories_exist (const char *category);
+#ifndef EDS_DISABLE_DEPRECATED
 const char *e_categories_get_color_for (const char *category);
 void        e_categories_set_color_for (const char *category, const char *color);
+#endif
 const char *e_categories_get_icon_file_for (const char *category);
 void        e_categories_set_icon_file_for (const char *category, const char *icon_file);
 gboolean    e_categories_is_searchable (const char *category);
