Index: libedataserverui/e-categories-dialog.glade
===================================================================
--- libedataserverui/e-categories-dialog.glade	(revision 9791)
+++ libedataserverui/e-categories-dialog.glade	(working copy)
@@ -435,13 +435,11 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkFileChooserButton" id="category-icon">
+	    <widget class="Custom" id="category-icon">
 	      <property name="visible">True</property>
-	      <property name="title" translatable="yes">Category Icon</property>
-	      <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
-	      <property name="local_only">True</property>
-	      <property name="show_hidden">False</property>
-	      <property name="width_chars">-1</property>
+	      <property name="creation_function">create_category_icon_chooser_widget</property>
+	      <property name="int1">0</property>
+	      <property name="int2">0</property>
 	    </widget>
 	    <packing>
 	      <property name="left_attach">1</property>
Index: libedataserverui/e-categories-dialog.c
===================================================================
--- libedataserverui/e-categories-dialog.c	(revision 9792)
+++ libedataserverui/e-categories-dialog.c	(working copy)
@@ -423,9 +423,11 @@ edit_button_clicked_cb (GtkButton *butto
 
 		category_icon = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop_dialog->category_icon));
 
+		e_categories_set_icon_file_for (category_name, category_icon);
+
 		if (category_icon) {
 			GdkPixbuf *icon = NULL;
-			e_categories_set_icon_file_for (category_name, category_icon);
+
 			icon = gdk_pixbuf_new_from_file (category_icon, NULL);
 			if (icon) {
 				gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_ICON, icon, -1);
@@ -433,7 +435,10 @@ edit_button_clicked_cb (GtkButton *butto
 			}
 
 			g_free (category_icon);
+		} else {
+			gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_ICON, NULL, -1);
 		}
+
 		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
 	}
 
@@ -629,3 +634,56 @@ e_categories_dialog_set_categories (ECat
 		} while (gtk_tree_model_iter_next (model, &iter));
 	}
 }
+
+struct chooser_button_struct {
+	GtkFileChooserButton *button;
+};
+
+static void
+file_chooser_response (GtkDialog *dialog, gint response_id, struct chooser_button_struct *data)
+{
+	g_return_if_fail (data != NULL);
+	g_return_if_fail (data->button != NULL);
+
+	if (response_id == GTK_RESPONSE_NO) {
+		gtk_file_chooser_button_select_none (data->button);
+	}
+}
+
+GtkWidget *create_category_icon_chooser_widget (void);
+
+GtkWidget *
+create_category_icon_chooser_widget (void)
+{
+	GtkWidget *dialog, *button;
+	struct chooser_button_struct *data = g_new0 (struct chooser_button_struct, 1);
+
+	dialog = gtk_file_chooser_dialog_new ( _("Choose an icon"),
+		NULL,
+		GTK_FILE_CHOOSER_ACTION_OPEN,
+		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+		NULL);
+
+	button = gtk_button_new_with_mnemonic (_("_No Image"));
+	gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_BUTTON));
+	gtk_widget_show (button);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_NO);
+	gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT);
+	button = NULL;
+
+	/* have this signal catch before the button, otherwise it reselects the old file;
+	   it's in the 'data' because it requires the 'button', but it doesn't exist yet. */
+	g_signal_connect (dialog, "response", (GCallback) file_chooser_response, data);
+
+	button = gtk_file_chooser_button_new_with_dialog (dialog);
+	data->button = GTK_FILE_CHOOSER_BUTTON (button);
+
+	g_object_set_data_full (G_OBJECT (button), "dlg-response-data", data, g_free);
+
+	gtk_file_chooser_set_action (GTK_FILE_CHOOSER (button), GTK_FILE_CHOOSER_ACTION_OPEN);
+	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (button), TRUE);
+
+	gtk_widget_show (button);
+
+	return button;
+}
Index: libedataserverui/ChangeLog
===================================================================
--- libedataserverui/ChangeLog	(revision 9792)
+++ libedataserverui/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2008-12-03  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #332496
+
+	* e-categories-dialog.glade: Make a custom widget.
+	* e-categories-dialog.c: (edit_button_clicked_cb),
+	(file_chooser_response), (create_category_icon_chooser_widget):
+	Be able to deselect icon for the category.
+
 2008-12-03  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #357948
