Index: filter/filter-rule.c
===================================================================
--- filter/filter-rule.c	(revision 33664)
+++ filter/filter-rule.c	(working copy)
@@ -198,7 +198,7 @@
 filter_rule_validate (FilterRule *fr)
 {
 	g_assert (IS_FILTER_RULE (fr));
-	
+
 	return FILTER_RULE_GET_CLASS (fr)->validate (fr);
 }
 
@@ -220,6 +220,7 @@
 	
 	/* validate rule parts */
 	parts = fr->parts;
+	valid = parts != NULL;
 	while (parts && valid) {
 		valid = filter_part_validate ((FilterPart *) parts->data);
 		parts = parts->next;
@@ -693,7 +694,7 @@
 	FilterPart *part;
 	GtkWidget *rule;
 	
-	if (g_list_length (data->fr->parts) < 2)
+	if (g_list_length (data->fr->parts) < 1)
 		return;
 	
 	rule = g_object_get_data ((GObject *) button, "rule");
Index: filter/rule-editor.c
===================================================================
--- filter/rule-editor.c	(revision 33664)
+++ filter/rule-editor.c	(working copy)
@@ -50,6 +50,8 @@
 static void rule_editor_finalise (GObject *obj);
 static void rule_editor_destroy (GtkObject *obj);
 
+static void dialog_rule_changed (FilterRule *fr, GtkWidget *dialog);
+
 #define _PRIVATE(x)(((RuleEditor *)(x))->priv)
 
 enum {
@@ -385,7 +387,10 @@
 	
 	g_signal_connect (re->dialog, "response", G_CALLBACK (add_editor_response), re);
 	g_object_weak_ref ((GObject *) re->dialog, (GWeakNotify) editor_destroy, re);
-	
+
+	g_signal_connect (re->edit, "changed", G_CALLBACK (dialog_rule_changed), re->dialog);
+	dialog_rule_changed (re->edit, re->dialog);
+
 	gtk_widget_set_sensitive (GTK_WIDGET (re), FALSE);
 	
 	gtk_widget_show (re->dialog);
@@ -461,7 +466,10 @@
 	
 	g_signal_connect (re->dialog, "response", G_CALLBACK (edit_editor_response), re);
 	g_object_weak_ref ((GObject *) re->dialog, (GWeakNotify) editor_destroy, re);
-	
+
+	g_signal_connect (re->edit, "changed", G_CALLBACK (dialog_rule_changed), re->dialog);
+	dialog_rule_changed (re->edit, re->dialog);
+
 	gtk_widget_set_sensitive (GTK_WIDGET (re), FALSE);
 	
 	gtk_widget_show (re->dialog);
@@ -653,7 +661,14 @@
 	gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_BOTTOM]), index >= 0 && index < count);
 }
 
+static void
+dialog_rule_changed (FilterRule *fr, GtkWidget *dialog)
+{
+	g_return_if_fail (dialog != NULL);
 
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, fr && filter_rule_validate (fr));
+}
+
 static void
 cursor_changed (GtkTreeView *treeview, RuleEditor *re)
 {
Index: filter/ChangeLog
===================================================================
--- filter/ChangeLog	(revision 33664)
+++ filter/ChangeLog	(working copy)
@@ -1,3 +1,15 @@
+2007-06-12  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #263207
+
+	* filter-rule.c: (validate): No part is not valid.
+	* filter-rule.c: (less_parts): Can remove all parts.
+	* rule-editor.c: (dialog_rule_changed): New callback
+	for disabling OK button in dialog when rule isn't valid.
+	* rule-editor.c: (rule_add), (rule_edit):
+	Connecting dialog_rule_changed on "changed" signal of
+	actual rule.
+
 2007-06-04  Chenthill Palanisamy  <pchenthill@novell.com>
 
 	* rule-context.c: (new_element): Added a percentage 
Index: widgets/misc/ChangeLog
===================================================================
--- widgets/misc/ChangeLog	(revision 33664)
+++ widgets/misc/ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2007-06-12  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #263207
+
+	* e-filter-bar.c: (dialog_rule_changed): New callback
+	for disabling OK button in dialog when rule isn't valid.
+	* e-filter-bar.c: (do_advanced), (save_search_dialog):
+	Connecting dialog_rule_changed on "changed" signal of
+	actual rule.
+
 2007-06-04  Chenthill Palanisamy  <pchenthill@novell.com>
 
 	* e-filter-bar.[c]: (e_filter_bar_new), (e_filter_bar_new_construct):
Index: widgets/misc/e-filter-bar.c
===================================================================
--- widgets/misc/e-filter-bar.c	(revision 33664)
+++ widgets/misc/e-filter-bar.c	(working copy)
@@ -145,6 +145,14 @@
 }
 
 static void
+dialog_rule_changed (FilterRule *fr, GtkWidget *dialog)
+{
+	g_return_if_fail (dialog != NULL);
+
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, fr && filter_rule_validate (fr));
+}
+
+static void
 do_advanced (ESearchBar *esb)
 {
 	EFilterBar *efb = (EFilterBar *)esb;
@@ -184,7 +192,10 @@
 		
 		g_object_ref (rule);
 		g_object_set_data_full ((GObject *) dialog, "rule", rule, (GDestroyNotify) g_object_unref);
-		
+
+		g_signal_connect (rule, "changed", G_CALLBACK (dialog_rule_changed), dialog);
+		dialog_rule_changed (rule, dialog);
+
 		g_signal_connect (dialog, "response", G_CALLBACK (rule_advanced_response), efb);
 		g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
 		
@@ -222,18 +233,21 @@
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
 	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
-		
+
 	gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
-	
+
 	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), w, TRUE, TRUE, 0);
-			
+
 	g_object_ref (rule);
 	g_object_set_data_full ((GObject *) dialog, "rule", rule, (GDestroyNotify) g_object_unref);
 	g_signal_connect (dialog, "response", G_CALLBACK (rule_editor_response), efb);
 	g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
-			
+
+	g_signal_connect (rule, "changed", G_CALLBACK (dialog_rule_changed), dialog);
+	dialog_rule_changed (rule, dialog);
+
 	e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
-		
+
 	gtk_widget_show (dialog);
 }
 
