aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog28
-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
-rw-r--r--addressbook/gui/component/addressbook.c39
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c63
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h2
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c23
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c6
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h1
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c27
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h3
19 files changed, 341 insertions, 142 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 2db2785dee..1e6f095ed7 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,31 @@
+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.
+
2000-09-21 Michael Meeks <michael@helixcode.com>
* gui/component/addressbook.c (control_activate): remove _UIHandler
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))
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 10a092cea1..a632c61ead 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -308,6 +308,20 @@ make_quick_search_widget (GtkSignalFunc start_search_func,
return search_vbox;
}
+static void
+show_all_contacts_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_show_all(view->view);
+}
+
+static void
+stop_loading_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_stop(view->view);
+}
+
BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("ContactsPrint", print_cb),
BONOBO_UI_VERB ("ViewAsTable", toggle_view_as_cb),
@@ -317,6 +331,11 @@ BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("ContactNew", new_contact_cb),
/* BONOBO_UI_VERB ("ContactFind", find_contact_cb),*/
BONOBO_UI_VERB ("ContactDelete", delete_contact_cb),
+ BONOBO_UI_VERB ("ContactViewAll", show_all_contacts_cb),
+ BONOBO_UI_VERB ("ContactStop", stop_loading_cb),
+#ifdef HAVE_LDAP
+ BONOBO_UI_VERB ("ContactNewServer", new_server_cb),
+#endif
BONOBO_UI_VERB_END
};
@@ -337,19 +356,6 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
bonobo_ui_handler_set_container (uih, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
-
-#warning FIXME; this needs to be sorted.
-#if 0
-#ifdef HAVE_LDAP
- bonobo_ui_handler_menu_new_item (uih, "/Actions/New Directory Server",
- N_("N_ew Directory Server"),
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, new_server_cb,
- (gpointer)view);
-#endif
-#endif
-
component = bonobo_ui_compat_get_component (uih);
bonobo_ui_component_add_verb_list_with_data (
@@ -360,12 +366,17 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
bonobo_ui_container_freeze (container, NULL);
+#ifdef HAVE_LDAP
+ fname = bonobo_ui_util_get_ui_fname (
+ EVOLUTION_DATADIR, "evolution-addressbook-ldap.xml");
+#else
fname = bonobo_ui_util_get_ui_fname (
EVOLUTION_DATADIR, "evolution-addressbook.xml");
+#endif
g_warning ("Attempting ui load from '%s'", fname);
ui = bonobo_ui_util_new_ui (component, fname, "evolution-addressbook");
-
+
bonobo_ui_component_set_tree (component, container, "/", ui, NULL);
g_free (fname);
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 9df7ab7225..830b70879c 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -33,13 +33,8 @@ enum {
};
static void
-addressbook_destroy(GtkObject *object)
+remove_book_view(EAddressbookModel *model)
{
- EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
- int i;
-
- if (model->get_view_idle)
- g_source_remove(model->get_view_idle);
if (model->book_view && model->create_card_id)
gtk_signal_disconnect(GTK_OBJECT (model->book_view),
model->create_card_id);
@@ -49,11 +44,31 @@ addressbook_destroy(GtkObject *object)
if (model->book_view && model->modify_card_id)
gtk_signal_disconnect(GTK_OBJECT (model->book_view),
model->modify_card_id);
- if (model->book)
- gtk_object_unref(GTK_OBJECT(model->book));
+
+ model->create_card_id = 0;
+ model->remove_card_id = 0;
+ model->modify_card_id = 0;
+
if (model->book_view)
gtk_object_unref(GTK_OBJECT(model->book_view));
+ model->book_view = NULL;
+}
+
+static void
+addressbook_destroy(GtkObject *object)
+{
+ EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
+ int i;
+
+ if (model->get_view_idle)
+ g_source_remove(model->get_view_idle);
+
+ remove_book_view(model);
+
+ if (model->book)
+ gtk_object_unref(GTK_OBJECT(model->book));
+
for ( i = 0; i < model->data_count; i++ ) {
gtk_object_unref(GTK_OBJECT(model->data[i]));
}
@@ -265,6 +280,7 @@ e_addressbook_model_init (GtkObject *object)
model->data = NULL;
model->data_count = 0;
model->editable = TRUE;
+ model->first_get_view = TRUE;
}
static void
@@ -272,17 +288,7 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
{
EAddressbookModel *model = closure;
int i;
- if (model->book_view && model->create_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->create_card_id);
- if (model->book_view && model->remove_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->remove_card_id);
- if (model->book_view && model->modify_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->modify_card_id);
- if (model->book_view)
- gtk_object_unref(GTK_OBJECT(model->book_view));
+ remove_book_view(model);
model->book_view = book_view;
if (model->book_view)
gtk_object_ref(GTK_OBJECT(model->book_view));
@@ -313,8 +319,18 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
static gboolean
get_view(EAddressbookModel *model)
{
- if (model->book && model->query)
- e_book_get_book_view(model->book, model->query, book_view_loaded, model);
+ if (model->book && model->query) {
+ if (model->first_get_view) {
+ char *capabilities;
+ capabilities = e_book_get_static_capabilities(model->book);
+ if (strstr(capabilities, "local")) {
+ e_book_get_book_view(model->book, model->query, book_view_loaded, model);
+ }
+ model->first_get_view = FALSE;
+ }
+ else
+ e_book_get_book_view(model->book, model->query, book_view_loaded, model);
+ }
model->get_view_idle = 0;
return FALSE;
@@ -421,3 +437,8 @@ e_addressbook_model_new (void)
return E_TABLE_MODEL(et);
}
+
+void e_addressbook_model_stop (EAddressbookModel *model)
+{
+ remove_book_view(model);
+}
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index 0bde425a25..860fb641ac 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -36,6 +36,7 @@ typedef struct {
int create_card_id, remove_card_id, modify_card_id;
guint editable : 1;
+ guint first_get_view : 1;
} EAddressbookModel;
@@ -50,5 +51,6 @@ ETableModel *e_addressbook_model_new (void);
/* Returns object with ref count of 1. */
ECard *e_addressbook_model_get_card(EAddressbookModel *model,
int row);
+void e_addressbook_model_stop (EAddressbookModel *model);
#endif /* _E_ADDRESSBOOK_MODEL_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 1700cfdc89..bd229fad25 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -709,3 +709,26 @@ e_addressbook_view_delete_selection(EAddressbookView *view)
if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD)
e_minicard_view_widget_remove_selection (E_MINICARD_VIEW_WIDGET(view->object), card_deleted_cb, NULL);
}
+
+void
+e_addressbook_view_show_all(EAddressbookView *view)
+{
+ gtk_object_set(GTK_OBJECT(view),
+ "query", NULL,
+ NULL);
+}
+
+void
+e_addressbook_view_stop(EAddressbookView *view)
+{
+ switch(view->view_type) {
+ case E_ADDRESSBOOK_VIEW_MINICARD:
+ e_minicard_view_widget_stop(E_MINICARD_VIEW_WIDGET (view->object));
+ break;
+ case E_ADDRESSBOOK_VIEW_TABLE:
+ e_addressbook_model_stop(E_ADDRESSBOOK_MODEL (view->object));
+ break;
+ case E_ADDRESSBOOK_VIEW_NONE:
+ break;
+ }
+}
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 0509e897e6..60da283a75 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -79,6 +79,8 @@ GtkType e_addressbook_view_get_type (void);
void e_addressbook_view_print (EAddressbookView *view);
void e_addressbook_view_delete_selection (EAddressbookView *view);
+void e_addressbook_view_show_all (EAddressbookView *view);
+void e_addressbook_view_stop (EAddressbookView *view);
#ifdef __cplusplus
}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index f23d3e4476..c6809bf1d0 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -268,3 +268,9 @@ void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
if (view->emv)
e_minicard_view_jump_to_letter(E_MINICARD_VIEW(view->emv), letter);
}
+
+void
+e_minicard_view_widget_stop(EMinicardViewWidget *view)
+{
+ e_minicard_view_stop(E_MINICARD_VIEW(view->emv));
+}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
index 952e60ee65..cf20c9a4df 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ b/addressbook/gui/widgets/e-minicard-view-widget.h
@@ -63,6 +63,7 @@ void e_minicard_view_widget_remove_selection (EMinicardViewWidget *view,
gpointer closure);
void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
char letter);
+void e_minicard_view_widget_stop (EMinicardViewWidget *view);
GtkWidget *e_minicard_view_widget_new (void);
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 249c987802..7169e41542 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -105,6 +105,7 @@ e_minicard_view_init (EMinicardView *view)
view->remove_card_id = 0;
view->modify_card_id = 0;
view->canvas_destroy_id = 0;
+ view->first_get_view = TRUE;
gtk_object_set(GTK_OBJECT(view),
"empty_message", _("\n\nThere are no items to show in this view\n\n"
@@ -191,8 +192,18 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
static gboolean
get_view(EMinicardView *view)
{
- if (view->book && view->query)
- e_book_get_book_view(view->book, view->query, book_view_loaded, view);
+ if (view->book && view->query) {
+ if (view->first_get_view) {
+ char *capabilities;
+ capabilities = e_book_get_static_capabilities(view->book);
+ if (strstr(capabilities, "local")) {
+ e_book_get_book_view(view->book, view->query, book_view_loaded, view);
+ }
+ view->first_get_view = FALSE;
+ }
+ else
+ e_book_get_book_view(view->book, view->query, book_view_loaded, view);
+ }
view->get_view_idle = 0;
return FALSE;
@@ -423,10 +434,20 @@ compare_to_letter(EMinicard *card, char *letter)
}
}
-void e_minicard_view_jump_to_letter (EMinicardView *view,
+void
+e_minicard_view_jump_to_letter (EMinicardView *view,
char letter)
{
e_reflow_sorted_jump(E_REFLOW_SORTED(view),
(GCompareFunc) compare_to_letter,
&letter);
}
+
+void
+e_minicard_view_stop (EMinicardView *view)
+{
+ disconnect_signals(view);
+ if (view->book_view)
+ gtk_object_unref(GTK_OBJECT(view->book_view));
+ view->book_view = NULL;
+}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index f12f0d43cf..e4c1be870a 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -73,6 +73,8 @@ struct _EMinicardView
int canvas_destroy_id;
int create_card_id, remove_card_id, modify_card_id;
+
+ guint first_get_view : 1;
};
struct _EMinicardViewClass
@@ -86,6 +88,7 @@ void e_minicard_view_remove_selection (EMinicardView *view,
gpointer closure);
void e_minicard_view_jump_to_letter (EMinicardView *view,
char letter);
+void e_minicard_view_stop (EMinicardView *view);
#ifdef __cplusplus
}