[evolution-patches] [addressbook] Patch for Bug #273799:missing category filter in the "choose contact dialog"



Hi ,

The attached patch fixes 273799.

thanks
Devashish Sharma
Index: libedataserverui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/ChangeLog,v
retrieving revision 1.62
diff -u -p -r1.62 ChangeLog
--- libedataserverui/ChangeLog	26 Aug 2005 11:44:47 -0000	1.62
+++ libedataserverui/ChangeLog	22 Sep 2005 09:31:59 -0000
@@ -1,3 +1,11 @@
+2005-09-22  Devashish Sharma <sdevashish novell com>
+
+	* e-name-selector-dialog.c: Added the missing category filter in
+	name_selector_dialog.
+	* e-name-selector-dialog.glade: Added the UI component for category
+	filter.
+	Fixes #273799.
+
 2005-08-26  Harish Krishnaswamy  <kharish novell com>
 
 	* e-name-selector-dialog.c: (e_name_selector_dialog_init):
Index: libedataserverui/e-name-selector-dialog.glade
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-dialog.glade,v
retrieving revision 1.3
diff -u -p -r1.3 e-name-selector-dialog.glade
--- libedataserverui/e-name-selector-dialog.glade	28 Jan 2005 03:02:36 -0000	1.3
+++ libedataserverui/e-name-selector-dialog.glade	22 Sep 2005 09:31:45 -0000
@@ -74,7 +74,7 @@
 	  <child>
 	    <widget class="GtkTable" id="show_contacts_table">
 	      <property name="visible">True</property>
-	      <property name="n_rows">2</property>
+	      <property name="n_rows">3</property>
 	      <property name="n_columns">2</property>
 	      <property name="homogeneous">False</property>
 	      <property name="row_spacing">6</property>
@@ -104,6 +104,93 @@
 		  <property name="y_options"></property>
 		</packing>
 	      </child>
+	
+	      <child>
+	        <widget class="GtkLabel" id="label31">
+	          <property name="visible">True</property>
+	          <property name="label" translatable="yes">C_ategory:</property>
+	          <property name="use_underline">True</property>
+	          <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_CENTER</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>
+		</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="GtkCombo" id="combo-category">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="value_in_list">False</property>
+		  <property name="allow_empty">True</property>
+		  <property name="case_sensitive">False</property>
+		  <property name="enable_arrow_keys">True</property>
+	     	  <property name="enable_arrows_always">False</property>
+   
+    		  <child internal-child="entry">
+		    <widget class="GtkEntry" id="entry-category">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">True</property>
+		      <property name="visibility">True</property>
+		      <property name="max_length">0</property>
+		      <property name="text" translatable="yes"></property>
+		      <property name="has_frame">True</property>
+		      <property name="invisible_char" translatable="yes">*</property>
+		      <property name="activates_default">False</property>
+		    </widget>
+		  </child>
+
+		  <child internal-child="list">
+		    <widget class="GtkList" id="convertwidget1">
+		      <property name="visible">True</property>
+		      <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+    
+	              <child>
+			<widget class="GtkListItem" id="convertwidget2">
+			  <property name="visible">True</property>
+	  
+	 		  <child>
+			    <widget class="GtkLabel" id="convertwidget3">
+	  		      <property name="visible">True</property>
+			      <property name="label" translatable="yes"></property>
+ 			      <property name="use_underline">False</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>
+			    </widget>
+		      	  </child>
+		        </widget>
+	      	      </child>
+		    </widget>
+	          </child>
+	        </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">fill</property>
+	          <property name="y_options">fill</property>
+	        </packing>
+	      </child>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox1">
@@ -139,8 +226,8 @@
 		<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="top_attach">2</property>
+		  <property name="bottom_attach">3</property>
 		</packing>
 	      </child>
 
@@ -162,8 +249,8 @@
 		<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="top_attach">2</property>
+		  <property name="bottom_attach">3</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options"></property>
 		</packing>
Index: libedataserverui/e-name-selector-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-dialog.c,v
retrieving revision 1.20
diff -u -p -r1.20 e-name-selector-dialog.c
--- libedataserverui/e-name-selector-dialog.c	31 Aug 2005 04:26:10 -0000	1.20
+++ libedataserverui/e-name-selector-dialog.c	22 Sep 2005 09:36:35 -0000
@@ -37,6 +37,7 @@
 #include <libedataserverui/e-contact-store.h>
 #include <libedataserverui/e-book-auth-util.h>
 #include <libedataserver/e-sexp.h>
+#include <libedataserver/e-categories.h>
 #include "e-name-selector-dialog.h"
 
 typedef struct {
@@ -94,6 +95,23 @@ e_name_selector_dialog_set_property (GOb
 }
 
 static void
+e_name_selector_dialog_populate_categories(ENameSelectorDialog *name_selector_dialog)
+{
+	GtkCombo *combo;
+	GtkEntry *entry;
+	combo = (GtkCombo *) glade_xml_get_widget (name_selector_dialog->gui, "combo-category");
+	GList *list = NULL;
+
+	list = e_categories_get_list() ;
+	list = g_list_prepend(list, "Any Category");	
+	gtk_combo_set_popdown_strings (combo, list);
+	
+	entry = GTK_ENTRY(glade_xml_get_widget(name_selector_dialog->gui, "entry-category"));
+	g_signal_connect_swapped (entry, "changed", G_CALLBACK (search_changed), name_selector_dialog);
+
+}	
+
+static void
 e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
 {
 	GtkTreeSelection  *contact_selection;
@@ -185,6 +203,8 @@ e_name_selector_dialog_init (ENameSelect
 	container = glade_xml_get_widget (name_selector_dialog->gui, "source-menu-box");
 	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 
+	e_name_selector_dialog_populate_categories (name_selector_dialog);
+
 	/* Set up search-as-you-type signal */
 
 	widget = glade_xml_get_widget (name_selector_dialog->gui, "search");
@@ -210,7 +230,7 @@ e_name_selector_dialog_init (ENameSelect
 	gtk_container_set_border_width  (GTK_CONTAINER (name_selector_dialog), 4);
 	gtk_window_set_title            (GTK_WINDOW (name_selector_dialog), _("Select Contacts from Address Book"));
 }
-
+	
 /* Partial, repeatable destruction. Release references. */
 static void
 e_name_selector_dialog_dispose (GObject *object)
@@ -650,21 +670,41 @@ static void
 search_changed (ENameSelectorDialog *name_selector_dialog)
 {
 	EContactStore *contact_store;
-	EBookQuery    *book_query;
+	EBookQuery   *book_query;
+	GtkEntry     *entry;
 	const gchar   *text;
 	gchar         *text_escaped;
 	gchar         *query_string;
+	const gchar   *category;
+	gchar         *category_escaped;
+
+	entry = GTK_ENTRY(glade_xml_get_widget(name_selector_dialog->gui, "entry-category"));
+	category = gtk_entry_get_text (entry);
+	category_escaped = escape_sexp_string (category);
 
 	text = gtk_entry_get_text (name_selector_dialog->search_entry);
 	text_escaped = escape_sexp_string (text);
-	query_string = g_strdup_printf ("(or (beginswith \"file_as\" %s) "
-					"    (beginswith \"full_name\" %s) "
-					"    (beginswith \"email\" %s) "
-					"    (beginswith \"nickname\" %s))",
-					text_escaped, text_escaped, text_escaped, text_escaped);
+
+	if ( !strcmp (category,"Any Category")) {
+		query_string = g_strdup_printf ("(or (beginswith \"file_as\" %s) "
+						"    (beginswith \"full_name\" %s) "
+						"    (beginswith \"email\" %s) "
+						"    (beginswith \"nickname\" %s)))",
+						text_escaped, text_escaped, text_escaped, text_escaped);
+	}
+	else {
+		query_string = g_strdup_printf ("(and (is \"category_list\" %s) "
+						"(or (beginswith \"file_as\" %s) "
+						"    (beginswith \"full_name\" %s) "
+						"    (beginswith \"email\" %s) "
+						"    (beginswith \"nickname\" %s)))",
+						category_escaped,text_escaped, text_escaped, text_escaped, text_escaped);
+	}
+
 	book_query = e_book_query_from_string (query_string);
 	g_free (query_string);
 	g_free (text_escaped);
+	g_free (category_escaped);
 
 	contact_store = e_name_selector_model_peek_contact_store (name_selector_dialog->name_selector_model);
 	e_contact_store_set_query (contact_store, book_query);


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