diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-09-10 14:52:09 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-09-10 14:52:09 +0800 |
commit | 900a7ac710e0ce88bb3c8fa00673fe405a8ba668 (patch) | |
tree | 91c9d8f5f17674291993aecc076cdfb20d6896ae /calendar/conduits/todo | |
parent | d6080b277df35517afcc21b5b963e3e86389d66b (diff) | |
download | gsoc2013-evolution-900a7ac710e0ce88bb3c8fa00673fe405a8ba668.tar.gz gsoc2013-evolution-900a7ac710e0ce88bb3c8fa00673fe405a8ba668.tar.zst gsoc2013-evolution-900a7ac710e0ce88bb3c8fa00673fe405a8ba668.zip |
Use cal component pilot stuff properly (find_record_in_repository): Remove
2000-09-10 JP Rosevear <jpr@helixcode.com>
* conduits/todo/todo-conduit.c (local_record_from_icalobject): Use
cal component pilot stuff properly
(find_record_in_repository): Remove cruft
(ical_from_remote_record): Remove cruft
(update_record): Set the vtype immediately after creation. Remove
cruft
* conduits/todo/todo-conduit.h: Remove iCalObject stuff
* conduits/todo/todo-conduit-config.h: Move all the config stuff
here, I need to kill the warnings at some point
* conduits/todo/todo-conduit-control-applet.c (doRevertSettings):
Set all the state variables correctly on a revert
(doSaveSettings): Update original state
(doHelp): Rename from about_cb
(main): Destroy configurations when done
* conduits/todo/Makefile.am: Tidy
* pcs/cal-backend-file.c (cbf_pilot_hash): Function for hashing
pilot ids
(cbf_pilot_equal): For hash table of pilot ids
(cal_backend_file_destroy): Destroy pilot id hash
(add_component): Insert the uid into the pilot hash
(remove_component): Remove the uid from the pilot hash
(cal_backend_file_load): Create the pilot hash
(cal_backend_file_create): ditto
(cal_backend_file_get_uid_by_pilot_id): Implement using the pilot
hash
(cal_backend_file_update_pilot_id): ditto
* cal-util/cal-component.h: Update prototypes
* cal-util/cal-component.c (cal_component_get_pilot_id): Implement
using ical X properties
(cal_component_set_pilot_id): ditto
(cal_component_get_pilot_status): ditto
(cal_component_set_pilot_status): ditto
(cal_component_free_pilot_id): Free a pilot id
(cal_component_free_pilot_status): Free a pilot status
svn path=/trunk/; revision=5298
Diffstat (limited to 'calendar/conduits/todo')
-rw-r--r-- | calendar/conduits/todo/Makefile.am | 21 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit-config.h | 79 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit-control-applet.c | 148 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit.c | 157 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit.h | 30 |
5 files changed, 167 insertions, 268 deletions
diff --git a/calendar/conduits/todo/Makefile.am b/calendar/conduits/todo/Makefile.am index 0dbc404d8e..5f93c81f72 100644 --- a/calendar/conduits/todo/Makefile.am +++ b/calendar/conduits/todo/Makefile.am @@ -6,6 +6,7 @@ INCLUDES = \ $(BONOBO_GNOME_CFLAGS) \ $(GNOME_PILOT_CFLAGS) +# ToDo Capplet bin_PROGRAMS = todo-conduit-control-applet todo_conduit_control_applet_SOURCES = todo-conduit-control-applet.c @@ -23,22 +24,11 @@ todo_conduit_control_applet_LDADD = \ -# todo_conduit +# ToDo Conduit todo_conduitsdir=$(libdir)/gnome-pilot/conduits todo_conduits_LTLIBRARIES = libtodo_conduit.la -libtodo_conduit_la_SOURCES = \ - todo-conduit.c - -# todo-conduit.c: my_gnomecal_idl - -todo.conduit: todo.conduit.in Makefile - sed -e 's^\@prefix\@^$(prefix)^g' < $(srcdir)/todo.conduit.in > todo.conduit.tmp \ - && mv todo.conduit.tmp todo.conduit - -# -# conduit -# +libtodo_conduit_la_SOURCES = todo-conduit.c libtodo_conduit_la_LDFLAGS = \ -rpath $(libdir) @@ -53,6 +43,11 @@ libtodo_conduit_la_LIBADD = \ $(GNOME_LIBDIR) \ $(GNOME_LIBS) +todo.conduit: todo.conduit.in Makefile + sed -e 's^\@prefix\@^$(prefix)^g' < $(srcdir)/todo.conduit.in > todo.conduit.tmp \ + && mv todo.conduit.tmp todo.conduit + + ccenterdir = $(datadir)/control-center ccenterPalmPilotdir = $(ccenterdir)/Peripherals ccenterConduitsdir = $(ccenterPalmPilotdir)/Conduits diff --git a/calendar/conduits/todo/todo-conduit-config.h b/calendar/conduits/todo/todo-conduit-config.h new file mode 100644 index 0000000000..fb4d35c7e8 --- /dev/null +++ b/calendar/conduits/todo/todo-conduit-config.h @@ -0,0 +1,79 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +#ifndef __TODO_CONDUIT_CONFIG_H__ +#define __TODO_CONDUIT_CONFIG_H__ + +#include <gnome.h> +#include <libgpilotdCM/gnome-pilot-conduit-management.h> +#include <libgpilotdCM/gnome-pilot-conduit-config.h> + +/* This is the configuration of the GnomeCal conduit. */ +typedef struct _ToDoConduitCfg ToDoConduitCfg; +struct _ToDoConduitCfg { + gboolean open_secret; + guint32 pilotId; + GnomePilotConduitSyncType sync_type; /* only used by capplet */ +}; + +static void +todoconduit_load_configuration (ToDoConduitCfg **c, guint32 pilotId) +{ + gchar prefix[256]; + g_snprintf (prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",pilotId); + + *c = g_new0 (ToDoConduitCfg,1); + g_assert (*c != NULL); + gnome_config_push_prefix (prefix); + (*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE"); + (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */ + gnome_config_pop_prefix (); + + (*c)->pilotId = pilotId; +} + +/* Saves the configuration data. */ +static void +todoconduit_save_configuration (ToDoConduitCfg *c) +{ + gchar prefix[256]; + + g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",c->pilotId); + + gnome_config_push_prefix(prefix); + gnome_config_set_bool ("open_secret", c->open_secret); + gnome_config_pop_prefix(); + + gnome_config_sync(); + gnome_config_drop_all(); +} + +/* Creates a duplicate of the configuration data */ +static ToDoConduitCfg* +todoconduit_dupe_configuration (ToDoConduitCfg *c) +{ + ToDoConduitCfg *retval; + g_return_val_if_fail (c!=NULL,NULL); + retval = g_new0 (ToDoConduitCfg,1); + retval->sync_type = c->sync_type; + retval->open_secret = c->open_secret; + retval->pilotId = c->pilotId; + return retval; +} + +static void +todoconduit_destroy_configuration (ToDoConduitCfg **c) +{ + g_return_if_fail (c!=NULL); + g_return_if_fail (*c!=NULL); + g_free (*c); + *c = NULL; +} + +#endif __TODO_CONDUIT_CONFIG_H__ + + + + + + + diff --git a/calendar/conduits/todo/todo-conduit-control-applet.c b/calendar/conduits/todo/todo-conduit-control-applet.c index 811d7fe8e2..b8b0a36dc0 100644 --- a/calendar/conduits/todo/todo-conduit-control-applet.c +++ b/calendar/conduits/todo/todo-conduit-control-applet.c @@ -11,12 +11,9 @@ #include <config.h> #include <capplet-widget.h> -#include <libgpilotdCM/gnome-pilot-conduit-management.h> -#include <libgpilotdCM/gnome-pilot-conduit-config.h> #include <gpilotd/gnome-pilot-client.h> -#include "todo-conduit.h" - +#include "todo-conduit-config.h" /* tell changes callbacks to ignore changes or not */ static gboolean ignore_changes=FALSE; @@ -32,18 +29,17 @@ GtkWidget *dialogWindow=NULL; gboolean activated,org_activation_state; GnomePilotConduitManagement *conduit; GnomePilotConduitConfig *conduit_config; -GCalConduitCfg *origState = NULL; -GCalConduitCfg *curState = NULL; +ToDoConduitCfg *origState = NULL; +ToDoConduitCfg *curState = NULL; -static void doTrySettings(GtkWidget *widget, GCalConduitCfg *GCalConduitCfg); -static void doRevertSettings(GtkWidget *widget, GCalConduitCfg *GCalConduitCfg); -static void doSaveSettings(GtkWidget *widget, GCalConduitCfg *GCalConduitCfg); +static void doTrySettings(GtkWidget *widget, ToDoConduitCfg *c); +static void doRevertSettings(GtkWidget *widget, ToDoConduitCfg *c); +static void doSaveSettings(GtkWidget *widget, ToDoConduitCfg *c); -//static void readStateCfg (GtkWidget *w, GCalConduitCfg *c); -static void setStateCfg (GtkWidget *w, GCalConduitCfg *c); +static void readStateCfg (GtkWidget *w, ToDoConduitCfg *c); +static void setStateCfg (GtkWidget *w, ToDoConduitCfg *c); gint pilotId; -CORBA_Environment ev; static GnomePilotClient *gpc; @@ -60,50 +56,10 @@ static gchar* sync_options[] ={ N_("Disabled"), N_("Merge To Pilot")}; #define SYNC_OPTIONS_COUNT 6 - - - -/* Saves the configuration data. */ -static void -gcalconduit_save_configuration(GCalConduitCfg *c) -{ - gchar prefix[256]; - - g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",c->pilotId); - - gnome_config_push_prefix(prefix); - gnome_config_set_bool ("open_secret", c->open_secret); - gnome_config_pop_prefix(); - - gnome_config_sync(); - gnome_config_drop_all(); -} - -/* Creates a duplicate of the configuration data */ -static GCalConduitCfg* -gcalconduit_dupe_configuration(GCalConduitCfg *c) { - GCalConduitCfg *retval; - g_return_val_if_fail(c!=NULL,NULL); - retval = g_new0(GCalConduitCfg,1); - retval->sync_type = c->sync_type; - retval->open_secret = c->open_secret; - retval->pilotId = c->pilotId; - return retval; -} - - static void -doTrySettings(GtkWidget *widget, GCalConduitCfg *c) +doTrySettings (GtkWidget *widget, ToDoConduitCfg *c) { - /* - readStateCfg (cfgStateWindow, curState); - if (activated) - gnome_pilot_conduit_config_enable (conduit_config, GnomePilotConduitSyncTypeCustom); - else - gnome_pilot_conduit_config_disable (conduit_config); - */ - - if (c->sync_type!=GnomePilotConduitSyncTypeCustom) + if (c->sync_type != GnomePilotConduitSyncTypeCustom) gnome_pilot_conduit_config_enable_with_first_sync (conduit_config, c->sync_type, c->sync_type, @@ -111,34 +67,28 @@ doTrySettings(GtkWidget *widget, GCalConduitCfg *c) else gnome_pilot_conduit_config_disable (conduit_config); - gcalconduit_save_configuration (c); + todoconduit_save_configuration (c); } - static void -doSaveSettings(GtkWidget *widget, GCalConduitCfg *GCalConduitCfg) +doRevertSettings (GtkWidget *widget, ToDoConduitCfg *c) { - doTrySettings(widget, GCalConduitCfg); - gcalconduit_save_configuration(GCalConduitCfg); + activated = org_activation_state; + *c = *origState; + setStateCfg (cfgStateWindow, c); + doTrySettings (widget, c); } - static void -doCancelSettings(GtkWidget *widget, GCalConduitCfg *c) +doSaveSettings (GtkWidget *widget, ToDoConduitCfg *c) { - doSaveSettings (widget, c); + *origState = *c; + doTrySettings (widget, c); } -static void -doRevertSettings(GtkWidget *widget, GCalConduitCfg *GCalConduitCfg) -{ - activated = org_activation_state; - setStateCfg (cfgStateWindow, curState); -} - static void -about_cb (GtkWidget *widget, gpointer data) +doHelp (GtkWidget *widget, gpointer data) { GtkWidget *about; const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL}; @@ -156,16 +106,6 @@ about_cb (GtkWidget *widget, gpointer data) /* called by the sync_type GtkOptionMenu */ static void -sync_action_selection(GtkMenuShell *widget, gpointer unused) -{ - if (!ignore_changes) { - capplet_widget_state_changed(CAPPLET_WIDGET (capplet), TRUE); - } -} - - -/* called by the sync_type GtkOptionMenu */ -static void activate_sync_type(GtkMenuItem *widget, gpointer data) { curState->sync_type = GPOINTER_TO_INT(data); @@ -206,10 +146,6 @@ static GtkWidget } gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu)); - gtk_signal_connect(GTK_OBJECT(menu), "selection-done", - GTK_SIGNAL_FUNC(sync_action_selection), - NULL); - gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0); return vbox; @@ -217,7 +153,7 @@ static GtkWidget static void -setStateCfg (GtkWidget *w, GCalConduitCfg *c) +setStateCfg (GtkWidget *w, ToDoConduitCfg *c) { GtkOptionMenu *optionMenu; GtkMenu *menu; @@ -234,18 +170,10 @@ setStateCfg (GtkWidget *w, GCalConduitCfg *c) } -#if 0 static void -readStateCfg (GtkWidget *w, GCalConduitCfg *c) +readStateCfg (GtkWidget *w, ToDoConduitCfg *c) { - /* - GtkWidget *button; - button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off"); - g_assert(button!=NULL); - activated = GTK_TOGGLE_BUTTON(button)->active; - */ } -#endif /* 0 */ static void @@ -271,10 +199,8 @@ pilot_capplet_setup(void) GTK_SIGNAL_FUNC(doRevertSettings), curState); gtk_signal_connect(GTK_OBJECT(capplet), "ok", GTK_SIGNAL_FUNC(doSaveSettings), curState); - gtk_signal_connect(GTK_OBJECT(capplet), "cancel", - GTK_SIGNAL_FUNC(doCancelSettings), curState); gtk_signal_connect(GTK_OBJECT(capplet), "help", - GTK_SIGNAL_FUNC(about_cb), NULL); + GTK_SIGNAL_FUNC(doHelp), NULL); setStateCfg (cfgStateWindow, curState); @@ -363,25 +289,29 @@ main (int argc, char *argv[]) if (!pilotId) return -1; - /* put all code to set things up in here */ - gcalconduit_load_configuration (&origState, pilotId); - + + /* Put all code to set things up in here */ conduit = gnome_pilot_conduit_management_new ("todo_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); - if (conduit == NULL) return -1; + if (conduit == NULL) + return -1; + + todoconduit_load_configuration (&origState, pilotId); conduit_config = gnome_pilot_conduit_config_new (conduit, pilotId); - org_activation_state = gnome_pilot_conduit_config_is_enabled (conduit_config, - &origState->sync_type); - activated = org_activation_state; + org_activation_state = activated = + gnome_pilot_conduit_config_is_enabled (conduit_config, + &origState->sync_type); - curState = gcalconduit_dupe_configuration(origState); + curState = todoconduit_dupe_configuration (origState); pilot_capplet_setup (); - - /* done setting up, now run main loop */ + /* Done setting up, now run main loop */ capplet_gtk_main(); - - gnome_pilot_conduit_management_destroy(conduit); + /* Clean up */ + gnome_pilot_conduit_management_destroy (conduit); + todoconduit_destroy_configuration (&origState); + todoconduit_destroy_configuration (&curState); + return 0; } diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 3ba9506854..2734f9cc79 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -9,7 +9,6 @@ #include <errno.h> #include <cal-client/cal-client.h> -// #include <cal-util/calobj.h> #include <cal-util/timeutil.h> #include <pi-source.h> #include <pi-socket.h> @@ -20,13 +19,12 @@ #include <pi-version.h> #include <gpilotd/gnome-pilot-conduit.h> #include <gpilotd/gnome-pilot-conduit-standard-abs.h> +#include <todo-conduit-config.h> #include <todo-conduit.h> #include <libical/src/libical/icaltypes.h> #include <bonobo.h> -//#include "GnomeCal.h" - GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); void local_record_from_icalobject (GCalLocalRecord *local, CalComponent *obj); @@ -35,7 +33,10 @@ void local_record_from_icalobject (GCalLocalRecord *local, CalComponent *obj); #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif -#define G_LOG_DOMAIN "todoconduit" +#define G_LOG_DOMAIN "todoconduit" + +#define GET_TODOCONFIG(c) ((ToDoConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"todoconduit_cfg")) + #define DEBUG_CALCONDUIT 1 /* #undef DEBUG_CALCONDUIT */ @@ -59,49 +60,6 @@ void local_record_from_icalobject (GCalLocalRecord *local, CalComponent *obj); return ret; \ } - - -/* debug spew DELETE ME */ -static char *print_ical (CalComponent *obj - /*iCalObject *obj*/) -{ - static char buff[ 4096 ]; - - int indefinite; - CalComponentDateTime dtend; - int priority; - struct icaltimetype *complete; - CalComponentText summary; - GSList *comments; - CalComponentText *first_comment = NULL; - - if (obj == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - indefinite = 0; /* FIX ME how do i get this */ - cal_component_get_dtend (obj, &dtend); - priority = 1; /* FIX ME how do i get this */ - cal_component_get_completed (obj, &complete); - - cal_component_get_summary (obj, &summary); - cal_component_get_comment_list (obj, &comments); - if (comments) - first_comment = (CalComponentText *) comments->data; - - sprintf (buff, "[%d %d-%d-%d %d %d-%d-%d '%s' '%s']", - indefinite, - dtend.value->year, dtend.value->month, dtend.value->day, - priority, - complete->year, complete->month, complete->day, - summary.value, /* description */ - first_comment ? first_comment->value : "" /* note */ - ); - return buff; -} - - /* debug spew DELETE ME */ static char *print_local (GCalLocalRecord *local) { @@ -123,7 +81,7 @@ static char *print_local (GCalLocalRecord *local) return buff; } - return print_ical (local->ical); + return cal_component_get_as_string (local->ical); } @@ -152,25 +110,10 @@ static char *print_remote (PilotRecord *remote) return buff; } - - - -/* Destroys any data allocated by gcalconduit_load_configuration - and deallocates the given configuration. */ -static void -gcalconduit_destroy_configuration(GCalConduitCfg **c) -{ - g_return_if_fail(c!=NULL); - g_return_if_fail(*c!=NULL); - g_free(*c); - *c = NULL; -} - - /* Given a GCalConduitContxt*, allocates the structure */ static void gcalconduit_new_context(GCalConduitContext **ctxt, - GCalConduitCfg *c) + ToDoConduitCfg *c) { *ctxt = g_new0(GCalConduitContext,1); g_assert(ctxt!=NULL); @@ -188,7 +131,7 @@ gcalconduit_destroy_context(GCalConduitContext **ctxt) g_return_if_fail(*ctxt!=NULL); /* if ((*ctxt)->cfg!=NULL) - gcalconduit_destroy_configuration(&((*ctxt)->cfg)); + todoconduit_destroy_configuration(&((*ctxt)->cfg)); */ g_free(*ctxt); *ctxt = NULL; @@ -256,13 +199,6 @@ start_calendar_server (GnomePilotConduitStandardAbs *conduit, } -#if 0 -/* Just a stub to link with */ -void calendar_notify (time_t time, CalendarAlarm *which, void *data); -void calendar_notify (time_t time, CalendarAlarm *which, void *data) { } -#endif /* 0 */ - - static GSList * get_calendar_objects(GnomePilotConduitStandardAbs *conduit, gboolean *status, @@ -276,7 +212,7 @@ get_calendar_objects(GnomePilotConduitStandardAbs *conduit, uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_TODO); - // LOG ("got %d todo entries from cal server\n", g_list_length (uids)); + LOG ("got %d todo entries from cal server\n", g_list_length (uids)); if (status != NULL) (*status) = TRUE; @@ -338,8 +274,7 @@ void local_record_from_icalobject(GCalLocalRecord *local, CalComponent *obj) { - //iCalPilotState pilot_status; - unsigned long int pilot_status; + unsigned long *pilot_status; g_return_if_fail(local!=NULL); g_return_if_fail(obj!=NULL); @@ -349,7 +284,7 @@ local_record_from_icalobject(GCalLocalRecord *local, cal_component_get_pilot_id (obj, &local->local.ID); cal_component_get_pilot_status (obj, &pilot_status); - switch (pilot_status) { + switch (*pilot_status) { case ICAL_PILOT_SYNC_NONE: local->local.attr = GnomePilotRecordNothing; break; @@ -360,7 +295,7 @@ local_record_from_icalobject(GCalLocalRecord *local, local->local.attr = GnomePilotRecordDeleted; break; default: - g_warning ("unhandled pilot status: %ld\n", pilot_status); + g_warning ("unhandled pilot status: %lu\n", pilot_status); } /* Records without a pilot_id are new */ @@ -390,7 +325,6 @@ find_record_in_repository(GnomePilotConduitStandardAbs *conduit, char *uid = NULL; GCalLocalRecord *loc; CalClientGetStatus status; - //iCalObject *obj; CalComponent *obj; g_return_val_if_fail(conduit!=NULL,NULL); @@ -399,14 +333,14 @@ find_record_in_repository(GnomePilotConduitStandardAbs *conduit, LOG ("find_record_in_repository: remote=%s... ", print_remote (remote)); - // LOG ("requesting %ld", remote->ID); + LOG ("requesting %ld", remote->ID); status = cal_client_get_uid_by_pilot_id (ctxt->client, remote->ID, &uid); if (status == CAL_CLIENT_GET_SUCCESS) { status = cal_client_get_object (ctxt->client, uid, &obj); if (status == CAL_CLIENT_GET_SUCCESS) { - LOG ("found %s\n", print_ical (obj)); + LOG ("found %s\n", cal_component_get_as_string (obj)); loc = g_new0(GCalLocalRecord,1); /* memory allocated in new_from_string is freed in free_match */ local_record_from_icalobject (loc, obj); @@ -434,12 +368,11 @@ update_calendar_entry_in_repository(GnomePilotConduitStandardAbs *conduit, g_return_if_fail (obj!=NULL); LOG (" update_calendar_entry_in_repository " - "saving %s to desktop\n", - print_ical (obj)); + "saving %s to desktop\n", cal_component_get_as_string (obj)); success = cal_client_update_object (ctxt->client, obj); - if (! success) { + if (!success) { WARN (_("Error while communicating with calendar server")); } } @@ -464,7 +397,7 @@ ical_from_remote_record (GnomePilotConduitStandardAbs *conduit, LOG (" ical_from_remote_record: " "merging remote %s into local %s\n", - print_remote (remote), print_ical (in_obj)); + print_remote (remote), cal_component_get_as_string (in_obj)); if (in_obj == NULL) { obj = cal_component_new (); @@ -481,16 +414,10 @@ ical_from_remote_record (GnomePilotConduitStandardAbs *conduit, g_slist_free (comment_list); cal_component_set_new_vtype (obj, CAL_COMPONENT_TODO); - // obj->new = TRUE; - // obj->created = now; cal_component_set_created (obj, &now); - // obj->last_mod = now; cal_component_set_last_modified (obj, &now); /* obj->priority = 0; */ - // obj->transp = 0; - cal_component_set_transparency (obj, - /*CalComponentTransparency transp*/ - CAL_COMPONENT_TRANSP_NONE); + cal_component_set_transparency (obj, CAL_COMPONENT_TRANSP_NONE); /* obj->related = NULL; */ // cal_component_set_pilot_status (obj, ICAL_PILOT_SYNC_NONE); @@ -568,7 +495,6 @@ update_record (GnomePilotConduitStandardAbs *conduit, PilotRecord *remote, GCalConduitContext *ctxt) { - //iCalObject *obj; CalComponent *obj; struct ToDo todo; CalClientGetStatus status; @@ -599,7 +525,8 @@ update_record (GnomePilotConduitStandardAbs *conduit, LOG ("failed, making a new one.\n"); obj = cal_component_new (); - + cal_component_set_new_vtype (obj, CAL_COMPONENT_TODO); + summary.value = todo.description; cal_component_set_summary (obj, &summary); @@ -608,27 +535,17 @@ update_record (GnomePilotConduitStandardAbs *conduit, cal_component_set_comment_list (obj, comment_list); g_slist_free (comment_list); - // obj->type = ICAL_TODO; - cal_component_set_new_vtype (obj, CAL_COMPONENT_TODO); - // obj->new = TRUE; - // obj->created = now; cal_component_set_created (obj, &now); - // obj->last_mod = now; cal_component_set_last_modified (obj, &now); // obj->priority = 0; - // obj->transp = 0; - cal_component_set_transparency (obj, - /*CalComponentTransparency transp*/ - CAL_COMPONENT_TRANSP_NONE); + cal_component_set_transparency (obj, CAL_COMPONENT_TRANSP_NONE); // obj->related = NULL; - //obj->pilot_id = remote->ID; - //obj->pilot_status = ICAL_PILOT_SYNC_NONE; - cal_component_set_pilot_id (obj, remote->ID); - cal_component_set_pilot_status (obj, ICAL_PILOT_SYNC_NONE); + cal_component_set_pilot_id (obj, &remote->ID); +// cal_component_set_pilot_status (obj, ICAL_PILOT_SYNC_NONE); } else { CalComponent *new_obj; - LOG ("succeeded %s\n", print_ical (obj)); + LOG ("succeeded %s\n", cal_component_get_as_string (obj)); new_obj = ical_from_remote_record (conduit, remote, obj); obj = new_obj; @@ -637,20 +554,20 @@ update_record (GnomePilotConduitStandardAbs *conduit, /* update record on server */ { const char *uid; - unsigned long pilot_id; + unsigned long *pilot_id; cal_component_get_uid (obj, &uid); cal_component_get_pilot_id (obj, &pilot_id); update_calendar_entry_in_repository (conduit, obj, ctxt); - cal_client_update_pilot_id (ctxt->client, (char *) uid, pilot_id, - ICAL_PILOT_SYNC_NONE); + cal_client_update_pilot_id (ctxt->client, (char *) uid, + *pilot_id, ICAL_PILOT_SYNC_NONE); } /* * Shutdown */ - //ical_object_unref (obj); + gtk_object_unref (GTK_OBJECT (obj)); free_ToDo(&todo); return 0; @@ -1055,7 +972,7 @@ set_pilot_id (GnomePilotConduitStandardAbs *conduit, GCalConduitContext *ctxt) { const char *uid; - unsigned long int pilot_status; + unsigned long *pilot_status; LOG ("set_pilot_id: %s pilot ID is now '%d'\n", print_local (local), ID); @@ -1064,7 +981,7 @@ set_pilot_id (GnomePilotConduitStandardAbs *conduit, g_assert(local->ical!=NULL); local->local.ID = ID; - cal_component_set_pilot_id (local->ical, ID); + cal_component_set_pilot_id (local->ical, &ID); cal_component_get_uid (local->ical, &uid); cal_component_get_pilot_status (local->ical, &pilot_status); @@ -1072,7 +989,7 @@ set_pilot_id (GnomePilotConduitStandardAbs *conduit, cal_client_update_pilot_id (ctxt->client, (char *) uid, local->local.ID, - pilot_status); + *pilot_status); return 0; } @@ -1261,7 +1178,7 @@ delete_all (GnomePilotConduitStandardAbs *conduit, } g_slist_free (events); - return -1; + return 0; } @@ -1279,7 +1196,7 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32 pilotId) { GtkObject *retval; - GCalConduitCfg *cfg; + ToDoConduitCfg *cfg; GCalConduitContext *ctxt; LOG ("in todo's conduit_get_gpilot_conduit\n"); @@ -1304,7 +1221,7 @@ conduit_get_gpilot_conduit (guint32 pilotId) g_assert (retval != NULL); gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"ToDoConduit"); - gcalconduit_load_configuration(&cfg,pilotId); + todoconduit_load_configuration(&cfg,pilotId); gtk_object_set_data(retval,"todoconduit_cfg",cfg); gcalconduit_new_context(&ctxt,cfg); @@ -1335,10 +1252,10 @@ conduit_get_gpilot_conduit (guint32 pilotId) void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) { - GCalConduitCfg *cc; + ToDoConduitCfg *cc; GCalConduitContext *ctxt; - cc = GET_GCALCONFIG(conduit); + cc = GET_TODOCONFIG (conduit); ctxt = GET_GCALCONTEXT(conduit); if (ctxt->client != NULL) { @@ -1347,7 +1264,7 @@ conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) //GNOME_Calendar_Repository_done (ctxt->calendar, &(ctxt->ev)); } - gcalconduit_destroy_configuration (&cc); + todoconduit_destroy_configuration (&cc); gcalconduit_destroy_context (&ctxt); diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h index 31970ce356..89cc60e920 100644 --- a/calendar/conduits/todo/todo-conduit.h +++ b/calendar/conduits/todo/todo-conduit.h @@ -25,8 +25,8 @@ struct _GCalLocalRecord { structure cannot be used by gnome-pilot-conduit-standard-abs. */ LocalRecord local; - /* The corresponding iCal object, as found by GnomeCal. */ - //iCalObject *ical; + + /* The corresponding Comp object, as found by GnomeCal. */ CalComponent *ical; /* pilot-link todo structure, used for implementing Transmit. */ @@ -47,7 +47,7 @@ struct _GCalConduitCfg { typedef struct _GCalConduitContext GCalConduitContext; struct _GCalConduitContext { struct ToDoAppInfo ai; - GCalConduitCfg *cfg; + ToDoConduitCfg *cfg; CalClient *client; CORBA_Environment ev; CORBA_ORB orb; @@ -58,28 +58,6 @@ struct _GCalConduitContext { }; #define GET_GCALCONTEXT(c) ((GCalConduitContext*)gtk_object_get_data(GTK_OBJECT(c),"todoconduit_context")) - -/* Given a GCalConduitCfg*, allocates the structure and - loads the configuration data for the given pilot. - this is defined in the header file because it is used by - both todo-conduit and todo-conduit-control-applet, - and we don't want to export any symbols we don't have to. */ -static void -gcalconduit_load_configuration(GCalConduitCfg **c, - guint32 pilotId) -{ - gchar prefix[256]; - g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",pilotId); - - *c = g_new0(GCalConduitCfg,1); - g_assert(*c != NULL); - gnome_config_push_prefix(prefix); - (*c)->open_secret = gnome_config_get_bool("open_secret=FALSE"); - (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */ - gnome_config_pop_prefix(); - - (*c)->pilotId = pilotId; -} +#endif __TODO_CONDUIT_H__ -#endif __TODO_CONDUIT_H__ |