diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-09-22 19:13:53 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-09-22 19:13:53 +0800 |
commit | b2019f34096c075bedcc2f9db7ee94d493225768 (patch) | |
tree | 60117e19ac3be2357786d4fd6dec1b6454de9daa | |
parent | 0d39d588a7da56bca9c195615d765edd572b3a41 (diff) | |
download | gsoc2013-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
23 files changed, 442 insertions, 142 deletions
@@ -1,3 +1,12 @@ +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. + 2000-09-21 Federico Mena Quintero <federico@helixcode.com> * ui/evolution-calendar.xml: Removed the AboutCalendar stuff. 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 } diff --git a/ui/Makefile.am b/ui/Makefile.am index b92e8da6a7..ce5bf1b3f4 100644 --- a/ui/Makefile.am +++ b/ui/Makefile.am @@ -1,6 +1,7 @@ XML_FILES = \ evolution.xml \ evolution-addressbook.xml \ + evolution-addressbook-ldap.xml \ evolution-contact-editor.xml \ evolution-mail.xml \ evolution-calendar.xml diff --git a/ui/evolution-addressbook-ldap.xml b/ui/evolution-addressbook-ldap.xml new file mode 100644 index 0000000000..02fb384d30 --- /dev/null +++ b/ui/evolution-addressbook-ldap.xml @@ -0,0 +1,83 @@ +<Root> + + <menu> + <submenu name="File" _label="_File"> + + <placeholder name="Print"> + + <menuitem name="Print" verb="ContactsPrint" + _label="_Print Contacts..." + pixtype="stock" pixname="Menu_Print"/> + + </placeholder> + + </submenu> + + <submenu name="View" _label="_View"> + + <menuitem name="AsTable" _label="As _Table" + verb="ViewAsTable"/> + + <menuitem name="ViewNewContact" verb="" + _label="_New Contact"/> + + </submenu> + + <placeholder name="Component"> + + <submenu name="Tools" _label="_Tools"> + + <menuitem name="Search" verb="ToolSearch" + _label="_Search for contacts" + pixtype="stock" pixname="Menu_Search"/> + + </submenu> + + </placeholder> + + <placeholder name="Component"> + + <submenu name="Actions" _label="_Actions"> + + <menuitem name="New Directory Server" verb="ContactNewServer" + _label="N_ew Directory Server"/> + + </submenu> + + </placeholder> + </menu> + + <dockitem name="Toolbar" relief="none"> + <toolitem name="New" _label="New" + _decr="Create a new contact" verb="ContactNew" + pixtype="stock" pixname="New"/> + + <toolitem type="separator"/> + + <toolitem name="Find" _label="Find" + _descr="Find a contact" verb="ContactFind" + pixtype="stock" pixname="Search"/> + + <toolitem name="Print" _label="Print" + _descr="Print contacts" verb="ContactsPrint" + pixtype="stock" pixname="Print"/> + + <toolitem name="Delete" label="Delete" + _descr="Delete a contact" verb="ContactDelete" + pixtype="stock" pixname="Trash"/> + + <toolitem type="separator"/> + + <control name="QuickSearch"/> + + <toolitem name="View All" _label="View All" + _descr="View all contacts" verb="ContactViewAll" + pixtype="stock" pixname="Multiple"/> + + <toolitem name="Stop" _label="Stop" + _descr="Stop Loading" verb="ContactStop" + pixtype="stock" pixname="Stop"/> + + </dockitem> + +</Root>
\ No newline at end of file diff --git a/ui/evolution-addressbook.xml b/ui/evolution-addressbook.xml index dc3dd76fe5..192817a0b3 100644 --- a/ui/evolution-addressbook.xml +++ b/ui/evolution-addressbook.xml @@ -59,6 +59,14 @@ <control name="QuickSearch"/> + <toolitem name="View All" _label="View All" + _descr="View all contacts" verb="ContactViewAll" + pixtype="stock" pixname="Multiple"/> + + <toolitem name="Stop" _label="Stop" + _descr="Stop Loading" verb="ContactStop" + pixtype="stock" pixname="Stop"/> + </dockitem> </Root>
\ No newline at end of file |