diff options
author | Eskil Heyn Olsen <eskil@src.gnome.org> | 1999-10-22 09:16:15 +0800 |
---|---|---|
committer | Eskil Heyn Olsen <eskil@src.gnome.org> | 1999-10-22 09:16:15 +0800 |
commit | 47f01927e15b6eb279d2cbf046b2707467096666 (patch) | |
tree | 9a61c996094c07640cad5f1d77b0956e4f361b48 /calendar/gui/calendar-conduit.h | |
parent | 0a505aa40e7504dec10119c0bb4c84087e3d06d4 (diff) | |
download | gsoc2013-evolution-47f01927e15b6eb279d2cbf046b2707467096666.tar.gz gsoc2013-evolution-47f01927e15b6eb279d2cbf046b2707467096666.tar.zst gsoc2013-evolution-47f01927e15b6eb279d2cbf046b2707467096666.zip |
now it doesn't build todo conduit anymore. Since the conduit is just a
* Makefile.am: now it doesn't build todo conduit
anymore. Since the conduit is just a skeleton, no need to
build and install it.
* calendar-conduit-control-applet.c: revamped for all the
changes in calendar-conduit.h. Also fixed the pilotId bug that
all conduit capplets had.
* calendar-conduit-control-applet.desktop: renamed to
GnomeCalendar.
* calendar-conduit.h: Fixed namespace pollution, appended GCal
to structures, gcalconduit to methods. Introduced the
GCalConduitContext.
* calendar-conduit.c: No more global variables, all is contained
in a GCalConduitContext variable, that all the signals are
passed as user data.
svn path=/trunk/; revision=1338
Diffstat (limited to 'calendar/gui/calendar-conduit.h')
-rw-r--r-- | calendar/gui/calendar-conduit.h | 132 |
1 files changed, 98 insertions, 34 deletions
diff --git a/calendar/gui/calendar-conduit.h b/calendar/gui/calendar-conduit.h index d8b320c1ce..cee7d3386e 100644 --- a/calendar/gui/calendar-conduit.h +++ b/calendar/gui/calendar-conduit.h @@ -17,55 +17,119 @@ #include <gpilotd/gnome-pilot-conduit.h> #include <gpilotd/gnome-pilot-conduit-standard-abs.h> -#define CALLOCALRECORD(s) ((CalLocalRecord*)(s)) -typedef struct _CalLocalRecord CalLocalRecord; - -struct _CalLocalRecord { - /* The stuff from gnome-pilot-conduit-standard-abs.h */ +/* 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 */ + /* The corresponding iCal object, as found by GnomeCal. */ iCalObject *ical; - /* pilot-link appointment structure, used for implementing Transmit */ + /* pilot-link appointment structure, used for implementing Transmit. */ struct Appointment *a; }; +#define GCAL_LOCALRECORD(s) ((GCalLocalRecord*)(s)) -typedef struct _ConduitCfg ConduitCfg; - -struct _ConduitCfg { - gboolean open_secret; - guint32 pilotId; +/* This is the configuration of the GnomeCal conduit. */ +typedef struct _GCalConduitCfg GCalConduitCfg; +struct _GCalConduitCfg { + gboolean open_secret; + guint32 pilotId; }; +#define GET_GCALCONFIG(c) ((GCalConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_cfg")) + +/* This is the context for all the GnomeCal conduit methods. */ +typedef struct _GCalConduitContext GCalConduitContext; +struct _GCalConduitContext { + struct AppointmentAppInfo ai; + GCalConduitCfg *cfg; + GNOME_Calendar_Repository calendar; + CORBA_Environment ev; + CORBA_ORB orb; +}; +#define GET_GCALCONTEXT(c) ((GCalConduitContext*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_context")) + +/* Given a GCalConduitCfg*, allocates the structure and + loads the configuration data for the given pilot. */ +static void +gcalconduit_load_configuration(GCalConduitCfg **c, + guint32 pilotId) +{ + gchar prefix[256]; + g_snprintf(prefix,255,"/gnome-pilot.d/calendard-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"); + gnome_config_pop_prefix(); + + (*c)->pilotId = pilotId; +} -#define GET_CONFIG(c) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"conduit_cfg")) +/* Saves the configuration data. */ +static void +gcalconduit_save_configuration(GCalConduitCfg *c) +{ + gchar prefix[256]; -static void load_configuration(ConduitCfg **c,guint32 pilotId) { - gchar prefix[256]; - g_snprintf(prefix,255,"/gnome-pilot.d/calendard-conduit/Pilot_%u/",pilotId); + g_snprintf(prefix,255,"/gnome-pilot.d/calendar-conduit/Pilot_%u/",c->pilotId); - *c = g_new0(ConduitCfg,1); - gnome_config_push_prefix(prefix); - (*c)->open_secret = gnome_config_get_bool("open secret=FALSE"); - gnome_config_pop_prefix(); + gnome_config_push_prefix(prefix); + gnome_config_set_bool("open_secret",c->open_secret); + gnome_config_pop_prefix(); - (*c)->pilotId = pilotId; + gnome_config_sync(); + gnome_config_drop_all(); } -static void save_configuration(ConduitCfg *c) { - gchar prefix[256]; - - g_snprintf(prefix,255,"/gnome-pilot.d/calendar-conduit/Pilot_%u/",c->pilotId); - - gnome_config_push_prefix(prefix); - gnome_config_set_bool("open secret",c->open_secret); - gnome_config_pop_prefix(); +/* 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->open_secret = c->open_secret; + retval->pilotId = c->pilotId; + return retval; +} - gnome_config_sync(); - gnome_config_drop_all(); +/* 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; } -static void destroy_configuration(ConduitCfg **c) { - g_free(*c); - *c = NULL; +/* Given a GCalConduitContxt*, allocates the structure */ +static void +gcalconduit_new_context(GCalConduitContext **ctxt, + GCalConduitCfg *c) +{ + *ctxt = g_new0(GCalConduitContext,1); + g_assert(ctxt!=NULL); + (*ctxt)->cfg = c; + CORBA_exception_init (&((*ctxt)->ev)); } +/* Destroys any data allocated by gcalconduit_new_context + and deallocates its data. */ +static void +gcalconduit_destroy_context(GCalConduitContext **ctxt) +{ + g_return_if_fail(ctxt!=NULL); + g_return_if_fail(*ctxt!=NULL); +/* + if ((*ctxt)->cfg!=NULL) + gcalconduit_destroy_configuration(&((*ctxt)->cfg)); +*/ + g_free(*ctxt); + *ctxt = NULL; +} #endif __CALENDAR_CONDUIT_H__ |