[evolution-patches] UI : Patch for Bug # 257118




    have attached a patch for the bug # 257118.

    i have added the code such that whenever the clear button is clicked, the clear button is disabled.

    When the search query is also changed to message contains or some other options, based on the text present in the entry of the search bar entry , the clear button will be disabled or enabled.

     This patch is also applicable for the menu item find now and clear options.
--
Luv,
S.Antony Vincent Pandian
--- /home/evolution/Antony/filter_bar_bug/e-search-bar.c	2005-08-27 13:40:35.000000000 +0530
+++ e-search-bar.c	2005-08-27 16:04:25.002045736 +0530
@@ -94,6 +94,17 @@ set_find_now_sensitive (ESearchBar *sear
 	gtk_widget_set_sensitive (search_bar->activate_button, sensitive);
 }
 
+static void 
+set_clear_sensitive (ESearchBar *search_bar,
+		     gboolean sensitive)
+{
+	if (search_bar->ui_component != NULL)
+		bonobo_ui_component_set_prop (search_bar->ui_component,
+					      "/commands/ESearchBar:Clear",
+					      "sensitive", sensitive ? "1" : "0", NULL);
+	gtk_widget_set_sensitive (search_bar->clear_button, sensitive);
+}
+
 static char *
 verb_name_from_id (int id)
 {
@@ -119,6 +130,7 @@ clear_search (ESearchBar *esb)
 	activate_by_subitems (esb, 0, subitems);
 
 	emit_search_activated (esb);
+	set_clear_sensitive (esb, FALSE);
 }
 
 /* Frees an array of subitem information */
@@ -233,6 +245,7 @@ setup_standard_verbs (ESearchBar *search
 
 	/* Make sure the entries are created with the correct sensitivity.  */
 	set_find_now_sensitive (search_bar, FALSE);
+	set_clear_sensitive (search_bar, FALSE);
 }
 
 /* Callbacks -- The verbs for all the definable items.  */
@@ -267,6 +280,7 @@ entry_changed_cb (GtkWidget *widget,
 		  ESearchBar *esb)
 {
 	set_find_now_sensitive (esb, TRUE);
+	set_clear_sensitive (esb, TRUE);
 }
 
 static void
@@ -281,6 +295,7 @@ subitem_activated_cb (GtkWidget *widget,
 	esb->subitem_id = subid;
 
 	set_find_now_sensitive (esb, TRUE);
+	set_clear_sensitive (esb, TRUE);
 	
 	gtk_widget_grab_focus (esb->entry);
 }
@@ -427,8 +442,10 @@ activate_by_subitems (ESearchBar *esb, g
 		gtk_option_menu_set_menu (GTK_OPTION_MENU (esb->suboption), menu);
 	}
 
-	if (esb->activate_button)
+	if (esb->activate_button && strlen (gtk_entry_get_text (esb->entry)) != 0){ 
 		gtk_widget_set_sensitive (esb->activate_button, subitems == NULL);
+		gtk_widget_set_sensitive (esb->clear_button, subitems == NULL);
+	}
 }
 
 static void
--- /home/evolution/Antony/filter_bar_bug/ChangeLog_misc	2005-08-27 14:02:15.000000000 +0530
+++ ChangeLog	2005-08-27 14:48:04.000000000 +0530
@@ -1,3 +1,11 @@
+2005-08-27  S.Antony Vincent Pandian <santony gmail com>
+
+	* e-search-bar.c: Added a new function set_clear_sensitive to set the
+	sensitivity of the clear option.Whenever the search is activated, the
+	clear button is activated and deactivated if clear button is clicked.
+
+	Fixes # 257118
+
 2005-07-29  Srinivasa Ragavan <sragavan novell com>
 
 	* e-attachment.c: (e_attachment_new_from_mime_part) used ref instead of 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]