diff options
Diffstat (limited to 'calendar/conduits')
-rw-r--r-- | calendar/conduits/calendar/Makefile.am | 24 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 144 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar.conduit.in | 6 |
3 files changed, 57 insertions, 117 deletions
diff --git a/calendar/conduits/calendar/Makefile.am b/calendar/conduits/calendar/Makefile.am index 35ba864676..1aa9abecd6 100644 --- a/calendar/conduits/calendar/Makefile.am +++ b/calendar/conduits/calendar/Makefile.am @@ -31,7 +31,6 @@ calendar_conduit_control_applet_LDADD = \ # $(top_builddir)/gpilotd/libgpilotdconduit.la \ -if HAVE_GNOME_PILOT # calendar_conduit calendar_conduitsdir=$(libdir)/gnome-pilot/conduits calendar_conduits_LTLIBRARIES = libcalendar_conduit.la @@ -44,25 +43,24 @@ libcalendar_conduit_la_SOURCES = \ calendar.conduit: calendar.conduit.in Makefile sed -e 's^\@prefix\@^$(prefix)^g' < $(srcdir)/calendar.conduit.in > calendar.conduit.tmp \ && mv calendar.conduit.tmp calendar.conduit -endif +# +# conduit +# libcalendar_conduit_la_LDFLAGS = \ -rpath $(libdir) -libcalendar_conduit_la_LIBADD = \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ - $(GNOME_LIBDIR) \ +libcalendar_conduit_la_LIBADD = \ + $(top_builddir)/calendar/cal-client/libcal-client-static.la \ + $(top_builddir)/calendar/cal-util/libcal-util-static.la \ + $(top_builddir)/libversit/libversit.la \ + $(top_builddir)/libical/src/libical/libical-static.la \ + $(BONOBO_VFS_GNOME_LIBS) \ + $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ + $(GNOME_LIBDIR) \ $(GNOME_LIBS) -# $(top_builddir)/calendar/cal-client/libcal-client.la \ -# $(top_builddir)/calendar/cal-util/libcal-util.la \ -# $(top_builddir)/libversit/libversit.la \ -# $(top_builddir)/libical/src/libical/libical.la \ - - - ccenterdir = $(datadir)/control-center ccenterPalmPilotdir = $(ccenterdir)/Peripherals ccenterConduitsdir = $(ccenterPalmPilotdir)/Conduits diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 0e4c713636..30363cbcf2 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -58,7 +58,7 @@ void local_record_from_icalobject (GCalLocalRecord *local, iCalObject *obj); } -gboolean load_success; +gboolean load_success = FALSE; static void @@ -69,14 +69,16 @@ gnome_calendar_load_cb (GtkWidget *cal_client, CalClient *client = CAL_CLIENT (cal_client); static int tried = 0; - printf ("intering gnome_calendar_load_cb, tried=%d\n", tried); + printf ("entering gnome_calendar_load_cb, tried=%d\n", tried); if (status == CAL_CLIENT_LOAD_SUCCESS) { load_success = TRUE; printf (" success\n"); + gtk_main_quit (); /* end the sub event loop */ } else { if (tried) { printf ("load and create of calendar failed\n"); + gtk_main_quit (); /* end the sub event loop */ return; } @@ -103,29 +105,20 @@ start_calendar_server (GnomePilotConduitStandardAbs *conduit, ctxt->calendar_file = g_concat_dir_and_file (g_get_home_dir (), "evolution/local/Calendar/calendar.vcf"); - /* hmm. */ gtk_signal_connect (GTK_OBJECT (ctxt->client), "cal_loaded", gnome_calendar_load_cb, ctxt); load_success = FALSE; + + printf ("calling cal_client_load_calendar\n"); cal_client_load_calendar (ctxt->client, ctxt->calendar_file); - /* - ctxt->calendar = goad_server_activate_with_id (NULL, - "IDL:GNOME:Calendar:Repository:1.0", - 0, NULL); - if (ctxt->calendar == CORBA_OBJECT_NIL) { - g_warning ("Can not communicate with GnomeCalendar server"); - return -1; - } - - if (ctxt->ev._major != CORBA_NO_EXCEPTION){ - show_exception(&(ctxt->ev)); - CORBA_exception_free(&(ctxt->ev)); - return -1; - } - */ + + /* run a sub event loop to turn cal-client's async load + notification into a synchronous call */ + gtk_main (); + return 0; } @@ -146,7 +139,7 @@ get_calendar_objects(GnomePilotConduitStandardAbs *conduit, GCalConduitContext *ctxt) { GList *uids; - GSList *result; + GSList *result = NULL; g_return_val_if_fail (conduit != NULL, NULL); g_return_val_if_fail (ctxt != NULL, NULL); @@ -265,36 +258,9 @@ find_record_in_repository(GnomePilotConduitStandardAbs *conduit, INFO ("Object did not exist"); return NULL; - - -#if 0 - vcal_string = - GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev)); - - if (ctxt->ev._major == CORBA_USER_EXCEPTION){ - INFO ("Object did not exist"); - show_exception(&(ctxt->ev)); - CORBA_exception_free(&(ctxt->ev)); - return NULL; - } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) { - WARN (_("Error while communicating with calendar server")); - show_exception(&(ctxt->ev)); - CORBA_exception_free(&(ctxt->ev)); - return NULL; - } else { - LOG ("Found"); - loc = g_new0(GCalLocalRecord,1); - /* memory allocated in new_from_string is freed in free_match */ - local_record_from_icalobject(loc, - ical_object_new_from_string (vcal_string)); - /* g_free(vcal_string); FIXME: this coredumps, but won't it leak without ? */ - return loc; - } - - return NULL; -#endif /* 0 */ } + /* * updates an given iCalObject in the repository */ @@ -309,29 +275,9 @@ update_calendar_entry_in_repository(GnomePilotConduitStandardAbs *conduit, g_return_if_fail(obj!=NULL); success = cal_client_update_object (ctxt->client, obj); - - - /* - str = calendar_string_from_object (obj); - - GNOME_Calendar_Repository_update_object (ctxt->calendar, obj->uid, str, &(ctxt->ev)); - - if (ctxt->ev._major == CORBA_USER_EXCEPTION){ - INFO ("Object did not exist"); - show_exception(&(ctxt->ev)); - CORBA_exception_free(&(ctxt->ev)); - return; - } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) { - WARN (_("Error while communicating with calendar server")); - show_exception(&(ctxt->ev)); - CORBA_exception_free(&(ctxt->ev)); - return; - } - - free (str); - */ } + static iCalObject * ical_from_remote_record(GnomePilotConduitStandardAbs *conduit, PilotRecord *remote, @@ -509,6 +455,7 @@ ical_from_remote_record(GnomePilotConduitStandardAbs *conduit, return obj; } + /* Code blatantly stolen from * calendar-pilot-sync.c: * @@ -534,6 +481,7 @@ update_record (GnomePilotConduitStandardAbs *conduit, unpack_Appointment(&a,remote->record,remote->length); LOG ("requesting %ld [%s]", remote->ID, a.description); + printf ("requesting %ld [%s]\n", remote->ID, a.description); status = cal_client_get_uid_by_pilot_id(ctxt->client, remote->ID, &uid); if (status == CAL_CLIENT_GET_SUCCESS) @@ -543,6 +491,7 @@ update_record (GnomePilotConduitStandardAbs *conduit, time_t now = time (NULL); LOG ("Object did not exist, creating a new one"); + printf ("Object did not exist, creating a new one\n"); obj = ical_new (a.note ? a.note : "", g_get_user_name (), @@ -556,8 +505,11 @@ update_record (GnomePilotConduitStandardAbs *conduit, obj->pilot_id = remote->ID; obj->pilot_status = ICAL_PILOT_SYNC_NONE; } else { + iCalObject *new_obj; LOG ("Found"); - ical_from_remote_record (conduit, remote, obj); + printf ("Found\n"); + new_obj = ical_from_remote_record (conduit, remote, obj); + obj = new_obj; } /* update record on server */ @@ -582,7 +534,7 @@ check_for_slow_setting (GnomePilotConduit *c, GCalConduitContext *ctxt) uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_ANY); entry_number = g_list_length (uids); - LOG (_("Calendar holds %d entries"),entry_number); + LOG (_("Calendar holds %d entries"), entry_number); /* If the local base is empty, do a slow sync */ if (entry_number == 0) { GnomePilotConduitStandard *conduit; @@ -592,16 +544,23 @@ check_for_slow_setting (GnomePilotConduit *c, GCalConduitContext *ctxt) } static gint -pre_sync(GnomePilotConduit *c, - GnomePilotDBInfo *dbi, - GCalConduitContext *ctxt) +pre_sync (GnomePilotConduit *c, + GnomePilotDBInfo *dbi, + GCalConduitContext *ctxt) { int l; gint num_records; unsigned char *buf; - GList *uids; + //GList *uids; GnomePilotConduitStandardAbs *conduit; + /* + g_log_set_always_fatal (G_LOG_LEVEL_ERROR | + G_LOG_LEVEL_CRITICAL | + G_LOG_LEVEL_WARNING); + */ + + conduit = GNOME_PILOT_CONDUIT_STANDARD_ABS(c); g_message ("GnomeCal Conduit v.%s",CONDUIT_VERSION); @@ -609,7 +568,7 @@ pre_sync(GnomePilotConduit *c, //ctxt->calendar = CORBA_OBJECT_NIL; ctxt->client = NULL; - if (start_calendar_server(GNOME_PILOT_CONDUIT_STANDARD_ABS(c),ctxt) != 0) { + if (start_calendar_server (GNOME_PILOT_CONDUIT_STANDARD_ABS(c), ctxt) != 0) { WARN(_("Could not start gnomecal server")); gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), _("Could not start gnomecal server")); @@ -617,16 +576,6 @@ pre_sync(GnomePilotConduit *c, } - - /* FIX ME */ - uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_ANY); - num_records = g_list_length (uids); - - gnome_pilot_conduit_standard_abs_set_num_local_records (conduit, num_records); - gnome_pilot_conduit_standard_abs_set_num_updated_local_records (conduit, num_records); - gnome_pilot_conduit_standard_abs_set_num_new_local_records (conduit, num_records); - gnome_pilot_conduit_standard_abs_set_num_deleted_local_records (conduit, num_records); - #if 0 /* Set the counters for the progress bar crap */ num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_ANY, &(ctxt->ev)); @@ -737,8 +686,8 @@ archive_remote (GnomePilotConduitStandardAbs *conduit, { LOG ("entering archive_remote"); - g_return_val_if_fail(remote!=NULL,-1); - g_return_val_if_fail(local!=NULL,-1); + //g_return_val_if_fail(remote!=NULL,-1); + //g_return_val_if_fail(local!=NULL,-1); return -1; } @@ -788,7 +737,7 @@ iterate (GnomePilotConduitStandardAbs *conduit, hest = 0; if(events!=NULL) { - LOG ("iterating over %d records",g_slist_length(events)); + LOG ("iterating over %d records", g_slist_length (events)); *local = g_new0(GCalLocalRecord,1); local_record_from_ical_uid(*local,(gchar*)events->data,ctxt); @@ -798,7 +747,7 @@ iterate (GnomePilotConduitStandardAbs *conduit, (*local) = NULL; } } else { - /*LOG ("continuing iteration");*/ + /* printf ("continuing iteration\n"); */ hest++; if(g_slist_next(iterator)==NULL) { GSList *l; @@ -807,7 +756,7 @@ iterate (GnomePilotConduitStandardAbs *conduit, /** free stuff allocated for iteration */ g_free((*local)); - LOG ("iterated over %d records",hest); + LOG ("iterated over %d records", hest); for(l=events;l;l=l->next) g_free(l->data); @@ -824,6 +773,7 @@ iterate (GnomePilotConduitStandardAbs *conduit, return 1; } + static gint iterate_specific (GnomePilotConduitStandardAbs *conduit, GCalLocalRecord **local, @@ -840,7 +790,7 @@ iterate_specific (GnomePilotConduitStandardAbs *conduit, case GnomePilotRecordNew: tmp = g_strdup("RecordNew"); break; default: tmp = g_strdup_printf("0x%x",flag); break; } - LOG ("entering iterate_specific(flag = %s)",tmp); + printf ("entering iterate_specific(flag = %s)\n", tmp); g_free(tmp); } #endif @@ -862,12 +812,12 @@ purge (GnomePilotConduitStandardAbs *conduit, { LOG ("entering purge"); - /* HEST, gem posterne her */ return -1; } + static gint set_status (GnomePilotConduitStandardAbs *conduit, GCalLocalRecord *local, @@ -949,14 +899,6 @@ set_pilot_id (GnomePilotConduitStandardAbs *conduit, local->local.ID, local->ical->pilot_status); - /* - GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar, - local->ical->uid, - local->local.ID, - local->ical->pilot_status, - &(ctxt->ev)); - */ - return 0; } @@ -1431,7 +1373,7 @@ conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) if (ctxt->client != NULL) { gtk_object_unref (GTK_OBJECT (ctxt->client)); - //pi_close (link); + //pi_close (ctxt->link); //GNOME_Calendar_Repository_done (ctxt->calendar, &(ctxt->ev)); } diff --git a/calendar/conduits/calendar/calendar.conduit.in b/calendar/conduits/calendar/calendar.conduit.in index 7a25f5b61e..fb48e00584 100644 --- a/calendar/conduits/calendar/calendar.conduit.in +++ b/calendar/conduits/calendar/calendar.conduit.in @@ -1,7 +1,7 @@ <gnome-pilot-conduit version="1.0"> -<conduit id="gnomecal" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libcalendar_conduit.so"/> -<name value="GnomeCal"/> -<conduit-attribute name="description" value="Synchronizes with GnomeCal"/> +<conduit id="Calendar" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libcalendar_conduit.so"/> +<name value="Calendar"/> +<conduit-attribute name="description" value="Synchronizes with Evolution"/> <conduit-attribute name="default-synctype" value="synchronize"/> <conduit-attribute name="icon" value="@prefix@/share/pixmaps/gnome-calendar-conduit.png"/> <conduit-attribute name="settings" value="TRUE"/> |