From 085e18d4372f2f04e346000c3d33b82c9d7292a0 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 13 Jul 2000 21:35:57 +0000 Subject: conduit based on the calendar conduit. this conduit syncs a pilot's ToDoDB * conduits/todo/todo-conduit.c: conduit based on the calendar conduit. this conduit syncs a pilot's ToDoDB database to wombat's list of "todo" events. * gui/gncal-todo.c (simple_todo_editor): set todo's priority control based on value from ical object during edit. svn path=/trunk/; revision=4156 --- calendar/conduits/todo/todo-conduit.h | 101 +++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 38 deletions(-) (limited to 'calendar/conduits/todo/todo-conduit.h') diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h index 083064d3c1..05b9c00d18 100644 --- a/calendar/conduits/todo/todo-conduit.h +++ b/calendar/conduits/todo/todo-conduit.h @@ -1,5 +1,4 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* $Id$ */ #ifndef __TODO_CONDUIT_H__ #define __TODO_CONDUIT_H__ @@ -7,56 +6,82 @@ #include #include #include -#include #include +#include +#include +#include +#include +#include +#include + +#ifdef USING_OAF +#include +#else +#include +#endif + + +/* This is the local record structure for the GnomeCal conduit. */ +typedef struct _GCalLocalRecord GCalLocalRecord; +struct _GCalLocalRecord { + /* The stuff from gnome-pilot-conduit-standard-abs.h + Must be first in the structure, or instances of this + structure cannot be used by gnome-pilot-conduit-standard-abs. + */ + LocalRecord local; + /* The corresponding iCal object, as found by GnomeCal. */ + iCalObject *ical; + /* pilot-link todo structure, used for implementing Transmit. */ + struct ToDo *todo; +}; +#define GCAL_LOCALRECORD(s) ((GCalLocalRecord*)(s)) -typedef struct _ConduitCfg ConduitCfg; - -struct _ConduitCfg { +/* This is the configuration of the GnomeCal conduit. */ +typedef struct _GCalConduitCfg GCalConduitCfg; +struct _GCalConduitCfg { gboolean open_secret; guint32 pilotId; + GnomePilotConduitSyncType sync_type; /* only used by capplet */ }; +#define GET_GCALCONFIG(c) ((GCalConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"todoconduit_cfg")) -#define GET_CONFIG(c) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"conduit_cfg")) - -typedef struct _ConduitData ConduitData; - -struct _ConduitData { +/* This is the context for all the GnomeCal conduit methods. */ +typedef struct _GCalConduitContext GCalConduitContext; +struct _GCalConduitContext { struct ToDoAppInfo ai; + GCalConduitCfg *cfg; + CalClient *client; + CORBA_Environment ev; + CORBA_ORB orb; + gboolean calendar_load_tried; + gboolean calendar_load_success; + + char *calendar_file; }; - -#define GET_DATA(c) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(c),"conduit_data")) - -static void load_configuration(ConduitCfg **c,guint32 pilotId) { +#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/todod-conduit/Pilot_%u/",pilotId); - - *c = g_new0(ConduitCfg,1); + 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)->open_secret = gnome_config_get_bool("open_secret=FALSE"); + (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */ gnome_config_pop_prefix(); - + (*c)->pilotId = pilotId; } -static void save_configuration(ConduitCfg *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(); -} - -static void destroy_configuration(ConduitCfg **c) { - g_return_if_fail(c!=NULL); - g_return_if_fail(*c!=NULL); - g_free(*c); - *c = NULL; -} #endif __TODO_CONDUIT_H__ -- cgit v1.2.3