aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-22 19:13:53 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-22 19:13:53 +0800
commitb2019f34096c075bedcc2f9db7ee94d493225768 (patch)
tree60117e19ac3be2357786d4fd6dec1b6454de9daa /addressbook/backend
parent0d39d588a7da56bca9c195615d765edd572b3a41 (diff)
downloadgsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.gz
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.bz2
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.lz
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.xz
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.zst
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.zip
Added evolution-addressbook-ldap.xml.
2000-09-22 Christopher James Lahey <clahey@helixcode.com> * ui/Makefile.am: Added evolution-addressbook-ldap.xml. * ui/evolution-addressbook-ldap.xml: New file. (A Variation on evolution-addressbook.xml) * ui/evolution-addressbook.xml: Added View All and Stop buttons. From addressbook/ChangeLog: 2000-09-22 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-book.c, backend/ebook/e-book.h, backend/idl/addressbook.idl, backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c, backend/pas-backend.c, backend/pas/pas-backend.h, backend/pas/pas-book.c, backend/pas/pas-book.h: Added a function to query static capabilities (capabilities that can be reported immediately) and implemented them in the 2 servers. * gui/component/addressbook.c: Added a View All button and a Stop button. Sorted out the new directory server stuff a bit. * gui/widgets/e-addressbook-model.c, gui/widgets/e-addressbook-model.h: Cleaned up a bit. Added a stop function. Check for capabilities before deciding whether to load all cards when initially viewed. * gui/widgets/e-addressbook-view.c, gui/widgets/e-addressbook-view.h: Added stop and view all functions. * gui/widgets/e-minicard-view-widget.c, gui/widgets/e-minicard-view-widget.h, gui/widgets/e-minicard-view.c, gui/widgets/e-minicard-view.h: Added a stop function. Check for capabilities before deciding whether to load all cards when initially viewed. svn path=/trunk/; revision=5547
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/e-book.c31
-rw-r--r--addressbook/backend/ebook/e-book.h92
-rw-r--r--addressbook/backend/idl/addressbook.idl2
-rw-r--r--addressbook/backend/pas/pas-backend-file.c15
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c15
-rw-r--r--addressbook/backend/pas/pas-backend.c16
-rw-r--r--addressbook/backend/pas/pas-backend.h24
-rw-r--r--addressbook/backend/pas/pas-book.c33
-rw-r--r--addressbook/backend/pas/pas-book.h61
9 files changed, 185 insertions, 104 deletions
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 2023f1bf83..bb0226eb5a 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -435,6 +435,37 @@ e_book_unload_uri (EBook *book)
book->priv->load_state = URINotLoaded;
}
+char *
+e_book_get_static_capabilities (EBook *book)
+{
+ CORBA_Environment ev;
+ char *temp;
+ char *ret_val;
+
+ CORBA_exception_init (&ev);
+
+ if (book->priv->load_state != URILoaded) {
+ g_warning ("e_book_unload_uri: No URI is loaded!\n");
+ return g_strdup("");
+ }
+
+ temp = Evolution_Book_get_static_capabilities(book->priv->corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_get_static_capabilities: Exception "
+ "during get_static_capabilities!\n");
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ ret_val = g_strdup(temp);
+ CORBA_free(temp);
+
+ CORBA_exception_free (&ev);
+
+ return ret_val;
+}
+
static gboolean
e_book_construct (EBook *book)
{
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
index a57c7263b3..29f3787f66 100644
--- a/addressbook/backend/ebook/e-book.h
+++ b/addressbook/backend/ebook/e-book.h
@@ -51,66 +51,66 @@ typedef void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookVie
/* Creating a new addressbook. */
-EBook *e_book_new (void);
-gboolean e_book_load_uri (EBook *book,
- const char *uri,
- EBookCallback open_response,
- gpointer closure);
-void e_book_unload_uri (EBook *book);
+EBook *e_book_new (void);
+gboolean e_book_load_uri (EBook *book,
+ const char *uri,
+ EBookCallback open_response,
+ gpointer closure);
+void e_book_unload_uri (EBook *book);
+char *e_book_get_static_capabilities (EBook *book);
/* Fetching cards. */
-ECard *e_book_get_card (EBook *book,
- const char *id);
-char *e_book_get_vcard (EBook *book,
- const char *id);
+ECard *e_book_get_card (EBook *book,
+ const char *id);
+char *e_book_get_vcard (EBook *book,
+ const char *id);
/* Deleting cards. */
-gboolean e_book_remove_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure);
-gboolean e_book_remove_card_by_id (EBook *book,
- const char *id,
- EBookCallback cb,
- gpointer closure);
+gboolean e_book_remove_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure);
+gboolean e_book_remove_card_by_id (EBook *book,
+ const char *id,
+ EBookCallback cb,
+ gpointer closure);
/* Adding cards. */
-gboolean e_book_add_card (EBook *book,
- ECard *card,
- EBookIdCallback cb,
- gpointer closure);
-gboolean e_book_add_vcard (EBook *book,
- const char *vcard,
- EBookIdCallback cb,
- gpointer closure);
+gboolean e_book_add_card (EBook *book,
+ ECard *card,
+ EBookIdCallback cb,
+ gpointer closure);
+gboolean e_book_add_vcard (EBook *book,
+ const char *vcard,
+ EBookIdCallback cb,
+ gpointer closure);
/* Modifying cards. */
-gboolean e_book_commit_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure);
-gboolean e_book_commit_vcard (EBook *book,
- const char *vcard,
- EBookCallback cb,
- gpointer closure);
+gboolean e_book_commit_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure);
+gboolean e_book_commit_vcard (EBook *book,
+ const char *vcard,
+ EBookCallback cb,
+ gpointer closure);
/* Checking to see if we're connected to the card repository. */
-gboolean e_book_check_connection (EBook *book);
+gboolean e_book_check_connection (EBook *book);
+gboolean e_book_get_cursor (EBook *book,
+ char *query,
+ EBookCursorCallback cb,
+ gpointer closure);
-gboolean e_book_get_cursor (EBook *book,
- char *query,
- EBookCursorCallback cb,
- gpointer closure);
-
-gboolean e_book_get_book_view (EBook *book,
- char *query,
- EBookBookViewCallback cb,
- gpointer closure);
+gboolean e_book_get_book_view (EBook *book,
+ char *query,
+ EBookBookViewCallback cb,
+ gpointer closure);
/* Getting the name of the repository. */
-char *e_book_get_name (EBook *book);
+char *e_book_get_name (EBook *book);
-GtkType e_book_get_type (void);
+GtkType e_book_get_type (void);
#define E_BOOK_TYPE (e_book_get_type ())
#define E_BOOK(o) (GTK_CHECK_CAST ((o), E_BOOK_TYPE, EBook))
diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl
index b8cf15c4ff..bbdabd713d 100644
--- a/addressbook/backend/idl/addressbook.idl
+++ b/addressbook/backend/idl/addressbook.idl
@@ -84,6 +84,8 @@ module Evolution {
void check_connection ();
+ string get_static_capabilities ();
+
string get_name ();
};
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index b7eb57e81a..a54d32d424 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -1175,6 +1175,12 @@ pas_backend_file_remove_client (PASBackend *backend,
pas_backend_last_client_gone (backend);
}
+static char *
+pas_backend_file_get_static_capabilities (PASBackend *backend)
+{
+ return g_strdup("local");
+}
+
static gboolean
pas_backend_file_construct (PASBackendFile *backend)
{
@@ -1230,10 +1236,11 @@ pas_backend_file_class_init (PASBackendFileClass *klass)
parent_class = PAS_BACKEND_CLASS (klass);
/* Set the virtual methods. */
- parent_class->load_uri = pas_backend_file_load_uri;
- parent_class->get_uri = pas_backend_file_get_uri;
- parent_class->add_client = pas_backend_file_add_client;
- parent_class->remove_client = pas_backend_file_remove_client;
+ parent_class->load_uri = pas_backend_file_load_uri;
+ parent_class->get_uri = pas_backend_file_get_uri;
+ parent_class->add_client = pas_backend_file_add_client;
+ parent_class->remove_client = pas_backend_file_remove_client;
+ parent_class->get_static_capabilities = pas_backend_file_get_static_capabilities;
object_class->destroy = pas_backend_file_destroy;
}
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 08fe3ef773..59c721415f 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -1352,6 +1352,12 @@ pas_backend_ldap_remove_client (PASBackend *backend,
pas_backend_last_client_gone (backend);
}
+static char *
+pas_backend_ldap_get_static_capabilites (PASBackend *backend)
+{
+ return g_strdup("net");
+}
+
static gboolean
pas_backend_ldap_construct (PASBackendLDAP *backend)
{
@@ -1415,10 +1421,11 @@ pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
parent_class = PAS_BACKEND_CLASS (klass);
/* Set the virtual methods. */
- parent_class->load_uri = pas_backend_ldap_load_uri;
- parent_class->get_uri = pas_backend_ldap_get_uri;
- parent_class->add_client = pas_backend_ldap_add_client;
- parent_class->remove_client = pas_backend_ldap_remove_client;
+ parent_class->load_uri = pas_backend_ldap_load_uri;
+ parent_class->get_uri = pas_backend_ldap_get_uri;
+ parent_class->add_client = pas_backend_ldap_add_client;
+ parent_class->remove_client = pas_backend_ldap_remove_client;
+ parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilites;
object_class->destroy = pas_backend_ldap_destroy;
}
diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c
index 3d315c2faf..1568918560 100644
--- a/addressbook/backend/pas/pas-backend.c
+++ b/addressbook/backend/pas/pas-backend.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Author:
* Nat Friedman (nat@helixcode.com)
@@ -95,6 +96,17 @@ pas_backend_remove_client (PASBackend *backend,
CLASS (backend)->remove_client (backend, book);
}
+char *
+pas_backend_get_static_capabilities (PASBackend *backend)
+{
+ g_return_val_if_fail (backend != NULL, NULL);
+ g_return_val_if_fail (PAS_IS_BACKEND (backend), NULL);
+
+ g_assert (CLASS (backend)->get_static_capabilities != NULL);
+
+ return CLASS (backend)->get_static_capabilities (backend);
+}
+
/**
* pas_backend_last_client_gone:
* @backend: An addressbook backend.
@@ -133,6 +145,10 @@ pas_backend_class_init (PASBackendClass *klass)
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, pas_backend_signals, LAST_SIGNAL);
+
+ klass->add_client = NULL;
+ klass->remove_client = NULL;
+ klass->get_static_capabilities = NULL;
}
/**
diff --git a/addressbook/backend/pas/pas-backend.h b/addressbook/backend/pas/pas-backend.h
index a1d1a291fd..4045074284 100644
--- a/addressbook/backend/pas/pas-backend.h
+++ b/addressbook/backend/pas/pas-backend.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* An abstract class which defines the API to a given backend.
* There will be one PASBackend object for every URI which is loaded.
@@ -43,6 +44,7 @@ typedef struct {
const char *(* get_uri) (PASBackend *backend);
gboolean (*add_client) (PASBackend *backend, Evolution_BookListener listener);
void (*remove_client) (PASBackend *backend, PASBook *book);
+ char *(*get_static_capabilities) (PASBackend *backend);
/* Notification signals */
void (* last_client_gone) (PASBackend *backend);
@@ -50,18 +52,20 @@ typedef struct {
typedef PASBackend * (*PASBackendFactoryFn) (void);
-gboolean pas_backend_construct (PASBackend *backend);
-gboolean pas_backend_load_uri (PASBackend *backend,
- const char *uri);
-const char *pas_backend_get_uri (PASBackend *backend);
-gboolean pas_backend_add_client (PASBackend *backend,
- Evolution_BookListener listener);
-void pas_backend_remove_client (PASBackend *backend,
- PASBook *book);
+gboolean pas_backend_construct (PASBackend *backend);
+gboolean pas_backend_load_uri (PASBackend *backend,
+ const char *uri);
+const char *pas_backend_get_uri (PASBackend *backend);
-void pas_backend_last_client_gone (PASBackend *backend);
+gboolean pas_backend_add_client (PASBackend *backend,
+ Evolution_BookListener listener);
+void pas_backend_remove_client (PASBackend *backend,
+ PASBook *book);
+char *pas_backend_get_static_capabilities (PASBackend *backend);
-GtkType pas_backend_get_type (void);
+void pas_backend_last_client_gone (PASBackend *backend);
+
+GtkType pas_backend_get_type (void);
#define PAS_BACKEND_TYPE (pas_backend_get_type ())
#define PAS_BACKEND(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_TYPE, PASBackend))
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index 55caf1dce7..4cd51237a1 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -241,6 +241,20 @@ impl_Evolution_Book_check_connection (PortableServer_Servant servant,
pas_book_queue_check_connection (book);
}
+static char *
+impl_Evolution_Book_get_static_capabilities (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
+ char *temp;
+ char *ret_val;
+
+ temp = pas_backend_get_static_capabilities (book->priv->backend);
+ ret_val = CORBA_string_dup(temp);
+ g_free(temp);
+ return ret_val;
+}
+
/**
* pas_book_get_backend:
*/
@@ -598,15 +612,16 @@ pas_book_get_epv (void)
epv = g_new0 (POA_Evolution_Book__epv, 1);
- epv->get_vcard = impl_Evolution_Book_get_vcard;
- epv->can_write = impl_Evolution_Book_can_write;
- epv->can_write_card = impl_Evolution_Book_can_write_card;
- epv->create_card = impl_Evolution_Book_create_card;
- epv->remove_card = impl_Evolution_Book_remove_card;
- epv->modify_card = impl_Evolution_Book_modify_card;
- epv->check_connection = impl_Evolution_Book_check_connection;
- epv->get_cursor = impl_Evolution_Book_get_cursor;
- epv->get_book_view = impl_Evolution_Book_get_book_view;
+ epv->get_vcard = impl_Evolution_Book_get_vcard;
+ epv->can_write = impl_Evolution_Book_can_write;
+ epv->can_write_card = impl_Evolution_Book_can_write_card;
+ epv->create_card = impl_Evolution_Book_create_card;
+ epv->remove_card = impl_Evolution_Book_remove_card;
+ epv->modify_card = impl_Evolution_Book_modify_card;
+ epv->check_connection = impl_Evolution_Book_check_connection;
+ epv->get_static_capabilities = impl_Evolution_Book_get_static_capabilities;
+ epv->get_cursor = impl_Evolution_Book_get_cursor;
+ epv->get_book_view = impl_Evolution_Book_get_book_view;
return epv;
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
index 43a94b6600..9ca81eb25d 100644
--- a/addressbook/backend/pas/pas-book.h
+++ b/addressbook/backend/pas/pas-book.h
@@ -56,38 +56,37 @@ typedef char * (*PASBookGetVCardFn) (PASBook *book, const char *id);
typedef gboolean (*PASBookCanWriteFn) (PASBook *book);
typedef gboolean (*PASBookCanWriteCardFn) (PASBook *book, const char *id);
-PASBook *pas_book_new (PASBackend *backend,
- Evolution_BookListener listener,
- PASBookGetVCardFn get_vcard,
- PASBookCanWriteFn can_write,
- PASBookCanWriteCardFn can_write_card);
-PASBackend *pas_book_get_backend (PASBook *book);
-Evolution_BookListener pas_book_get_listener (PASBook *book);
-int pas_book_check_pending (PASBook *book);
-PASRequest *pas_book_pop_request (PASBook *book);
+PASBook *pas_book_new (PASBackend *backend,
+ Evolution_BookListener listener,
+ PASBookGetVCardFn get_vcard,
+ PASBookCanWriteFn can_write,
+ PASBookCanWriteCardFn can_write_card);
+PASBackend *pas_book_get_backend (PASBook *book);
+Evolution_BookListener pas_book_get_listener (PASBook *book);
+int pas_book_check_pending (PASBook *book);
+PASRequest *pas_book_pop_request (PASBook *book);
+void pas_book_respond_open (PASBook *book,
+ Evolution_BookListener_CallStatus status);
+void pas_book_respond_create (PASBook *book,
+ Evolution_BookListener_CallStatus status,
+ const char *id);
+void pas_book_respond_remove (PASBook *book,
+ Evolution_BookListener_CallStatus status);
+void pas_book_respond_modify (PASBook *book,
+ Evolution_BookListener_CallStatus status);
+void pas_book_respond_get_cursor (PASBook *book,
+ Evolution_BookListener_CallStatus status,
+ PASCardCursor *cursor);
+void pas_book_respond_get_book_view (PASBook *book,
+ Evolution_BookListener_CallStatus status,
+ PASBookView *book_view);
+void pas_book_report_connection (PASBook *book,
+ gboolean connected);
-void pas_book_respond_open (PASBook *book,
- Evolution_BookListener_CallStatus status);
-void pas_book_respond_create (PASBook *book,
- Evolution_BookListener_CallStatus status,
- const char *id);
-void pas_book_respond_remove (PASBook *book,
- Evolution_BookListener_CallStatus status);
-void pas_book_respond_modify (PASBook *book,
- Evolution_BookListener_CallStatus status);
-void pas_book_respond_get_cursor (PASBook *book,
- Evolution_BookListener_CallStatus status,
- PASCardCursor *cursor);
-void pas_book_respond_get_book_view (PASBook *book,
- Evolution_BookListener_CallStatus status,
- PASBookView *book_view);
-void pas_book_report_connection (PASBook *book,
- gboolean connected);
-
-gboolean pas_book_can_write (PASBook *book);
-gboolean pas_book_can_write_card (PASBook *book,
- const char *id);
-GtkType pas_book_get_type (void);
+gboolean pas_book_can_write (PASBook *book);
+gboolean pas_book_can_write_card (PASBook *book,
+ const char *id);
+GtkType pas_book_get_type (void);
#define PAS_BOOK_TYPE (pas_book_get_type ())
#define PAS_BOOK(o) (GTK_CHECK_CAST ((o), PAS_BOOK_TYPE, PASBook))