aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas/pas-backend-file.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-03-08 08:51:11 +0800
committerChris Toshok <toshok@src.gnome.org>2002-03-08 08:51:11 +0800
commitda6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6 (patch)
tree613214c31c5e45a6a21357a2e8ca652c2294e413 /addressbook/backend/pas/pas-backend-file.c
parenta9791c82f0513cdeb607c94f8b73c8040dc16bf5 (diff)
downloadgsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.tar
gsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.tar.gz
gsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.tar.bz2
gsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.tar.lz
gsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.tar.xz
gsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.tar.zst
gsoc2013-evolution-da6e1ea98dcf2614ea71ea5dfb88ef63e194c8f6.zip
track union/struct change. (pas_book_queue_remove_card): same.
2002-03-07 Chris Toshok <toshok@ximian.com> * backend/pas/pas-book.c (pas_book_queue_create_card): track union/struct change. (pas_book_queue_remove_card): same. (pas_book_queue_modify_card): same. (pas_book_queue_get_cursor): same. (pas_book_queue_get_vcard): same. (pas_book_queue_authenticate_user): same. (pas_book_queue_get_book_view): same. (pas_book_queue_get_changes): same. (pas_book_free_request): new function - free everything we need to for each type of request. (pas_book_destroy): call pas_book_free_request here instead of just freeing 3 elements of the old struct. yay plugging memleaks. * backend/pas/pas-book.h: make PASRequest a union and split out members into structs, so it's a little clearer which fields are used by which requests. Also, add prototype for pas_book_free_request so backends can just free everything at once (usually in their requests_queued signal func.) * backend/pas/pas-backend-file.c (pas_backend_file_process_create_card): track struct/union change. (pas_backend_file_process_remove_card): same. (pas_backend_file_process_modify_card): same. (pas_backend_file_build_cards_list): same. (pas_backend_file_process_get_vcard): same. (pas_backend_file_process_get_cursor): same. (pas_backend_file_process_get_book_view): same. (pas_backend_file_process_get_changes): same. (pas_backend_file_process_check_connection): same. (pas_backend_file_process_authenticate_user): same. (pas_backend_file_process_get_supported_fields): same. (pas_backend_file_process_client_requests): case the union to the specific struct and pass it to the process_* functions. also, call pas_book_free_request here, instead of relying on each of the functions to free their stuff. svn path=/trunk/; revision=15987
Diffstat (limited to 'addressbook/backend/pas/pas-backend-file.c')
-rw-r--r--addressbook/backend/pas/pas-backend-file.c65
1 files changed, 25 insertions, 40 deletions
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 057012ddaa..acca404ad8 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -535,7 +535,7 @@ do_create(PASBackend *backend,
static void
pas_backend_file_process_create_card (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASCreateCardRequest *req)
{
char *id;
char *vcard;
@@ -577,7 +577,7 @@ pas_backend_file_process_create_card (PASBackend *backend,
static void
pas_backend_file_process_remove_card (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASRemoveCardRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
DB *db = bf->priv->file_db;
@@ -636,7 +636,7 @@ pas_backend_file_process_remove_card (PASBackend *backend,
static void
pas_backend_file_process_modify_card (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASModifyCardRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
DB *db = bf->priv->file_db;
@@ -671,7 +671,6 @@ pas_backend_file_process_modify_card (PASBackend *backend,
pas_book_respond_modify (
book,
GNOME_Evolution_Addressbook_BookListener_CardNotFound);
- g_free (req->id);
return;
}
old_vcard_string = g_strdup(vcard_dbt.data);
@@ -728,8 +727,8 @@ pas_backend_file_process_modify_card (PASBackend *backend,
static void
pas_backend_file_build_cards_list(PASBackend *backend,
- PASBackendFileCursorPrivate *cursor_data,
- char *search)
+ PASBackendFileCursorPrivate *cursor_data,
+ char *search)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
DB *db = bf->priv->file_db;
@@ -788,7 +787,7 @@ pas_backend_file_build_cards_list(PASBackend *backend,
static void
pas_backend_file_process_get_vcard (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASGetVCardRequest *req)
{
PASBackendFile *bf;
DB *db;
@@ -821,7 +820,7 @@ pas_backend_file_process_get_vcard (PASBackend *backend,
static void
pas_backend_file_process_get_cursor (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASGetCursorRequest *req)
{
/*
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
@@ -871,10 +870,9 @@ pas_backend_file_process_get_cursor (PASBackend *backend,
static void
pas_backend_file_process_get_book_view (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASGetBookViewRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- CORBA_Environment ev;
PASBookView *book_view;
PASBackendFileBookView view;
EIterator *iterator;
@@ -889,7 +887,7 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
GTK_SIGNAL_FUNC(view_destroy), book);
view.book_view = book_view;
- view.search = req->search;
+ view.search = g_strdup (req->search);
view.card_sexp = NULL;
view.change_id = NULL;
view.change_context = NULL;
@@ -906,25 +904,12 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
e_iterator_last(iterator);
pas_backend_file_search (bf, book, e_iterator_get(iterator));
gtk_object_unref(GTK_OBJECT(iterator));
-
- g_free(req->search);
- CORBA_exception_init(&ev);
-
- bonobo_object_unref (BONOBO_OBJECT (book_view));
- bonobo_object_release_unref (req->listener, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("pas_backend_file_process_get_book_view: Exception unreffing "
- "listener.\n");
- }
-
- CORBA_exception_free(&ev);
}
static void
pas_backend_file_process_get_changes (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASGetChangesRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
CORBA_Environment ev;
@@ -967,7 +952,7 @@ pas_backend_file_process_get_changes (PASBackend *backend,
pas_backend_file_changes (bf, book, e_iterator_get(iterator));
gtk_object_unref(GTK_OBJECT(iterator));
- g_free(req->search);
+ g_free(req->change_id);
CORBA_exception_init(&ev);
bonobo_object_release_unref (req->listener, &ev);
@@ -982,7 +967,7 @@ pas_backend_file_process_get_changes (PASBackend *backend,
static void
pas_backend_file_process_check_connection (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASCheckConnectionRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
@@ -1000,7 +985,7 @@ pas_backend_file_extract_path_from_uri (const char *uri)
static void
pas_backend_file_process_authenticate_user (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASAuthenticateUserRequest *req)
{
pas_book_respond_authenticate_user (book,
GNOME_Evolution_Addressbook_BookListener_Success);
@@ -1009,7 +994,7 @@ pas_backend_file_process_authenticate_user (PASBackend *backend,
static void
pas_backend_file_process_get_supported_fields (PASBackend *backend,
PASBook *book,
- PASRequest *req)
+ PASGetSupportedFieldsRequest *req)
{
EList *fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
ECardSimple *simple;
@@ -1047,47 +1032,47 @@ pas_backend_file_process_client_requests (PASBook *book)
switch (req->op) {
case CreateCard:
- pas_backend_file_process_create_card (backend, book, req);
+ pas_backend_file_process_create_card (backend, book, (PASCreateCardRequest*)req);
break;
case RemoveCard:
- pas_backend_file_process_remove_card (backend, book, req);
+ pas_backend_file_process_remove_card (backend, book, (PASRemoveCardRequest*)req);
break;
case ModifyCard:
- pas_backend_file_process_modify_card (backend, book, req);
+ pas_backend_file_process_modify_card (backend, book, (PASModifyCardRequest*)req);
break;
case CheckConnection:
- pas_backend_file_process_check_connection (backend, book, req);
+ pas_backend_file_process_check_connection (backend, book, (PASCheckConnectionRequest*)req);
break;
case GetVCard:
- pas_backend_file_process_get_vcard (backend, book, req);
+ pas_backend_file_process_get_vcard (backend, book, (PASGetVCardRequest*)req);
break;
case GetCursor:
- pas_backend_file_process_get_cursor (backend, book, req);
+ pas_backend_file_process_get_cursor (backend, book, (PASGetCursorRequest*)req);
break;
case GetBookView:
- pas_backend_file_process_get_book_view (backend, book, req);
+ pas_backend_file_process_get_book_view (backend, book, (PASGetBookViewRequest*)req);
break;
case GetChanges:
- pas_backend_file_process_get_changes (backend, book, req);
+ pas_backend_file_process_get_changes (backend, book, (PASGetChangesRequest*)req);
break;
case AuthenticateUser:
- pas_backend_file_process_authenticate_user (backend, book, req);
+ pas_backend_file_process_authenticate_user (backend, book, (PASAuthenticateUserRequest*)req);
break;
case GetSupportedFields:
- pas_backend_file_process_get_supported_fields (backend, book, req);
+ pas_backend_file_process_get_supported_fields (backend, book, (PASGetSupportedFieldsRequest*)req);
break;
}
- g_free (req);
+ pas_book_free_request (req);
}
static void