aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/Makefile.am3
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c27
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h10
3 files changed, 37 insertions, 3 deletions
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index ce5cc32275..6842ce14d5 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -1,3 +1,5 @@
+ruledir = $(privdatadir)
+
INCLUDES = \
-DG_LOG_DOMAIN=\"eab-widgets\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
@@ -12,6 +14,7 @@ INCLUDES = \
-I$(top_srcdir)/addressbook/gui/component \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/shell \
+ -DSEARCH_RULE_DIR=\"$(ruledir)\" \
$(EVOLUTION_ADDRESSBOOK_CFLAGS)
CORBA_COMPOSER_SOURCE_H = \
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index a842d3040e..44db0a1edd 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -411,6 +411,7 @@ eab_view_new (void)
{
GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_AB_VIEW, NULL));
EABView *eav = EAB_VIEW (widget);
+ FilterPart *part;
/* create our model */
eav->model = eab_model_new ();
@@ -450,6 +451,20 @@ eab_view_new (void)
gtk_widget_show (GTK_WIDGET (eav->search));
gtk_widget_set_sensitive (GTK_WIDGET (eav->search), FALSE);
+ /* create the search context */
+ eav->search_context = rule_context_new ();
+ rule_context_add_part_set (eav->search_context, "partset", filter_part_get_type (),
+ rule_context_add_part, rule_context_next_part);
+ rule_context_load (eav->search_context, SEARCH_RULE_DIR "/addresstypes.xml", "");
+
+ eav->search_rule = filter_rule_new ();
+ part = rule_context_next_part (eav->search_context, NULL);
+
+ if (part == NULL)
+ g_warning ("Could not load addressbook search; no parts.");
+ else
+ filter_rule_add_part (eav->search_rule, filter_part_clone (part));
+
/* create the paned window and contact display */
eav->paned = gtk_vpaned_new ();
gtk_box_pack_start (GTK_BOX (eav), eav->paned, TRUE, TRUE, 0);
@@ -488,6 +503,18 @@ eab_view_new (void)
return widget;
}
+RuleContext *
+eab_view_peek_search_context (EABView *view)
+{
+ return view->search_context;
+}
+
+FilterRule *
+eab_view_peek_search_rule (EABView *view)
+{
+ return view->search_rule;
+}
+
static void
writable_status (GtkObject *object, gboolean writable, EABView *eav)
{
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index c90356beee..6f937f4587 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -92,9 +92,10 @@ struct _EABView
BonoboUIComponent *uic;
/* the search bar and related machinery */
- ESearchBar *search;
- gint ecml_changed_id;
-
+ ESearchBar *search;
+ gint ecml_changed_id;
+ RuleContext *search_context;
+ FilterRule *search_rule;
};
struct _EABViewClass
@@ -119,6 +120,9 @@ void eab_view_setup_menus (EABView *view,
BonoboUIComponent *uic);
void eab_view_discard_menus (EABView *view);
+RuleContext *eab_view_peek_search_context (EABView *view);
+FilterRule *eab_view_peek_search_rule (EABView *view);
+
void eab_view_save_as (EABView *view);
void eab_view_view (EABView *view);
void eab_view_send (EABView *view);