diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-11-29 11:49:12 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-11-29 11:49:12 +0800 |
commit | a88ff5661a82f7a1cbdf9b824d2b12ad9a7992df (patch) | |
tree | e43c0f17439f1e0890379ea5768f1782afbebcd9 /addressbook/conduit | |
parent | 9e0661d19a9f7d66688ebf68fe5b21fd7316c082 (diff) | |
download | gsoc2013-evolution-a88ff5661a82f7a1cbdf9b824d2b12ad9a7992df.tar.gz gsoc2013-evolution-a88ff5661a82f7a1cbdf9b824d2b12ad9a7992df.tar.zst gsoc2013-evolution-a88ff5661a82f7a1cbdf9b824d2b12ad9a7992df.zip |
Return a struct rather than a pointer to a struct (compare):
2000-11-28 JP Rosevear <jpr@helixcode.com>
* 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 <jpr@helixcode.com>
* 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
Diffstat (limited to 'addressbook/conduit')
-rw-r--r-- | addressbook/conduit/address-conduit.c | 53 |
1 files changed, 16 insertions, 37 deletions
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); } |