aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit-control-applet.c36
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c40
-rw-r--r--calendar/conduits/calendar/calendar-conduit.h2
3 files changed, 50 insertions, 28 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit-control-applet.c b/calendar/conduits/calendar/calendar-conduit-control-applet.c
index 0950772d2e..3c5b2d1b98 100644
--- a/calendar/conduits/calendar/calendar-conduit-control-applet.c
+++ b/calendar/conduits/calendar/calendar-conduit-control-applet.c
@@ -29,7 +29,6 @@ GtkWidget *cfgOptionsWindow=NULL;
GtkWidget *cfgStateWindow=NULL;
GtkWidget *dialogWindow=NULL;
-gboolean activated,org_activation_state;
GnomePilotConduitMgmt *conduit;
static void doTrySettings(GtkWidget *widget, gpointer);
@@ -90,7 +89,7 @@ doCancelSettings(GtkWidget *widget, gpointer whatever)
static void
doRevertSettings(GtkWidget *widget, gpointer whatever)
{
- gcalconduit_destroy_configuration(curState);
+ gcalconduit_destroy_configuration(&curState);
curState = gcalconduit_dupe_configuration(origState);
setStateCfg(cfgStateWindow,curState);
setSettings(curState);
@@ -150,7 +149,6 @@ void about_cb (GtkWidget *widget, gpointer data) {
}
static void toggled_cb(GtkWidget *widget, gpointer data) {
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(widget)->active);
capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
}
@@ -168,7 +166,6 @@ static void
activate_sync_type(GtkMenuItem *widget, gpointer data)
{
curState->sync_type = GPOINTER_TO_INT(data);
- gtk_widget_set_sensitive(cfgOptionsWindow,curState->sync_type!=GnomePilotConduitSyncTypeCustom);
if(!ignore_changes)
capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
}
@@ -177,7 +174,7 @@ static GtkWidget
*createStateCfgWindow(void)
{
GtkWidget *vbox, *table;
- GtkWidget *label, *button;
+ GtkWidget *label;
GtkWidget *optionMenu,*menuItem;
GtkMenu *menu;
gint i;
@@ -215,20 +212,21 @@ static GtkWidget
}
static void
-setStateCfg(GtkWidget *w,GCalConduitCfg *cfg)
+setStateCfg(GtkWidget *widget,GCalConduitCfg *cfg)
{
- GtkWidget *button;
- gchar num[40];
-/*
- button = gtk_object_get_data(GTK_OBJECT(w), "conduit_on_off");
-
- g_assert(button!=NULL);
+ GtkOptionMenu *optionMenu;
+ GtkMenu *menu;
+
+ optionMenu = gtk_object_get_data(GTK_OBJECT(widget), "conduit_state");
+ g_assert(optionMenu!=NULL);
+ menu = GTK_MENU(gtk_option_menu_get_menu(optionMenu));
- ignore_changes = TRUE;
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),activated);
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(button)->active);
- ignore_changes = FALSE;
-*/
+
+ ignore_changes = TRUE;
+ /* Here were are relying on the items in menu being the same
+ order as in GnomePilotConduitSyncType. */
+ gtk_option_menu_set_history(optionMenu,(int)cfg->sync_type);
+ ignore_changes = FALSE;
}
@@ -348,9 +346,9 @@ main( int argc, char *argv[] )
/* put all code to set things up in here */
gcalconduit_load_configuration(&origState,pilotId);
- curState = gcalconduit_dupe_configuration(origState);
+ gpilotd_conduit_mgmt_get_sync_type(conduit,pilotId,&origState->sync_type);
- org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId);
+ curState = gcalconduit_dupe_configuration(origState);
pilot_capplet_setup();
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 35a5db97ff..d7ec8083ae 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -43,14 +43,14 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj);
-#define CONDUIT_VERSION "0.8.6"
+#define CONDUIT_VERSION "0.8.9"
#ifdef G_LOG_DOMAIN
#undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "gcalconduit"
#define DEBUG_CALCONDUIT
-#undef DEBUG_CALCONDUIT
+#undef DEBUG_CALCONDUIT
#ifdef DEBUG_CALCONDUIT
#define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e))
@@ -577,6 +577,30 @@ update_record (GnomePilotConduitStandardAbs *conduit,
return 0;
}
+static void
+check_for_slow_setting(GnomePilotConduit *c,
+ GCalConduitContext *ctxt)
+{
+ CORBA_long entry_number;
+ entry_number =
+ GNOME_Calendar_Repository_get_number_of_objects(ctxt->calendar,
+ &(ctxt->ev));
+
+ if (ctxt->ev._major == CORBA_USER_EXCEPTION){
+ show_exception(&(ctxt->ev));
+ CORBA_exception_free(&(ctxt->ev));
+ } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
+ WARN (_("Error while communicating with calendar server"));
+ show_exception(&(ctxt->ev));
+ CORBA_exception_free(&(ctxt->ev));
+ } else {
+ LOG (_("Calendar holds %d entries"),entry_number);
+ /* If the local base is empty, do a slow sync */
+ if ( entry_number <= 0) {
+ gnome_pilot_conduit_standard_set_slow(c);
+ }
+ }
+}
static gint
pre_sync(GnomePilotConduit *c,
@@ -590,7 +614,7 @@ pre_sync(GnomePilotConduit *c,
ctxt->calendar = CORBA_OBJECT_NIL;
- if (start_calendar_server(GNOME_PILOT_CONDUIT_STANDARD_ABS(c),GET_GCALCONTEXT(c)) != 0) {
+ if (start_calendar_server(GNOME_PILOT_CONDUIT_STANDARD_ABS(c),ctxt) != 0) {
WARN(_("Could not start gnomecal server"));
return -1;
}
@@ -601,12 +625,14 @@ pre_sync(GnomePilotConduit *c,
buf = (unsigned char*)g_malloc(0xffff);
if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- WARN(_("Could not read pilot's Appoint application block"));
+ WARN(_("Could not read pilot's DateBook application block"));
return -1;
}
unpack_AppointmentAppInfo(&(ctxt->ai),buf,l);
g_free(buf);
+ check_for_slow_setting(c,ctxt);
+
return 0;
}
@@ -1360,9 +1386,7 @@ conduit_get_gpilot_conduit (guint32 pilotId)
gtk_object_set_data(retval,"gcalconduit_cfg",cfg);
gcalconduit_new_context(&ctxt,cfg);
- /* No real need to set it, since all signal are given this
- as their user data */
- gtk_object_set_data(retval,"gcalconduit_context",ctxt);
+ gtk_object_set_data(GTK_OBJECT(retval),"gcalconduit_context",ctxt);
gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, ctxt);
gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt);
@@ -1383,8 +1407,6 @@ conduit_get_gpilot_conduit (guint32 pilotId)
gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, ctxt);
gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
-
-
return GNOME_PILOT_CONDUIT (retval);
}
diff --git a/calendar/conduits/calendar/calendar-conduit.h b/calendar/conduits/calendar/calendar-conduit.h
index 2ebf453e7e..711609e96a 100644
--- a/calendar/conduits/calendar/calendar-conduit.h
+++ b/calendar/conduits/calendar/calendar-conduit.h
@@ -65,6 +65,7 @@ gcalconduit_load_configuration(GCalConduitCfg **c,
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;
@@ -92,6 +93,7 @@ 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;