aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-07-13 23:05:41 +0800
committerSeth Alves <alves@src.gnome.org>2000-07-13 23:05:41 +0800
commit9729426da1b166223d414cf37910a86fcba27d9f (patch)
tree37c7883b0d8130bfb8e917d89d5434eda8fdefd9 /calendar/conduits
parentba844049f7ea7b9017748c8e0b3297f348158375 (diff)
downloadgsoc2013-evolution-9729426da1b166223d414cf37910a86fcba27d9f.tar.gz
gsoc2013-evolution-9729426da1b166223d414cf37910a86fcba27d9f.tar.zst
gsoc2013-evolution-9729426da1b166223d414cf37910a86fcba27d9f.zip
small cleanups, quiet compiler
svn path=/trunk/; revision=4145
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit-control-applet.c49
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c78
-rw-r--r--calendar/conduits/calendar/calendar-conduit.h75
3 files changed, 93 insertions, 109 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit-control-applet.c b/calendar/conduits/calendar/calendar-conduit-control-applet.c
index 861dec82c3..3d202fe921 100644
--- a/calendar/conduits/calendar/calendar-conduit-control-applet.c
+++ b/calendar/conduits/calendar/calendar-conduit-control-applet.c
@@ -17,24 +17,6 @@
#include "calendar-conduit.h"
-/*
-typedef struct ConduitCfg {
- guint32 pilotId;
- pid_t child;
-} ConduitCfg;
-
-typedef struct db {
- char name[256];
- int flags;
- unsigned long creator;
- unsigned long type;
- int maxblock;
-} db;
-
-#define CONDUIT_CFG(s) ((ConduitCfg*)(s))
-*/
-
-
/* tell changes callbacks to ignore changes or not */
static gboolean ignore_changes=FALSE;
@@ -79,6 +61,37 @@ static gchar* sync_options[] ={ N_("Disabled"),
#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/calendar-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)
{
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 64190a4424..9177c61faf 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -58,7 +58,46 @@ void local_record_from_icalobject (GCalLocalRecord *local, iCalObject *obj);
}
-gboolean load_success = FALSE;
+
+
+/* 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)
+{
+ *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;
+}
static void
@@ -67,23 +106,23 @@ gnome_calendar_load_cb (GtkWidget *cal_client,
GCalConduitContext *ctxt)
{
CalClient *client = CAL_CLIENT (cal_client);
- static int tried = 0;
- printf ("entering gnome_calendar_load_cb, tried=%d\n", tried);
+ printf ("entering gnome_calendar_load_cb, tried=%d\n",
+ ctxt->calendar_load_tried);
if (status == CAL_CLIENT_LOAD_SUCCESS) {
- load_success = TRUE;
+ ctxt->calendar_load_success = TRUE;
printf (" success\n");
gtk_main_quit (); /* end the sub event loop */
} else {
- if (tried) {
+ if (ctxt->calendar_load_tried) {
printf ("load and create of calendar failed\n");
gtk_main_quit (); /* end the sub event loop */
return;
}
cal_client_create_calendar (client, ctxt->calendar_file);
- tried = 1;
+ ctxt->calendar_load_tried = 1;
}
}
@@ -108,29 +147,25 @@ start_calendar_server (GnomePilotConduitStandardAbs *conduit,
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);
-
/* run a sub event loop to turn cal-client's async load
notification into a synchronous call */
gtk_main ();
- return 0;
+ if (ctxt->calendar_load_success)
+ return 0;
+
+ return -1;
}
+#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)
-{
-}
+void calendar_notify (time_t time, CalendarAlarm *which, void *data) { }
+#endif /* 0 */
static GSList *
@@ -199,7 +234,6 @@ local_record_from_icalobject(GCalLocalRecord *local,
local->ical = obj;
local->local.ID = local->ical->pilot_id;
-
/*
LOG ("local->Id = %ld [%s], status = %d",
local->local.ID,obj->summary,local->ical->pilot_status);
@@ -228,6 +262,7 @@ local_record_from_icalobject(GCalLocalRecord *local,
local->local.archived = 0;
}
+
/*
* Given a PilotRecord, find the matching record in
* the calendar repository. If no match, return NULL
@@ -562,10 +597,11 @@ pre_sync (GnomePilotConduit *c,
GCalConduitContext *ctxt)
{
int l;
- gint num_records;
unsigned char *buf;
- //GList *uids;
GnomePilotConduitStandardAbs *conduit;
+ /* gint num_records; */
+ //GList *uids;
+
/*
g_log_set_always_fatal (G_LOG_LEVEL_ERROR |
@@ -578,7 +614,6 @@ pre_sync (GnomePilotConduit *c,
g_message ("GnomeCal Conduit v.%s",CONDUIT_VERSION);
- //ctxt->calendar = CORBA_OBJECT_NIL;
ctxt->client = NULL;
if (start_calendar_server (GNOME_PILOT_CONDUIT_STANDARD_ABS(c), ctxt) != 0) {
@@ -1342,7 +1377,6 @@ conduit_get_gpilot_conduit (guint32 pilotId)
GCalConduitCfg *cfg;
GCalConduitContext *ctxt;
-
retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465);
g_assert (retval != NULL);
gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"GnomeCalConduit");
diff --git a/calendar/conduits/calendar/calendar-conduit.h b/calendar/conduits/calendar/calendar-conduit.h
index ae10fc79a6..3eb8caaaa2 100644
--- a/calendar/conduits/calendar/calendar-conduit.h
+++ b/calendar/conduits/calendar/calendar-conduit.h
@@ -55,6 +55,8 @@ struct _GCalConduitContext {
CalClient *client;
CORBA_Environment ev;
CORBA_ORB orb;
+ gboolean calendar_load_tried;
+ gboolean calendar_load_success;
char *calendar_file;
};
@@ -62,7 +64,10 @@ struct _GCalConduitContext {
/* Given a GCalConduitCfg*, allocates the structure and
- loads the configuration data for the given pilot. */
+ loads the configuration data for the given pilot.
+ this is defined in the header file because it is used by
+ both calendar-conduit and calendar-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)
@@ -81,72 +86,4 @@ gcalconduit_load_configuration(GCalConduitCfg **c,
}
-/* Saves the configuration data. */
-static void
-gcalconduit_save_configuration(GCalConduitCfg *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();
-
- 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;
-}
-
-
-/* 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)
-{
- *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__