aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-07-13 07:34:10 +0800
committerSeth Alves <alves@src.gnome.org>2000-07-13 07:34:10 +0800
commitd75a6c0b382e49706c0b56f52bf1d711658c2686 (patch)
treefc1fa992640a5c972cdf7db0321260dd326e2c3c /calendar/conduits/todo
parentf9eb656383a6b45b838cc597681347a70d796ceb (diff)
downloadgsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.tar
gsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.tar.gz
gsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.tar.bz2
gsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.tar.lz
gsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.tar.xz
gsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.tar.zst
gsoc2013-evolution-d75a6c0b382e49706c0b56f52bf1d711658c2686.zip
todo conduit builds and plays nice but does nothing
svn path=/trunk/; revision=4130
Diffstat (limited to 'calendar/conduits/todo')
-rw-r--r--calendar/conduits/todo/.cvsignore8
-rw-r--r--calendar/conduits/todo/Makefile.am81
-rw-r--r--calendar/conduits/todo/todo-conduit-control-applet.c373
-rw-r--r--calendar/conduits/todo/todo-conduit.c80
-rw-r--r--calendar/conduits/todo/todo-conduit.h41
-rw-r--r--calendar/conduits/todo/todo.conduit.in8
6 files changed, 385 insertions, 206 deletions
diff --git a/calendar/conduits/todo/.cvsignore b/calendar/conduits/todo/.cvsignore
new file mode 100644
index 0000000000..2820c43c3b
--- /dev/null
+++ b/calendar/conduits/todo/.cvsignore
@@ -0,0 +1,8 @@
+Makefile.in
+Makefile
+.deps
+.libs
+*.lo
+*.la
+todo-conduit-control-applet
+todo.conduit
diff --git a/calendar/conduits/todo/Makefile.am b/calendar/conduits/todo/Makefile.am
new file mode 100644
index 0000000000..6801c6150d
--- /dev/null
+++ b/calendar/conduits/todo/Makefile.am
@@ -0,0 +1,81 @@
+#
+#
+#
+
+INCLUDES = \
+ -I$(top_srcdir)/calendar \
+ $(GNOME_PILOT_CFLAGS)
+
+file_conduitsdir=$(libdir)/gnome-pilot/conduits
+
+bin_PROGRAMS = todo-conduit-control-applet
+
+todo_conduit_control_applet_SOURCES = todo-conduit-control-applet.c
+
+todo_conduit_control_applet_LDADD = \
+ $(CAPPLET_LIBS) \
+ $(GNOME_LIBDIR) \
+ -lgpilotdcm \
+ -lgpilotd \
+ -lgpilotdconduit \
+ $(GNOME_CAPPLET_LIBS) \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(GNOME_XML_LIB) \
+ $(GNOMEUI_LIBS) \
+ $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
+ $(INTLLIBS)
+
+
+# $(top_builddir)/libgpilotdCM/libgpilotdcm.la \
+# $(top_builddir)/gpilotd/libgpilotd.la \
+# $(top_builddir)/gpilotd/libgpilotdconduit.la \
+
+
+# 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_LDFLAGS = \
+ -rpath $(libdir)
+
+libtodo_conduit_la_LIBADD = \
+ $(top_builddir)/calendar/cal-client/libcal-client-static.la \
+ $(top_builddir)/calendar/cal-util/libcal-util-static.la \
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/libical/src/libical/libical-static.la \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
+ $(GNOME_LIBDIR) \
+ $(GNOME_LIBS)
+
+ccenterdir = $(datadir)/control-center
+ccenterPalmPilotdir = $(ccenterdir)/Peripherals
+ccenterConduitsdir = $(ccenterPalmPilotdir)/Conduits
+ccenterConduits_DATA = todo-conduit-control-applet.desktop
+
+panelConduitsdir = $(datadir)/gnome/apps/Settings/Peripherals/Conduits
+panelConduits_DATA = $(ccenterConduits_DATA)
+
+Conduitdir = $(datadir)/gnome-pilot/conduits/
+Conduit_DATA = todo.conduit
+
+EXTRA_DIST = \
+ todo.conduit.in \
+ $(ccenterConduits_DATA)
+
+install-data-local:
+ $(mkinstalldirs) $(ccenterConduitsdir)
+ $(mkinstalldirs) $(Conduitdir)
diff --git a/calendar/conduits/todo/todo-conduit-control-applet.c b/calendar/conduits/todo/todo-conduit-control-applet.c
index 54a26715ef..c37f75144a 100644
--- a/calendar/conduits/todo/todo-conduit-control-applet.c
+++ b/calendar/conduits/todo/todo-conduit-control-applet.c
@@ -1,7 +1,4 @@
-/* Control applet ("capplet") for the gnome-pilot todo conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <pwd.h>
#include <sys/types.h>
@@ -11,9 +8,9 @@
#include <config.h>
#include <capplet-widget.h>
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.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"
@@ -29,7 +26,10 @@ GtkWidget *cfgStateWindow=NULL;
GtkWidget *dialogWindow=NULL;
gboolean activated,org_activation_state;
-GnomePilotConduitMgmt *conduit;
+GnomePilotConduitManagement *conduit;
+GnomePilotConduitConfig *conduit_config;
+ConduitCfg *origState = NULL;
+ConduitCfg *curState = NULL;
static void doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg);
static void doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
@@ -40,248 +40,281 @@ static void setStateCfg(GtkWidget *w);
gint pilotId;
CORBA_Environment ev;
+static GnomePilotClient *gpc;
-static void
-doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg)
+#if 0
+static void
+load_configuration(ConduitCfg **c,
+ guint32 pilotId)
{
- readStateCfg(cfgStateWindow);
- if(activated)
- gpilotd_conduit_mgmt_enable(conduit,pilotId,GnomePilotConduitSyncTypeSynchronize);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
+ g_assert(c!=NULL);
+ *c = g_new0(ConduitCfg,1);
+ (*c)->pilotId = pilotId;
}
+#endif /* 0 */
-static void
-doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
+
+#if 0
+static void
+save_configuration(ConduitCfg *c)
{
- doTrySettings(widget, conduitCfg);
- save_configuration(NULL);
+ g_return_if_fail(c!=NULL);
}
+#endif /* 0 */
-static void
-doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
+static ConduitCfg*
+dupe_configuration(ConduitCfg *c) {
+ ConduitCfg *retval;
+ g_return_val_if_fail(c!=NULL,NULL);
+ retval = g_new0(ConduitCfg,1);
+ retval->pilotId = c->pilotId;
+ return retval;
+}
+
+#if 0
+/** this method frees all data from the conduit config */
+static void
+destroy_configuration(ConduitCfg **c)
{
- activated = org_activation_state;
- setStateCfg(cfgStateWindow);
+ g_return_if_fail(c!=NULL);
+ g_return_if_fail(*c!=NULL);
+ g_free(*c);
+ *c = NULL;
}
+#endif /* 0 */
static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
+doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg)
{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
+ readStateCfg(cfgStateWindow);
+ if(activated)
+ gnome_pilot_conduit_config_enable(conduit_config,GnomePilotConduitSyncTypeCustom);
+ else
+ gnome_pilot_conduit_config_disable(conduit_config);
}
+
static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
+doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
+ doTrySettings(widget, conduitCfg);
+ save_configuration(conduitCfg);
}
+
static void
-clist_changed(GtkWidget *widget, gpointer data)
+doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
+ activated = org_activation_state;
+ setStateCfg(cfgStateWindow);
}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
+
+static void
+about_cb (GtkWidget *widget, gpointer data)
+{
+ GtkWidget *about;
+ const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
- about = gnome_about_new(_("Gpilotd todo conduit"), VERSION,
- _("(C) 1998 the Free Software Foundation"),
- authors,
- _("Configuration utility for the todo conduit.\n"),
- _("gnome-unknown.xpm"));
- gtk_widget_show (about);
+ about = gnome_about_new(_("Gpilotd todo conduit"), VERSION,
+ _("(C) 1998 the Free Software Foundation"),
+ authors,
+ _("Configuration utility for the todo conduit.\n"),
+ _("gnome-unknown.xpm"));
+ gtk_widget_show (about);
- return;
+ return;
}
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);
+ if(!ignore_changes) {
+ /* gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(widget)->active); */
+ capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
+ }
}
static GtkWidget
*createStateCfgWindow(void)
{
- GtkWidget *vbox, *table;
- GtkWidget *entry, *label;
- GtkWidget *button;
+ GtkWidget *vbox, *table;
+ GtkWidget *label;
+ GtkWidget *button;
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
+ vbox = gtk_vbox_new(FALSE, GNOME_PAD);
- table = gtk_table_new(2, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 4);
- gtk_table_set_col_spacings(GTK_TABLE(table), 10);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
+ table = gtk_table_new(2, 2, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 10);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
- label = gtk_label_new(_("Enabled"));
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1,2);
+ label = gtk_label_new(_("Enabled"));
+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1,2);
- button = gtk_check_button_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_on_off", button);
- gtk_signal_connect(GTK_OBJECT(button), "toggled",
- GTK_SIGNAL_FUNC(toggled_cb),
- NULL);
- gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 1,2);
+ button = gtk_check_button_new();
+ gtk_object_set_data(GTK_OBJECT(vbox), "conduit_on_off", button);
+ gtk_signal_connect(GTK_OBJECT(button), "toggled",
+ GTK_SIGNAL_FUNC(toggled_cb),
+ NULL);
+ gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 1,2);
- return vbox;
+ return vbox;
}
static void
setStateCfg(GtkWidget *cfg)
{
- GtkWidget *button;
- gchar num[40];
+ GtkWidget *button;
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
+ button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
- g_assert(button!=NULL);
+ g_assert(button!=NULL);
- 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;
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),activated);
+ /* gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(button)->active); */
+ ignore_changes = FALSE;
}
static void
readStateCfg(GtkWidget *cfg)
{
- GtkWidget *button;
+ GtkWidget *button;
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
+ button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
- g_assert(button!=NULL);
+ g_assert(button!=NULL);
- activated = GTK_TOGGLE_BUTTON(button)->active;
+ activated = GTK_TOGGLE_BUTTON(button)->active;
}
static void
pilot_capplet_setup(void)
{
- GtkWidget *frame, *table;
+ GtkWidget *frame, *table;
- capplet = capplet_widget_new();
+ capplet = capplet_widget_new();
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
+ table = gtk_table_new(1, 2, FALSE);
+ gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
+ gtk_container_add(GTK_CONTAINER(capplet), table);
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
+ frame = gtk_frame_new(_("Conduit state"));
+ gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
+ gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
+ cfgStateWindow = createStateCfgWindow();
+ gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
+ gtk_signal_connect(GTK_OBJECT(capplet), "try",
+ GTK_SIGNAL_FUNC(doTrySettings), curState);
+ gtk_signal_connect(GTK_OBJECT(capplet), "revert",
+ GTK_SIGNAL_FUNC(doRevertSettings), curState);
+ gtk_signal_connect(GTK_OBJECT(capplet), "ok",
+ GTK_SIGNAL_FUNC(doSaveSettings), curState);
+ gtk_signal_connect(GTK_OBJECT(capplet), "help",
+ GTK_SIGNAL_FUNC(about_cb), NULL);
- setStateCfg(cfgStateWindow);
+ setStateCfg(cfgStateWindow);
- gtk_widget_show_all(capplet);
+ gtk_widget_show_all(capplet);
}
-void run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
+static void
+run_error_dialog(gchar *mesg,...)
+{
+ char tmp[80];
+ va_list ap;
+
+ va_start(ap,mesg);
+ vsnprintf(tmp,79,mesg,ap);
+ dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
+ gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
+ va_end(ap);
}
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
+static gint
+get_pilot_id_from_gpilotd()
+{
+ GList *pilots=NULL;
+ gint pilot;
+ int i,err;
i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
+ /* we don't worry about leaking here, so pilots isn't freed */
+ switch(err = gnome_pilot_client_get_pilots(gpc,&pilots)) {
+ case GPILOTD_OK: {
+ if(pilots) {
+ for(i=0;i<g_list_length(pilots);i++) {
+ g_message("pilot %d = \"%s\"",i,(gchar*)g_list_nth(pilots,i)->data);
+ }
+ if(i==0) {
+ run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
+ return -1;
+ } else {
+ gnome_pilot_client_get_pilot_id_by_name(gpc,
+ pilots->data, /* this is the first pilot */
+ &pilot);
+ if(i>1) {
+ g_message("too many pilots...");
+ /* need a choose here */
+ }
+ return pilot;
+ }
+ } else {
run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
+ }
+ break;
+ }
+ case GPILOTD_ERR_NOT_CONNECTED:
+ run_error_dialog(_("Not connected to the gnome-pilot daemon"));
+ return -1;
+ break;
+ default:
+ g_warning("gnome_pilot_client_get_pilot_ids(...) = %d",err);
+ run_error_dialog(_("An error occured when trying to fetch\npilot list from the gnome-pilot daemon"));
return -1;
- }
+ break;
+ }
}
int
main( int argc, char *argv[] )
{
- /* we're a capplet */
- gnome_capplet_init ("todo conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("todo_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
- org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId);
+ /*
+ bindtextdomain (PACKAGE, GNOMELOCALEDIR);
+ textdomain (PACKAGE);
+ */
+
+ /* we're a capplet */
+ gnome_capplet_init ("todo conduit control applet", NULL, argc, argv,
+ NULL,
+ 0, NULL);
+
+
+ gpc = gnome_pilot_client_new();
+ gnome_pilot_client_connect_to_daemon(gpc);
+ pilotId = get_pilot_id_from_gpilotd();
+ if(!pilotId) return -1;
+
+ /* put all code to set things up in here */
+ load_configuration(&origState,pilotId);
+ curState = dupe_configuration(origState);
+
+ /* 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;
+ conduit_config = gnome_pilot_conduit_config_new(conduit,pilotId);
+ org_activation_state = activated = gnome_pilot_conduit_config_is_enabled(conduit_config,NULL);
- pilot_capplet_setup();
+ pilot_capplet_setup();
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
+ /* done setting up, now run main loop */
+ capplet_gtk_main();
+
+ gnome_pilot_conduit_management_destroy(conduit);
+
+ return 0;
}
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 3a543816af..6c76fc626d 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* $Id$ */
#include <glib.h>
@@ -21,35 +22,45 @@
#include "todo-conduit.h"
+
+GnomePilotConduit *conduit_get_gpilot_conduit (guint32 pilotId);
+void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit);
+
static gint
load_records(GnomePilotConduit *c)
{
- return 0;
+ return 0;
}
+
static gint
-pre_sync(GnomePilotConduit *c, GnomePilotDBInfo *dbi) {
- int l;
- unsigned char *buf;
+pre_sync(GnomePilotConduit *c, GnomePilotDBInfo *dbi)
+{
+ int l;
+ unsigned char *buf;
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
+ gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
- load_records(c);
+ load_records(c);
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- return -1;
- }
- unpack_ToDoAppInfo(&(GET_DATA(c)->ai),buf,l);
- g_free(buf);
+ buf = (unsigned char*)g_malloc(0xffff);
+ if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
+ return -1;
+ }
+ unpack_ToDoAppInfo(&(GET_DATA(c)->ai),buf,l);
+ g_free(buf);
- return 0;
+ return 0;
}
+
+#if 0
static gint
post_sync(GnomePilotConduit *c) {
- return 0;
+ return 0;
}
+#endif /* 0 */
+
static gint
match_record (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
@@ -60,6 +71,8 @@ match_record (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("in match_record\n");
return 0;
}
+
+
static gint
free_match (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord **local,
@@ -70,6 +83,8 @@ free_match (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
return 0;
}
+
+
static gint
archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -79,6 +94,8 @@ archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
return 1;
}
+
+
static gint
archive_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -88,6 +105,8 @@ archive_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering archive_remote\n");
return 1;
}
+
+
static gint
store_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
PilotRecord *remote,
@@ -97,6 +116,8 @@ store_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("Rec:%s:\nLength:%d\n", remote->record, remote->length);
return 1;
}
+
+
static gint
clear_status_archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -105,6 +126,8 @@ clear_status_archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard
g_print ("entering clear_status_archive_local\n");
return 1;
}
+
+
static gint
iterate (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord **local,
@@ -113,6 +136,8 @@ iterate (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering iterate\n");
return 1;
}
+
+
static gint
iterate_specific (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord **local,
@@ -123,6 +148,8 @@ iterate_specific (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering iterate_specific\n");
return 1;
}
+
+
static gint
purge (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
gpointer data)
@@ -130,6 +157,8 @@ purge (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering purge\n");
return 1;
}
+
+
static gint
set_status (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -139,6 +168,8 @@ set_status (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering set_status\n");
return 1;
}
+
+
static gint
set_archived (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -148,6 +179,8 @@ set_archived (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering set_archived\n");
return 1;
}
+
+
static gint
set_pilot_id (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -157,6 +190,8 @@ set_pilot_id (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering set_pilot_id\n");
return 1;
}
+
+
static gint
compare (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -166,6 +201,8 @@ compare (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering compare\n");
return 1;
}
+
+
static gint
compare_backup (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -175,6 +212,8 @@ compare_backup (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering compare_backup\n");
return 1;
}
+
+
static gint
free_transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -184,6 +223,8 @@ free_transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering free_transmit\n");
return 1;
}
+
+
static gint
delete_all (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
gpointer data)
@@ -191,6 +232,8 @@ delete_all (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
g_print ("entering delete_all\n");
return 1;
}
+
+
static PilotRecord *
transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
LocalRecord *local,
@@ -200,7 +243,8 @@ transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
return NULL;
}
-static GnomePilotConduit *
+
+GnomePilotConduit *
conduit_get_gpilot_conduit (guint32 pilotId)
{
GtkObject *retval;
@@ -238,13 +282,15 @@ conduit_get_gpilot_conduit (guint32 pilotId)
gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, NULL);
gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, NULL);
gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, NULL);
- gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, NULL);
+ /* gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, NULL); */
load_configuration(&cfg,pilotId);
return GNOME_PILOT_CONDUIT (retval);
}
-static void
+
+
+void
conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
{
ConduitCfg *cc;
diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h
index c224b2b1f3..083064d3c1 100644
--- a/calendar/conduits/todo/todo-conduit.h
+++ b/calendar/conduits/todo/todo-conduit.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* $Id$ */
#ifndef __TODO_CONDUIT_H__
@@ -12,8 +13,8 @@
typedef struct _ConduitCfg ConduitCfg;
struct _ConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
+ gboolean open_secret;
+ guint32 pilotId;
};
#define GET_CONFIG(c) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"conduit_cfg"))
@@ -21,39 +22,41 @@ struct _ConduitCfg {
typedef struct _ConduitData ConduitData;
struct _ConduitData {
- struct ToDoAppInfo ai;
+ struct ToDoAppInfo ai;
};
#define GET_DATA(c) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(c),"conduit_data"))
static void load_configuration(ConduitCfg **c,guint32 pilotId) {
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/todod-conduit/Pilot_%u/",pilotId);
+ gchar prefix[256];
+ g_snprintf(prefix,255,"/gnome-pilot.d/todod-conduit/Pilot_%u/",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();
+ *c = g_new0(ConduitCfg,1);
+ gnome_config_push_prefix(prefix);
+ (*c)->open_secret = gnome_config_get_bool("open secret=FALSE");
+ gnome_config_pop_prefix();
- (*c)->pilotId = pilotId;
+ (*c)->pilotId = pilotId;
}
static void save_configuration(ConduitCfg *c) {
- gchar prefix[256];
+ gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",c->pilotId);
+ 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_push_prefix(prefix);
+ gnome_config_set_bool("open secret",c->open_secret);
+ gnome_config_pop_prefix();
- gnome_config_sync();
- gnome_config_drop_all();
+ gnome_config_sync();
+ gnome_config_drop_all();
}
static void destroy_configuration(ConduitCfg **c) {
- g_free(*c);
- *c = NULL;
+ g_return_if_fail(c!=NULL);
+ g_return_if_fail(*c!=NULL);
+ g_free(*c);
+ *c = NULL;
}
#endif __TODO_CONDUIT_H__
diff --git a/calendar/conduits/todo/todo.conduit.in b/calendar/conduits/todo/todo.conduit.in
new file mode 100644
index 0000000000..b940c2b498
--- /dev/null
+++ b/calendar/conduits/todo/todo.conduit.in
@@ -0,0 +1,8 @@
+<gnome-pilot-conduit version="1.0">
+<conduit id="todo_conduit" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libtodo_conduit.so"/>
+<name value="todo"/>
+<conduit-attribute name="description" value="Synchronizes with Evolution"/>
+<conduit-attribute name="default-synctype" value="synchronize"/>
+<conduit-attribute name="icon" value="@prefix@/share/pixmaps/gnome-calendar-conduit.png"/>
+<conduit-attribute name="settings" value="TRUE"/>
+</gnome-pilot-conduit>