aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/conduit/address-conduit.c
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/conduit/address-conduit.c')
-rw-r--r--addressbook/conduit/address-conduit.c53
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);
}