From a88ff5661a82f7a1cbdf9b824d2b12ad9a7992df Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 29 Nov 2000 03:49:12 +0000 Subject: Return a struct rather than a pointer to a struct (compare): 2000-11-28 JP Rosevear * conduits/todo/todo-conduit.c (local_record_to_pilot_record): Return a struct rather than a pointer to a struct (compare): local_record_to_pilot_record now returns a struct (prepare): ditto (free_prepare): remove as per gnome-pilot changes (conduit_get_gpilot_conduit): don't listen for free_prepare signal * conduits/calendar/calendar-conduit.c: Same as above 2000-11-28 JP Rosevear * conduit/address-conduit.c (local_record_to_pilot_record): Return a struct rather than a pointer to a struct (view_cb): kill warning (compare): local_record_to_pilot_record now returns a struct (prepare): ditto (free_prepare): remove as per gnome-pilot changes (conduit_get_gpilot_conduit): don't listen for free_prepare signal svn path=/trunk/; revision=6708 --- addressbook/ChangeLog | 10 +++++++ addressbook/conduit/address-conduit.c | 53 +++++++++++------------------------ 2 files changed, 26 insertions(+), 37 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 8aff64f30d..a6002cfeda 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,13 @@ +2000-11-28 JP Rosevear + + * conduit/address-conduit.c (local_record_to_pilot_record): Return + a struct rather than a pointer to a struct + (view_cb): kill warning + (compare): local_record_to_pilot_record now returns a struct + (prepare): ditto + (free_prepare): remove as per gnome-pilot changes + (conduit_get_gpilot_conduit): don't listen for free_prepare signal + 2000-11-27 JP Rosevear * conduit/address-conduit.h: Remove "complete" field diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index b1b3fa7bdd..45dce1f1ed 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -258,28 +258,25 @@ compute_status (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char * local->local.attr = GnomePilotRecordNothing; } -static GnomePilotRecord * +static GnomePilotRecord local_record_to_pilot_record (EAddrLocalRecord *local, EAddrConduitContext *ctxt) { - GnomePilotRecord *p = NULL; + GnomePilotRecord p; - g_return_val_if_fail (local != NULL, NULL); g_assert (local->addr != NULL ); LOG ("local_record_to_pilot_record\n"); - p = g_new0 (GnomePilotRecord, 1); - - p->ID = local->local.ID; - p->category = 0; - p->attr = local->local.attr; - p->archived = local->local.archived; - p->secret = local->local.secret; + p.ID = local->local.ID; + p.category = 0; + p.attr = local->local.attr; + p.archived = local->local.archived; + p.secret = local->local.secret; /* Generate pilot record structure */ - p->record = g_new0 (char,0xffff); - p->length = pack_Address (local->addr, p->record, 0xffff); + p.record = g_new0 (char,0xffff); + p.length = pack_Address (local->addr, p.record, 0xffff); return p; } @@ -558,8 +555,10 @@ sequence_complete (EBookView *book_view, EAddrConduitContext *ctxt) } static void -view_cb (EBook *book, EBookStatus status, EBookView *book_view, EAddrConduitContext *ctxt) +view_cb (EBook *book, EBookStatus status, EBookView *book_view, gpointer data) { + EAddrConduitContext *ctxt = data; + gtk_object_ref (GTK_OBJECT (book_view)); gtk_signal_connect (GTK_OBJECT (book_view), "card_added", @@ -792,7 +791,7 @@ compare (GnomePilotConduitSyncAbs *conduit, EAddrConduitContext *ctxt) { /* used by the quick compare */ - GnomePilotRecord *local_pilot = NULL; + GnomePilotRecord local_pilot; int retval = 0; LOG ("compare: local=%s remote=%s...\n", @@ -802,11 +801,9 @@ compare (GnomePilotConduitSyncAbs *conduit, g_return_val_if_fail (remote!=NULL,-1); local_pilot = local_record_to_pilot_record (local, ctxt); - if (!local_pilot) - return -1; - if (remote->length != local_pilot->length - || memcmp (local_pilot->record, remote->record, remote->length)) + if (remote->length != local_pilot.length + || memcmp (local_pilot.record, remote->record, remote->length)) retval = 1; if (retval == 0) @@ -814,8 +811,6 @@ compare (GnomePilotConduitSyncAbs *conduit, else LOG (" not equal"); - g_free (local_pilot); - return retval; } @@ -970,31 +965,16 @@ free_match (GnomePilotConduitSyncAbs *conduit, static gint prepare (GnomePilotConduitSyncAbs *conduit, EAddrLocalRecord *local, - GnomePilotRecord **remote, + GnomePilotRecord *remote, EAddrConduitContext *ctxt) { LOG ("prepare: encoding local %s\n", print_local (local)); *remote = local_record_to_pilot_record (local, ctxt); - if (!*remote) - return -1; - return 0; } -static gint -free_prepare (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - EAddrConduitContext *ctxt) -{ - LOG ("free_prepare: freeing\n"); - - g_return_val_if_fail (remote != NULL, -1); - - return 0; -} - static ORBit_MessageValidationResult accept_all_cookies (CORBA_unsigned_long request_id, CORBA_Principal *principal, @@ -1056,7 +1036,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id) gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt); gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt); - gtk_signal_connect (retval, "free_prepare", (GtkSignalFunc) free_prepare, ctxt); return GNOME_PILOT_CONDUIT (retval); } -- cgit