From b2019f34096c075bedcc2f9db7ee94d493225768 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 22 Sep 2000 11:13:53 +0000 Subject: Added evolution-addressbook-ldap.xml. 2000-09-22 Christopher James Lahey * 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 * 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 --- addressbook/gui/widgets/e-addressbook-model.c | 63 ++++++++++++++++++--------- 1 file changed, 42 insertions(+), 21 deletions(-) (limited to 'addressbook/gui/widgets/e-addressbook-model.c') 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); +} -- cgit