aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorEskil Olsen <deity@eskil.dk>1999-11-04 22:20:13 +0800
committerEskil Heyn Olsen <eskil@src.gnome.org>1999-11-04 22:20:13 +0800
commitee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1 (patch)
treeb86e053a84983e8604cdb5c7f34d440ad9a477f9 /calendar/gui
parenta6c4b535334a6da5c8d1622b11a0893d0c55abee (diff)
downloadgsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.tar
gsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.tar.gz
gsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.tar.bz2
gsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.tar.lz
gsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.tar.xz
gsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.tar.zst
gsoc2013-evolution-ee413a3fd2c6ee802b6af1286f1cf7a65f52c5f1.zip
Uses the PISOCK_LIBDIR, for people with odd install dirs for their
1999-11-04 Eskil Olsen <deity@eskil.dk> * Makefile.am: Uses the PISOCK_LIBDIR, for people with odd install dirs for their pilot-link. Also install a pretty icon for the calendar-conduit. * calendar-conduit-control-applet.c: Modfied the try/revert/ok/cancel scheme to be more intuitive, also uses a GtkOptionMenu for the possible sync methods. * calendar-conduit-control-applet.desktop: use the nice icon... * calendar-conduit.c: Ack, had to define debug_alarms and alarm_default, otherwise they are undefined. Is gncal code messy or is this considered a way of configuring the cal engine ? Implemented delete_all syncabs methods. * calendar-pilot-sync.c: also had to declare debug_alarms and alarm_defaults, just as ugly. svn path=/trunk/; revision=1367
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am16
-rw-r--r--calendar/gui/calendar-conduit-control-applet.c215
-rw-r--r--calendar/gui/calendar-conduit-control-applet.desktop1
-rw-r--r--calendar/gui/calendar-conduit.c44
-rw-r--r--calendar/gui/calendar-conduit.h1
-rw-r--r--calendar/gui/calendar-pilot-sync.c11
-rw-r--r--calendar/gui/gnome-calendar-conduit.pngbin0 -> 3000 bytes
7 files changed, 202 insertions, 86 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 4042368bff..f08b4df06a 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -114,7 +114,7 @@ LINK_FLAGS = \
../libversit/libversit.la
calendar_pilot_sync_LDADD = \
- $(PISOCK_LIBS) \
+ $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
$(LINK_FLAGS)
if HAVE_GNOME_PILOT
@@ -139,7 +139,7 @@ libcalendar_conduit_la_LDFLAGS = \
libcalendar_conduit_la_LIBADD = \
../libversit/libversit.la \
- $(PISOCK_LIBS) \
+ $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
$(GNOME_LIBDIR) \
$(GNOME_LIBS)
@@ -150,9 +150,8 @@ calendar_conduit_control_applet_LDADD = \
$(CAPPLET_LIBS) \
$(GNOME_LIBDIR) \
$(GNOME_CAPPLET_LIBS) \
- $(PISOCK_LIBS) \
+ $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
$(GNOMEUI_LIBS) \
- $(PISOCK_LIBS) \
$(GNOME_PILOT_LIBS) \
$(INTLLIBS)
@@ -180,9 +179,8 @@ calendar_conduit_control_applet_LDADD = \
# $(CAPPLET_LIBS) \
# $(GNOME_LIBDIR) \
# $(GNOME_CAPPLET_LIBS) \
-# $(PISOCK_LIBS) \
+# $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
# $(GNOMEUI_LIBS) \
-# $(PISOCK_LIBS) \
# $(GNOME_PILOT_LIBS) \
# $(INTLLIBS)
endif
@@ -205,7 +203,11 @@ EXTRA_DIST = \
bell.xpm \
recur.xpm \
$(idl_DATA) \
- $(gnorba_DATA)
+ $(gnorba_DATA) \
+ gnome-calendar-conduit.png
+
+appicondir = $(datadir)/pixmaps
+appicon_DATA = gnome-calendar-conduit.png
Productivitydir = $(datadir)/gnome/apps/Applications
diff --git a/calendar/gui/calendar-conduit-control-applet.c b/calendar/gui/calendar-conduit-control-applet.c
index 57f4a07cc8..fb1aeeadd9 100644
--- a/calendar/gui/calendar-conduit-control-applet.c
+++ b/calendar/gui/calendar-conduit-control-applet.c
@@ -32,42 +32,68 @@ GtkWidget *dialogWindow=NULL;
gboolean activated,org_activation_state;
GnomePilotConduitMgmt *conduit;
-static void doTrySettings(GtkWidget *widget, GCalConduitCfg *conduitCfg);
-static void doRevertSettings(GtkWidget *widget, GCalConduitCfg *conduitCfg);
-static void doSaveSettings(GtkWidget *widget, GCalConduitCfg *conduitCfg);
-
-static void readStateCfg(GtkWidget *w);
-static void setStateCfg(GtkWidget *w);
+static void doTrySettings(GtkWidget *widget, gpointer);
+static void doRevertSettings(GtkWidget *widget, gpointer);
+static void doSaveSettings(GtkWidget *widget, gpointer);
+static void readStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
+static void setStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
+void about_cb (GtkWidget *, gpointer);
GCalConduitCfg *origState = NULL;
GCalConduitCfg *curState = NULL;
gint pilotId;
CORBA_Environment ev;
+/* This array must be in the same order as enumerations
+ in GnomePilotConduitSyncType as they are used as index.
+ Custom type implies Disabled state.
+*/
+static gchar* sync_options[] ={ N_("Disabled"),
+ N_("Synchronize"),
+ N_("Copy From Pilot"),
+ N_("Copy To Pilot"),
+ N_("Merge From Pilot"),
+ N_("Merge To Pilot")};
+#define SYNC_OPTIONS_COUNT 6
+
+static void
+setSettings(GCalConduitCfg* conduitCfg)
+{
+ if(conduitCfg->sync_type!=GnomePilotConduitSyncTypeCustom)
+ gpilotd_conduit_mgmt_enable(conduit,pilotId,conduitCfg->sync_type);
+ else
+ gpilotd_conduit_mgmt_disable(conduit,pilotId);
+
+ gcalconduit_save_configuration(conduitCfg);
+}
+
static void
-doTrySettings(GtkWidget *widget, GCalConduitCfg *conduitCfg)
+doTrySettings(GtkWidget *widget, gpointer whatever)
{
- readStateCfg(cfgStateWindow);
- if(activated)
- gpilotd_conduit_mgmt_enable(conduit,pilotId,GnomePilotConduitSyncTypeSynchronize);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
+ readStateCfg(cfgStateWindow,curState);
+ setSettings(curState);
}
static void
-doSaveSettings(GtkWidget *widget, GCalConduitCfg *conduitCfg)
+doSaveSettings(GtkWidget *widget, gpointer whatever)
{
- doTrySettings(widget, conduitCfg);
- gcalconduit_save_configuration(conduitCfg);
+ doTrySettings(widget,whatever);
}
+static void
+doCancelSettings(GtkWidget *widget, gpointer whatever)
+{
+ setSettings(origState);
+}
static void
-doRevertSettings(GtkWidget *widget, GCalConduitCfg *conduitCfg)
+doRevertSettings(GtkWidget *widget, gpointer whatever)
{
- activated = org_activation_state;
- setStateCfg(cfgStateWindow);
+ gcalconduit_destroy_configuration(curState);
+ curState = gcalconduit_dupe_configuration(origState);
+ setStateCfg(cfgStateWindow,curState);
+ setSettings(curState);
}
static void
@@ -113,11 +139,11 @@ void about_cb (GtkWidget *widget, gpointer data) {
GtkWidget *about;
const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
- about = gnome_about_new(_("Gpilotd calendar conduit"), VERSION,
- _("(C) 1998 the Free Software Foundation"),
+ about = gnome_about_new(_("GnomeCalendar Conduit"), VERSION,
+ _("(C) 1998"),
authors,
_("Configuration utility for the calendar conduit.\n"),
- _("gnome-unknown.xpm"));
+ _("gnome-calendar-conduit.png"));
gtk_widget_show (about);
return;
@@ -128,40 +154,73 @@ static void toggled_cb(GtkWidget *widget, gpointer data) {
capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
}
-static GtkWidget
-*createStateCfgWindow(void)
+/* called by the sync_type GtkOptionMenu */
+static void
+sync_action_selection(GtkMenuShell *widget, gpointer unused)
{
- GtkWidget *vbox, *table;
- GtkWidget *entry, *label;
- GtkWidget *button;
-
- 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);
+ if (!ignore_changes) {
+ capplet_widget_state_changed(CAPPLET_WIDGET (capplet), TRUE);
+ }
+}
- label = gtk_label_new(_("Enabled"));
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1,2);
+/* called by the sync_type GtkOptionMenu */
+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);
+}
- 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);
+static GtkWidget
+*createStateCfgWindow(void)
+{
+ GtkWidget *vbox, *table;
+ GtkWidget *label, *button;
+ GtkWidget *optionMenu,*menuItem;
+ GtkMenu *menu;
+ gint i;
+
+ vbox = gtk_vbox_new(FALSE, GNOME_PAD);
+
+ table = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
+
+ label = gtk_label_new(_("Synchronize Action"));
+ gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD);
+
+ optionMenu=gtk_option_menu_new();
+ gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu);
+ menu = GTK_MENU(gtk_menu_new());
+
+ for (i=0; i<SYNC_OPTIONS_COUNT;i++) {
+ sync_options[i]=_(sync_options[i]);
+ menuItem = gtk_menu_item_new_with_label(sync_options[i]);
+ gtk_widget_show(menuItem);
+ gtk_signal_connect(GTK_OBJECT(menuItem),"activate",
+ GTK_SIGNAL_FUNC(activate_sync_type),
+ GINT_TO_POINTER(i));
+ gtk_menu_append(menu,menuItem);
+ }
- return vbox;
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu));
+ gtk_signal_connect(GTK_OBJECT(menu), "selection-done",
+ GTK_SIGNAL_FUNC(sync_action_selection),
+ NULL);
+
+ gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0);
+
+ return vbox;
}
static void
-setStateCfg(GtkWidget *cfg)
+setStateCfg(GtkWidget *w,GCalConduitCfg *cfg)
{
GtkWidget *button;
gchar num[40];
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
+/*
+ button = gtk_object_get_data(GTK_OBJECT(w), "conduit_on_off");
g_assert(button!=NULL);
@@ -169,15 +228,16 @@ setStateCfg(GtkWidget *cfg)
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)
+readStateCfg(GtkWidget *w,GCalConduitCfg *cfg)
{
GtkWidget *button;
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
+ button = gtk_object_get_data(GTK_OBJECT(w), "conduit_on_off");
g_assert(button!=NULL);
@@ -187,44 +247,47 @@ readStateCfg(GtkWidget *cfg)
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), curState);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
+ 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), "cancel",
+ GTK_SIGNAL_FUNC(doCancelSettings), NULL);
+ gtk_signal_connect(GTK_OBJECT(capplet), "help",
+ GTK_SIGNAL_FUNC(about_cb), NULL);
- setStateCfg(cfgStateWindow);
+ setStateCfg(cfgStateWindow,curState);
- 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() {
diff --git a/calendar/gui/calendar-conduit-control-applet.desktop b/calendar/gui/calendar-conduit-control-applet.desktop
index aaaa7bd2c8..43c429ef97 100644
--- a/calendar/gui/calendar-conduit-control-applet.desktop
+++ b/calendar/gui/calendar-conduit-control-applet.desktop
@@ -4,3 +4,4 @@ Comment=Configure the GnomeCal conduit
Exec=calendar-conduit-control-applet --cap-id=1
Terminal=0
Type=Application
+Icon=gnome-calendar-conduit.png
diff --git a/calendar/gui/calendar-conduit.c b/calendar/gui/calendar-conduit.c
index 400824186a..cd2c061023 100644
--- a/calendar/gui/calendar-conduit.c
+++ b/calendar/gui/calendar-conduit.c
@@ -30,6 +30,15 @@
#include "calendar-conduit.h"
+int debug_alarms = 0; /* needed to satisfy some other part of gncal */
+/* Default values for alarms */ /* needed to satisfy some other part of gncal */
+CalendarAlarm alarm_defaults[4] = {
+ { ALARM_MAIL, 0, 15, ALARM_MINUTES },
+ { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
+ { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
+ { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
+};
+
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj);
@@ -81,6 +90,7 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data)
static GList *
get_calendar_objects(GnomePilotConduitStandardAbs *conduit,
+ gboolean *status,
GCalConduitContext *ctxt)
{
GList *result;
@@ -96,21 +106,25 @@ get_calendar_objects(GnomePilotConduitStandardAbs *conduit,
INFO ("Object did not exist");
show_exception(&(ctxt->ev));
CORBA_exception_free(&(ctxt->ev));
+ if(status!=NULL) (*status) = FALSE;
return NULL;
} else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
WARN (_("Error while communicating with calendar server"));
show_exception(&(ctxt->ev));
CORBA_exception_free(&(ctxt->ev));
+ if(status!=NULL) (*status) = FALSE;
return NULL;
}
+ if(status!=NULL) (*status) = TRUE;
if(uids->_length>0) {
int i;
for(i=0;i<uids->_length;i++) {
result = g_list_prepend(result,g_strdup(uids->_buffer[i]));
}
- } else
+ } else {
INFO ("No entries found");
+ }
CORBA_free(uids);
@@ -705,7 +719,7 @@ iterate (GnomePilotConduitStandardAbs *conduit,
if(*local==NULL) {
LOG ("beginning iteration");
- events = get_calendar_objects(conduit,ctxt);
+ events = get_calendar_objects(conduit,NULL,ctxt);
hest = 0;
if(events!=NULL) {
@@ -938,8 +952,32 @@ static gint
delete_all (GnomePilotConduitStandardAbs *conduit,
GCalConduitContext *ctxt)
{
- LOG ("entering delete_all");
+ GList *events,*it;
+ gboolean error;
+ events = get_calendar_objects(conduit,&error,ctxt);
+
+ if (error == FALSE) return -1;
+ for (it=events;it;it = g_slist_next(it)) {
+ GNOME_Calendar_Repository_delete_object(ctxt->calendar,
+ it->data,
+ &(ctxt->ev));
+ if (ctxt->ev._major == CORBA_USER_EXCEPTION){
+ INFO ("Object did not exist");
+ 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));
+ /* destroy loop, free data */
+ for (it=events;it;it = g_slist_next(it)) g_free(it->data);
+ g_slist_free(events);
+ return -1;
+ }
+ g_free(it->data);
+ }
+ g_slist_free(events);
return -1;
}
diff --git a/calendar/gui/calendar-conduit.h b/calendar/gui/calendar-conduit.h
index cee7d3386e..2ebf453e7e 100644
--- a/calendar/gui/calendar-conduit.h
+++ b/calendar/gui/calendar-conduit.h
@@ -37,6 +37,7 @@ 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),"gcalconduit_cfg"))
diff --git a/calendar/gui/calendar-pilot-sync.c b/calendar/gui/calendar-pilot-sync.c
index f4bc821500..a98ff9b49b 100644
--- a/calendar/gui/calendar-pilot-sync.c
+++ b/calendar/gui/calendar-pilot-sync.c
@@ -37,9 +37,20 @@ struct pi_sockaddr addr;
/* The Pilot DB identifier for DateBook */
int db;
+/* If true, enable debug output for alarms */
+int debug_alarms = 0;
+
/* True if you want to dump the flags bits from the records */
int debug_attrs = 0;
+/* Default values for alarms */
+CalendarAlarm alarm_defaults[4] = {
+ { ALARM_MAIL, 0, 15, ALARM_MINUTES },
+ { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
+ { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
+ { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
+};
+
int only_desktop_to_pilot = 0;
int only_pilot_to_desktop = 0;
diff --git a/calendar/gui/gnome-calendar-conduit.png b/calendar/gui/gnome-calendar-conduit.png
new file mode 100644
index 0000000000..e867ba90b2
--- /dev/null
+++ b/calendar/gui/gnome-calendar-conduit.png
Binary files differ