aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-08-23 17:09:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-08-23 17:09:21 +0800
commitf05ae9ba25935518ca945a4bf4fe80a6a4ff38e7 (patch)
treec12caa3307aa54884ca71fcfe6793d0763978f31
parentc3d7a35a9f00bae329978b56abb09c1500797b49 (diff)
downloadgsoc2013-evolution-f05ae9ba25935518ca945a4bf4fe80a6a4ff38e7.tar.gz
gsoc2013-evolution-f05ae9ba25935518ca945a4bf4fe80a6a4ff38e7.tar.zst
gsoc2013-evolution-f05ae9ba25935518ca945a4bf4fe80a6a4ff38e7.zip
Fixed fullname->full_name for search field.
2000-08-14 Not Zed <NotZed@HelixCode.com> * 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 <NotZed@HelixCode.com> * 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
-rw-r--r--addressbook/ChangeLog30
-rw-r--r--addressbook/gui/search/Makefile.am4
-rw-r--r--addressbook/gui/search/addresstypes.xml38
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.c42
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.h6
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 <NotZed@HelixCode.com>
+
+ * 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 <NotZed@HelixCode.com>
+
+ * 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 <lauris@helixcode.com>
* 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 @@
<filterdescription>
<partset>
<part name="name">
- <title>Sender</title>
+ <title>Name</title>
<input type="optionlist" name="name-type">
<option value="contains">
<title>contains</title>
- <code>(contains "fullname" ${name}))</code>
+ <code>(contains "full_name" ${name})</code>
</option>
<option value="not contains">
<title>does not contain</title>
- <code>(not (contains "fullname" ${name})))</code>
+ <code>(not (contains "full_name" ${name}))</code>
+ </option>
+ <option value="is">
+ <title>is</title>
+ <code>(is "full_name" ${name})))</code>
+ </option>
+ <option value="is not">
+ <title>is not</title>
+ <code>(not (is "full_name" ${name}))</code>
+ </option>
+ <option value="begin">
+ <title>begins with</title>
+ <code>(beginswith "full_name" ${name})</code>
+ </option>
+ <option value="end">
+ <title>ends in</title>
+ <code>(endswith "full_name" ${name})</code>
</option>
</input>
<input type="string" name="name"/>
</part>
<part name="email">
- <title>Sender</title>
+ <title>Email</title>
<input type="optionlist" name="email-type">
<option value="contains">
<title>contains</title>
- <code>(contains "email" ${email}))</code>
+ <code>(contains "email" ${email})</code>
</option>
<option value="not contains">
<title>does not contain</title>
- <code>(not (contains "email" ${email})))</code>
+ <code>(not (contains "email" ${email}))</code>
+ </option>
+ <option value="is">
+ <title>is</title>
+ <code>(is "email" ${email})</code>
+ </option>
+ <option value="is not">
+ <title>is not</title>
+ <code>(not (is "email" ${email}))</code>
</option>
</input>
- <input type="string" name="email"/>
+ <input type="address" name="email"/>
</part>
<part name="sexp">
<title>Expression</title>
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 <gnome.h>
#include <ebook/e-book.h>
+#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;
};