diff options
Diffstat (limited to 'addressbook/gui/search')
-rw-r--r-- | addressbook/gui/search/.cvsignore | 7 | ||||
-rw-r--r-- | addressbook/gui/search/Makefile.am | 23 | ||||
-rw-r--r-- | addressbook/gui/search/addresstypes.xml | 61 | ||||
-rw-r--r-- | addressbook/gui/search/e-addressbook-search-dialog.c | 239 | ||||
-rw-r--r-- | addressbook/gui/search/e-addressbook-search-dialog.h | 76 |
5 files changed, 0 insertions, 406 deletions
diff --git a/addressbook/gui/search/.cvsignore b/addressbook/gui/search/.cvsignore deleted file mode 100644 index d6c55c7345..0000000000 --- a/addressbook/gui/search/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/gui/search/Makefile.am b/addressbook/gui/search/Makefile.am deleted file mode 100644 index d932aaac77..0000000000 --- a/addressbook/gui/search/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -ruledir = $(datadir)/evolution -rule_DATA = addresstypes.xml - -EXTRA_DIST = addresstypes.xml - -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-addressbook-search\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/misc \ - -DSEARCH_RULE_DIR=\"$(ruledir)\" \ - $(BONOBO_GNOME_CFLAGS) \ - $(EXTRA_GNOME_CFLAGS) - -noinst_LIBRARIES = \ - libeaddressbooksearch.a - -libeaddressbooksearch_a_SOURCES = \ - e-addressbook-search-dialog.c \ - e-addressbook-search-dialog.h diff --git a/addressbook/gui/search/addresstypes.xml b/addressbook/gui/search/addresstypes.xml deleted file mode 100644 index bf64e841b0..0000000000 --- a/addressbook/gui/search/addresstypes.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<filterdescription> -<partset> - <part name="name"> - <title>Name</title> - <input type="optionlist" name="name-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "full_name" ${name})</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <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>Email</title> - <input type="optionlist" name="email-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "email" ${email})</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <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="address" name="email"/> - </part> - <part name="sexp"> - <title>Expression</title> - <input type="code" name="code"/> - </part> -</partset> -</filterdescription> diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c deleted file mode 100644 index 3457d349ed..0000000000 --- a/addressbook/gui/search/e-addressbook-search-dialog.c +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-addressbook-search-dialog.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> - -#include <gtk/gtkbox.h> -#include <gtk/gtkentry.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> -#include <gal/widgets/e-canvas.h> -#include <gal/widgets/e-scroll-frame.h> - -#include "e-addressbook-search-dialog.h" -#include "addressbook/gui/widgets/e-minicard-view-widget.h" - - -static void e_addressbook_search_dialog_init (EAddressbookSearchDialog *widget); -static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass); -static void e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_addressbook_search_dialog_destroy (GtkObject *object); - -static ECanvasClass *parent_class = NULL; - -#define PARENT_TYPE (gnome_dialog_get_type()) - -/* The arguments we take */ -enum { - ARG_0, - ARG_BOOK, -}; - -GtkType -e_addressbook_search_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "EAddressbookSearchDialog", - sizeof (EAddressbookSearchDialog), - sizeof (EAddressbookSearchDialogClass), - (GtkClassInitFunc) e_addressbook_search_dialog_class_init, - (GtkObjectInitFunc) e_addressbook_search_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - gtk_object_add_arg_type ("EAddressbookSearchDialog::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - - object_class->set_arg = e_addressbook_search_dialog_set_arg; - object_class->get_arg = e_addressbook_search_dialog_get_arg; - object_class->destroy = e_addressbook_search_dialog_destroy; -} - -static GtkWidget * -get_widget (EAddressbookSearchDialog *view) -{ - 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 (EAddressbookSearchDialog *view) -{ - 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, int button, EAddressbookSearchDialog *dialog) -{ - char *query; - - if (button == 0) { - query = get_query(dialog); - gtk_object_set(GTK_OBJECT(dialog->model), - "query", query, - NULL); - g_free(query); - } - else - gnome_dialog_close(GNOME_DIALOG (dialog)); -} - -static void -e_addressbook_search_dialog_init (EAddressbookSearchDialog *view) -{ - GnomeDialog *dialog = GNOME_DIALOG (view); - - gtk_window_set_policy(GTK_WINDOW(view), FALSE, TRUE, FALSE); - - view->search = get_widget(view); - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, FALSE, FALSE, 0); - gtk_widget_show(view->search); - - gnome_dialog_append_buttons(dialog, - _("Search"), - GNOME_STOCK_BUTTON_CLOSE, NULL); - - gnome_dialog_set_default(dialog, 0); - - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - GTK_SIGNAL_FUNC(button_press), view); - - view->model = e_addressbook_model_new (); - view->adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model)); - view->view = e_minicard_view_widget_new(view->adapter); - gtk_widget_show(view->view); - - view->scrolled_window = e_scroll_frame_new(NULL, NULL); - e_scroll_frame_set_policy(E_SCROLL_FRAME(view->scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); - gtk_container_add(GTK_CONTAINER(view->scrolled_window), view->view); - - gtk_widget_show(view->scrolled_window); - - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->scrolled_window, TRUE, TRUE, 0); -} - -GtkWidget * -e_addressbook_search_dialog_new (EBook *book) -{ - EAddressbookSearchDialog *view = gtk_type_new (e_addressbook_search_dialog_get_type ()); - gtk_object_set(GTK_OBJECT(view->model), - "book", book, - NULL); - return GTK_WIDGET(view); -} - -static void -e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EAddressbookSearchDialog *emvw; - - emvw = E_ADDRESSBOOK_SEARCH_DIALOG (o); - - switch (arg_id){ - case ARG_BOOK: - gtk_object_set(GTK_OBJECT(emvw->model), - "book", GTK_VALUE_OBJECT (*arg), - NULL); - break; - } -} - -static void -e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EAddressbookSearchDialog *emvw; - - emvw = E_ADDRESSBOOK_SEARCH_DIALOG (object); - - switch (arg_id) { - case ARG_BOOK: - gtk_object_get(GTK_OBJECT(emvw->model), - "book", &(GTK_VALUE_OBJECT (*arg)), - NULL); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_addressbook_search_dialog_destroy (GtkObject *object) -{ - EAddressbookSearchDialog *view; - - view = E_ADDRESSBOOK_SEARCH_DIALOG (object); - - gtk_object_unref((GtkObject *)view->model); - gtk_object_unref((GtkObject *)view->adapter); - 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 deleted file mode 100644 index efc928e046..0000000000 --- a/addressbook/gui/search/e-addressbook-search-dialog.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view-widget.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_ADDRESSBOOK_SEARCH_DIALOG_H__ -#define __E_ADDRESSBOOK_SEARCH_DIALOG_H__ - -#include <ebook/e-book.h> - -#include "addressbook/gui/widgets/e-addressbook-model.h" -#include "addressbook/gui/widgets/e-addressbook-reflow-adapter.h" -#include "filter/rule-context.h" -#include "filter/filter-rule.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <libgnomeui/gnome-dialog.h> - -#define E_ADDRESSBOOK_SEARCH_DIALOG_TYPE (e_addressbook_search_dialog_get_type ()) -#define E_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialog)) -#define E_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialogClass)) -#define E_IS_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE)) -#define E_IS_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE)) - - -typedef struct _EAddressbookSearchDialog EAddressbookSearchDialog; -typedef struct _EAddressbookSearchDialogClass EAddressbookSearchDialogClass; - -struct _EAddressbookSearchDialog -{ - GnomeDialog parent; - - GtkWidget *search; - GtkWidget *view; - - EAddressbookModel *model; - EAddressbookReflowAdapter *adapter; - - RuleContext *context; - FilterRule *rule; - GtkWidget *scrolled_window; -}; - -struct _EAddressbookSearchDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkType e_addressbook_search_dialog_get_type (void); - -GtkWidget *e_addressbook_search_dialog_new (EBook *book); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_ADDRESSBOOK_SEARCH_DIALOG_H__ */ |