aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas/pas-backend-file.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-04-09 06:10:47 +0800
committerChris Lahey <clahey@src.gnome.org>2000-04-09 06:10:47 +0800
commit58e7df4e0376d1248ced78659d27d61adc1434b9 (patch)
treeedda4073e9e79d89b8bb9a34498049259998718d /addressbook/backend/pas/pas-backend-file.c
parent6beb74f53508f0f92ad5ed0fe7e823b6a5be76f3 (diff)
downloadgsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.gz
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.bz2
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.lz
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.xz
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.zst
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.zip
pixmap_DATA isn't defined so don't use it as a variable.
2000-04-08 Christopher James Lahey <clahey@helixcode.com> * art/Makefile.am: pixmap_DATA isn't defined so don't use it as a variable. * addressbook/gui/component/, addressbook/gui/component/.cvsignore, addressbook/gui/Makefile.am, addressbook/gui/component/addressbook-factory.c, addressbook/gui/component/addressbook.c, addressbook/gui/component/addressbook.gnorba, addressbook/gui/component/addressbook.h: New directory to proivde the component for contact management. Simply uses an e-minicard-view. * addressbook/gui/minicard/e-minicard-view.c, addressbook/gui/minicard/e-minicard-view.h: New subclass of e-reflow-sorted that takes an EBook and uses it to compute the card data to display. * addressbook/gui/minicard/e-minicard.c, addressbook/gui/minicard/e-minicard.h: This now backends to a ECard instead of a ETableModel. * addressbook/gui/minicard/e-reflow.c, addressbook/gui/minicard/e-reflow.h: This now has a virtualized add method. * addressbook/gui/minicard/e-reflow-sorted.c, addressbook/gui/minicard/e-reflow-sorted.h: New subclass of e-reflow that allows the data to be sorted on the fly. * addressbook/gui/minicard/test-minicard-view.c: New test to test the new minicard view. * addressbook/gui/minicard/test-reflow.c: Uses the new ECard backend of the e-minicard. * addressbook/gui/minicard/.cvsignore, addressbook/gui/minicard/Makefile.am: Added new test. Fixed dependencies. Added new files. * addressbook/gui/, addressbook/gui/Makefile.am, addressbook/gui/.cvsignore: New directory for addressbook gui bits. Added subdirectories. Created an initial .cvsignore. * addressbook/Makefile.am (SUBDIRS): Removed demo and added gui. * addressbook/backend/pas/pas-backend-file.c: Added code to do notification on bookviews when changes in the backend are made. * addressbook/backend/pas/pas-book-view.c, addressbook/backend/pas/pas-book-view.h: Added helper functions to notify the view about the addition or modification of a single card. Fixed a mistaken extra free. * addressbook/backend/ebook/e-card-list-iterator.h: Fixed incorrect parent class. * addressbook/backend/ebook/test-client.c: Made this accept an optional parameter that specifies the vcard to add. * configure.in: Replaced widgets/e-minicard/Makefile and addressbook/demo/Makefile with addressbook/gui/minicard/Makefile and addressbook/gui/component/Makefile respectively. * widgets/Makefile.am: Removed e-minicard since it's being moved to addressbook/gui/minicard. * widgets/e-text/e-text.c: Fixed the border width around tooltips and made the main tooltip area yellow. From camel/ChangeLog: 2000-04-08 Christopher James Lahey <clahey@helixcode.com> * providers/smtp/.cvsignore: Added a .cvsignore file. From calendar/ChangeLog: 2000-04-08 Christopher James Lahey <clahey@helixcode.com> * gui/Makefile.am: Removed linking with libetable and libeminicard since they weren't being used. svn path=/trunk/; revision=2343
Diffstat (limited to 'addressbook/backend/pas/pas-backend-file.c')
-rw-r--r--addressbook/backend/pas/pas-backend-file.c79
1 files changed, 61 insertions, 18 deletions
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 706ab1f9a2..935dab19d5 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -25,11 +25,13 @@
static PASBackendClass *pas_backend_file_parent_class;
typedef struct _PASBackendFileCursorPrivate PASBackendFileCursorPrivate;
+typedef struct _PASBackendFileBookView PASBackendFileBookView;
struct _PASBackendFilePrivate {
GList *clients;
gboolean loaded;
DB *file_db;
+ GList *book_views;
};
struct _PASBackendFileCursorPrivate {
@@ -40,6 +42,11 @@ struct _PASBackendFileCursorPrivate {
guint32 num_elements;
};
+struct _PASBackendFileBookView {
+ PASBookView *book_view;
+ gchar *search;
+};
+
static long
get_length(PASCardCursor *cursor, gpointer data)
{
@@ -89,6 +96,20 @@ view_destroy(GtkObject *object, gpointer data)
CORBA_Environment ev;
Evolution_Book corba_book;
PASBook *book = (PASBook *)data;
+ PASBackendFile *bf;
+ GList *list;
+
+ bf = PAS_BACKEND_FILE(pas_book_get_backend(book));
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ if (view->book_view == PAS_BOOK_VIEW(object)) {
+ g_free (view->search);
+ g_free (view);
+ bf->priv->book_views = g_list_remove_link(bf->priv->book_views, list);
+ g_list_free_1(list);
+ break;
+ }
+ }
corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
@@ -131,6 +152,7 @@ pas_backend_file_process_create_card (PASBackend *backend,
DBT id_dbt, vcard_dbt;
int db_error;
char *id;
+ GList *list;
id = pas_backend_file_create_unique_id (req->vcard);
@@ -140,9 +162,11 @@ pas_backend_file_process_create_card (PASBackend *backend,
db_error = db->put (db, &id_dbt, &vcard_dbt, 0);
if (0 == db_error) {
-#if 0
- pas_book_notify_add(book, id);
-#endif
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ /* if (card matches view->search) */
+ pas_book_view_notify_add_1 (view->book_view, req->vcard);
+ }
pas_book_respond_create (
book,
@@ -175,15 +199,18 @@ pas_backend_file_process_remove_card (PASBackend *backend,
DB *db = bf->priv->file_db;
DBT id_dbt;
int db_error;
+ GList *list;
string_to_dbt (req->id, &id_dbt);
db_error = db->del (db, &id_dbt, 0);
if (0 == db_error) {
-#if 0
- pas_book_notify_remove (book, req->id);
-#endif
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ /* if (card matches view->search) */
+ pas_book_view_notify_remove (view->book_view, req->id);
+ }
pas_book_respond_remove (
book,
@@ -211,6 +238,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
DB *db = bf->priv->file_db;
DBT id_dbt, vcard_dbt;
int db_error;
+ GList *list;
string_to_dbt (req->id, &id_dbt);
string_to_dbt (req->vcard, &vcard_dbt);
@@ -218,9 +246,16 @@ pas_backend_file_process_modify_card (PASBackend *backend,
db_error = db->put (db, &id_dbt, &vcard_dbt, 0);
if (0 == db_error) {
-#if 0
- pas_book_notify_change (book, req->id);
-#endif
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ /* if (card matches view->search) */
+ pas_book_view_notify_change_1 (view->book_view, req->vcard);
+ /* else if (card changes to match view->search )
+ pas_book_view_notify_add_1 (view->book_view, req->vcard);
+ else if (card changes to not match view->search )
+ pas_book_view_notify_remove (view->book_view, req->id);
+ */
+ }
pas_book_respond_modify (
book,
@@ -335,9 +370,11 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
DBT id_dbt, vcard_dbt;
CORBA_Environment ev;
int db_error = 0;
- PASBookView *view;
+ PASBookView *book_view;
Evolution_Book corba_book;
GList *cards = NULL;
+ PASBackendFileBookView *view;
+
g_return_if_fail (req->listener != NULL);
@@ -354,16 +391,16 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
CORBA_exception_free(&ev);
- view = pas_book_view_new (req->listener);
+ book_view = pas_book_view_new (req->listener);
- gtk_signal_connect(GTK_OBJECT(view), "destroy",
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
GTK_SIGNAL_FUNC(view_destroy), book);
pas_book_respond_get_book_view (book,
(db_error == 0
? Evolution_BookListener_Success
: Evolution_BookListener_CardNotFound /* XXX */),
- view);
+ book_view);
/*
** no reason to not iterate through the file now and notify
@@ -390,14 +427,19 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
g_warning ("pas_backend_file_process_get_book_view: error building list\n");
}
else {
- pas_book_view_notify_add (view, cards);
+ pas_book_view_notify_add (book_view, cards);
}
/*
- ** the following should be done when the view is destroyed
+ ** It's fine to do this now since the data has been handed off.
*/
g_list_foreach (cards, (GFunc)g_free, NULL);
g_list_free (cards);
+
+ view = g_new(PASBackendFileBookView, 1);
+ view->book_view = book_view;
+ view->search = g_strdup(req->search);
+ bf->priv->book_views = g_list_prepend(bf->priv->book_views, view);
}
static void
@@ -684,9 +726,10 @@ pas_backend_file_init (PASBackendFile *backend)
{
PASBackendFilePrivate *priv;
- priv = g_new0 (PASBackendFilePrivate, 1);
- priv->loaded = FALSE;
- priv->clients = NULL;
+ priv = g_new0 (PASBackendFilePrivate, 1);
+ priv->loaded = FALSE;
+ priv->clients = NULL;
+ priv->book_views = NULL;
backend->priv = priv;
}