From f05ae9ba25935518ca945a4bf4fe80a6a4ff38e7 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 23 Aug 2000 09:09:21 +0000 Subject: Fixed fullname->full_name for search field. 2000-08-14 Not Zed * gui/search/addresstypes.xml: Fixed fullname->full_name for search field. * gui/search/e-addressbook-search-dialog.c (get_widget): Check we actually got any parts to build the dialogue with. 2000-08-13 Not Zed * gui/component/addressbook-component.c (owner_set_cb): Set the global_shell_client nastyhack when we know it. This is only required to link with the filter code ... * gui/component/Makefile.am (evolution_addressbook_LDADD): Added libfilter.a to the link line. * gui/search/Makefile.am (noinst_LIBRARIES): Change library name from libaddressbooksearchdialog to libaddressbooksearch, as used elsewhere. * gui/search/e-addressbook-search-dialog.c (get_widget): Implement. (get_query): Likewise. (e_addressbook_search_dialog_destroy): Unref filter stuff when done. * gui/component/addressbook.c (control_deactivate): Added chris's patch to put the meny in svn path=/trunk/; revision=4980 --- addressbook/ChangeLog | 30 ++++++++++++++++ addressbook/gui/search/Makefile.am | 4 +++ addressbook/gui/search/addresstypes.xml | 38 ++++++++++++++++---- .../gui/search/e-addressbook-search-dialog.c | 42 ++++++++++++++++++---- .../gui/search/e-addressbook-search-dialog.h | 6 ++++ 5 files changed, 107 insertions(+), 13 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 2c56a4b985..bf42fea69f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,33 @@ +2000-08-14 Not Zed + + * gui/search/addresstypes.xml: Fixed fullname->full_name for + search field. + + * gui/search/e-addressbook-search-dialog.c (get_widget): Check we + actually got any parts to build the dialogue with. + +2000-08-13 Not Zed + + * gui/component/addressbook-component.c (owner_set_cb): Set the + global_shell_client nastyhack when we know it. + This is only required to link with the filter code ... + + * gui/component/Makefile.am (evolution_addressbook_LDADD): Added + libfilter.a to the link line. + + * gui/search/Makefile.am (noinst_LIBRARIES): Change library name + from libaddressbooksearchdialog to libaddressbooksearch, as used + elsewhere. + + * gui/search/e-addressbook-search-dialog.c (get_widget): + Implement. + (get_query): Likewise. + (e_addressbook_search_dialog_destroy): Unref filter stuff when + done. + + * gui/component/addressbook.c (control_deactivate): Added chris's + patch to put the meny in + 2000-08-22 Lauris Kaplinski * contact-editor/e-contact-editor.c: Use e_utf8 wrappers everywhere diff --git a/addressbook/gui/search/Makefile.am b/addressbook/gui/search/Makefile.am index 1050da1843..8e08218781 100644 --- a/addressbook/gui/search/Makefile.am +++ b/addressbook/gui/search/Makefile.am @@ -1,3 +1,6 @@ +ruledir = $(prefix)/share/evolution +rule_DATA = addresstypes.xml + INCLUDES = \ -DG_LOG_DOMAIN=\"e-addressbook-search\" \ -I$(top_srcdir) \ @@ -6,6 +9,7 @@ INCLUDES = \ -I$(top_srcdir)/addressbook/contact-editor \ -I$(top_srcdir)/widgets/e-text \ -I$(top_srcdir)/widgets/misc \ + -DSEARCH_RULE_DIR=\"$(ruledir)\" \ $(BONOBO_GNOME_CFLAGS) noinst_LIBRARIES = \ diff --git a/addressbook/gui/search/addresstypes.xml b/addressbook/gui/search/addresstypes.xml index d855561cce..bf64e841b0 100644 --- a/addressbook/gui/search/addresstypes.xml +++ b/addressbook/gui/search/addresstypes.xml @@ -2,32 +2,56 @@ - Sender + Name + + + + - Sender + Email + + - + Expression diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c index 4acfd1585c..0109b1914a 100644 --- a/addressbook/gui/search/e-addressbook-search-dialog.c +++ b/addressbook/gui/search/e-addressbook-search-dialog.c @@ -89,23 +89,46 @@ e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass) } static GtkWidget * -get_widget () +get_widget (EAddressbookSearchDialog *view) { - return gtk_entry_new(); + FilterPart *part; + + view->context = rule_context_new(); + /* FIXME: hide this in a class */ + rule_context_add_part_set(view->context, "partset", filter_part_get_type(), + rule_context_add_part, rule_context_next_part); + rule_context_load(view->context, SEARCH_RULE_DIR "/addresstypes.xml", ""); + view->rule = filter_rule_new(); + part = rule_context_next_part(view->context, NULL); + if (part == NULL) { + g_warning("Problem loading search for addressbook no parts to load"); + return gtk_entry_new(); + } else { + filter_rule_add_part(view->rule, filter_part_clone(part)); + return filter_rule_get_widget(view->rule, view->context); + } } static char * -get_query () +get_query (EAddressbookSearchDialog *view) { - return "(contains \"email\" \"\")"; + GString *out = g_string_new(""); + char *ret; + + filter_rule_build_code(view->rule, out); + ret = out->str; + printf("Searching using %s\n", ret); + g_string_free(out, FALSE); + return ret; } static void button_press (GtkWidget *widget, EAddressbookSearchDialog *dialog) { char *query; + gtk_widget_show(dialog->scrolled_window); - query = get_query(); + query = get_query(dialog); gtk_object_set(GTK_OBJECT(dialog->view), "query", query, NULL); @@ -120,7 +143,7 @@ e_addressbook_search_dialog_init (EAddressbookSearchDialog *view) gtk_window_set_policy(GTK_WINDOW(view), FALSE, TRUE, FALSE); - view->search = get_widget(); + view->search = get_widget(view); gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, TRUE, TRUE, 0); gtk_widget_show(view->search); @@ -188,5 +211,12 @@ e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_i static void e_addressbook_search_dialog_destroy (GtkObject *object) { + EAddressbookSearchDialog *view; + + view = E_ADDRESSBOOK_SEARCH_DIALOG (object); + + gtk_object_unref((GtkObject *)view->context); + gtk_object_unref((GtkObject *)view->rule); + GTK_OBJECT_CLASS(parent_class)->destroy (object); } diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h index 84af66b4e1..dc54275a77 100644 --- a/addressbook/gui/search/e-addressbook-search-dialog.h +++ b/addressbook/gui/search/e-addressbook-search-dialog.h @@ -24,6 +24,9 @@ #include #include +#include "filter/rule-context.h" +#include "filter/filter-rule.h" + #ifdef __cplusplus extern "C" { #pragma } @@ -45,6 +48,9 @@ struct _EAddressbookSearchDialog GtkWidget *search; GtkWidget *view; + + RuleContext *context; + FilterRule *rule; GtkWidget *scrolled_window; }; -- cgit v1.2.3