aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-03-06 08:10:24 +0800
committerSeth Alves <alves@src.gnome.org>2000-03-06 08:10:24 +0800
commit34eff34dd935025d733904b03b20c764637d688a (patch)
treee9fd8dde3aac89e40d54cc030c1d0ddd823b2d52 /calendar
parent70108e31eafba17f63a04375d7e4c51c7d1c35eb (diff)
downloadgsoc2013-evolution-34eff34dd935025d733904b03b20c764637d688a.tar.gz
gsoc2013-evolution-34eff34dd935025d733904b03b20c764637d688a.tar.zst
gsoc2013-evolution-34eff34dd935025d733904b03b20c764637d688a.zip
stubs for client side access to alarm structures. this will probably
* cal-client/cal-client-alarm.c: stubs for client side access to alarm structures. this will probably change, since i don't know what i'm doing. * cal-util/alarm-enums.h: enums for alarms needed by both the client and the server * remaining source files in calendar/... have been moved to calendar/gui. * gui/alarm.c: start to decouple the view from the model in the alarm editing code svn path=/trunk/; revision=2062
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/cal-client/Makefile.am2
-rw-r--r--calendar/cal-client/cal-client-alarm.c74
-rw-r--r--calendar/cal-client/cal-client-alarm.h23
-rw-r--r--calendar/cal-util/alarm-enums.h18
-rw-r--r--calendar/gui/Makefile.am28
-rw-r--r--calendar/gui/alarm-notify/alarm.c17
-rw-r--r--calendar/gui/alarm-notify/alarm.h23
-rw-r--r--calendar/gui/alarm.c17
-rw-r--r--calendar/gui/alarm.h23
-rw-r--r--calendar/gui/calendar.c2
-rw-r--r--calendar/gui/corba-cal-factory.c2
-rw-r--r--calendar/gui/corba-cal.c2
-rw-r--r--calendar/gui/eventedit.c90
-rw-r--r--calendar/gui/eventedit.h8
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--calendar/gui/main.c2
17 files changed, 269 insertions, 79 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a6a390842f..4ba2f26102 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,18 @@
+2000-03-05 Seth Alves <alves@hungry.com>
+
+ * cal-client/cal-client-alarm.c: stubs for client side
+ access to alarm structures. this will probably change,
+ since i don't know what i'm doing.
+
+ * cal-util/alarm-enums.h: enums for alarms needed by
+ both the client and the server
+
+ * remaining source files in calendar/... have been moved
+ to calendar/gui.
+
+ * gui/alarm.c: start to decouple the view from the model
+ in the alarm editing code
+
2000-03-03 Seth Alves <alves@hungry.com>
* cal-util/Makefile.am: new file -- things shared between
diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am
index 00b66147b7..d9667daba2 100644
--- a/calendar/cal-client/Makefile.am
+++ b/calendar/cal-client/Makefile.am
@@ -33,6 +33,8 @@ libcal_clientincludedir = $(includedir)/cal-client
libcal_client_la_SOURCES = \
$(CORBA_GENERATED) \
+ cal-client-alarm.c \
+ cal-client-alarm.h \
cal-client.c \
cal-listener.c \
cal-listener.h
diff --git a/calendar/cal-client/cal-client-alarm.c b/calendar/cal-client/cal-client-alarm.c
new file mode 100644
index 0000000000..b939775b3a
--- /dev/null
+++ b/calendar/cal-client/cal-client-alarm.c
@@ -0,0 +1,74 @@
+#include "cal-client-alarm.h"
+
+time_t cal_client_alarm_get_trigger (AlarmHandle alarm)
+{
+# warning FIX ME
+ /* return alarm->trigger */
+ return 0;
+}
+
+enum AlarmType cal_client_alarm_get_type (AlarmHandle alarm)
+{
+# warning FIX ME
+ /* return alarm->type */
+ return 0;
+}
+
+void cal_client_alarm_set_type (AlarmHandle alarm, enum AlarmType type)
+{
+# warning FIX ME
+ /* alarm->type = type */
+}
+
+enum AlarmUnit cal_client_alarm_get_units (AlarmHandle alarm)
+{
+# warning FIX ME
+ /* return alarm->units */
+ return 0;
+}
+
+void cal_client_alarm_set_units (AlarmHandle alarm, enum AlarmUnit units)
+{
+# warning FIX ME
+ /* alarm->units = units */
+}
+
+int cal_client_alarm_get_count (AlarmHandle alarm)
+{
+# warning FIX ME
+ /* return alarm->count */
+ return 0;
+}
+
+void cal_client_alarm_set_count (AlarmHandle alarm, int count)
+{
+# warning FIX ME
+ /* alarm->count = count */
+}
+
+int cal_client_alarm_get_enabled (AlarmHandle alarm)
+{
+# warning FIX ME
+ /* return alarm->enabled */
+ return 0;
+}
+
+void cal_client_alarm_set_enabled (AlarmHandle alarm, int enabled)
+{
+# warning FIX ME
+ /* alarm->enabled = enabled */
+}
+
+char *cal_client_alarm_get_data (AlarmHandle alarm)
+{
+# warning FIX ME
+ /* return alarm->data */
+ return "";
+}
+
+void cal_client_alarm_set_data (AlarmHandle alarm, char *data)
+{
+# warning FIX ME
+ /* alarm->data = strdup (data) */
+}
+
diff --git a/calendar/cal-client/cal-client-alarm.h b/calendar/cal-client/cal-client-alarm.h
new file mode 100644
index 0000000000..83e50c6775
--- /dev/null
+++ b/calendar/cal-client/cal-client-alarm.h
@@ -0,0 +1,23 @@
+#ifndef CAL_CLIENT_ALARM_H_INCLUDED
+#define CAL_CLIENT_ALARM_H_INCLUDED
+
+#include <sys/time.h>
+#include "cal-util/alarm-enums.h"
+
+typedef int AlarmHandle;
+
+/* these need to be replaced with something that does corba stuff */
+
+time_t cal_client_alarm_get_trigger (AlarmHandle alarm);
+enum AlarmType cal_client_alarm_get_type (AlarmHandle alarm);
+void cal_client_alarm_set_type (AlarmHandle alarm, enum AlarmType type);
+enum AlarmUnit cal_client_alarm_get_units (AlarmHandle alarm);
+void cal_client_alarm_set_units (AlarmHandle alarm, enum AlarmUnit units);
+int cal_client_alarm_get_count (AlarmHandle alarm);
+void cal_client_alarm_set_count (AlarmHandle alarm, int count);
+int cal_client_alarm_get_enabled (AlarmHandle alarm);
+void cal_client_alarm_set_enabled (AlarmHandle alarm, int enabled);
+char *cal_client_alarm_get_data (AlarmHandle alarm);
+void cal_client_alarm_set_data (AlarmHandle alarm, char *data);
+
+#endif /* CAL_CLIENT_ALARM_H_INCLUDED */
diff --git a/calendar/cal-util/alarm-enums.h b/calendar/cal-util/alarm-enums.h
new file mode 100644
index 0000000000..e35b471a09
--- /dev/null
+++ b/calendar/cal-util/alarm-enums.h
@@ -0,0 +1,18 @@
+#ifndef ALARM_ENUMS_H_INCLUDED
+#define ALARM_ENUMS_H_INCLUDED
+
+
+enum AlarmType {
+ ALARM_MAIL,
+ ALARM_PROGRAM,
+ ALARM_DISPLAY,
+ ALARM_AUDIO
+};
+
+enum AlarmUnit {
+ ALARM_MINUTES,
+ ALARM_HOURS,
+ ALARM_DAYS
+};
+
+#endif /* ALARM_ENUMS_H_INCLUDED */
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 40e1357a62..3847cb9238 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = doc idl cal-util pcs cal-client
+
idldir = $(datadir)/idl
idl_DATA = \
@@ -12,15 +12,16 @@ gnorba_DATA = \
help_base = $(datadir)/gnome/help/cal
+
+bin_PROGRAMS = gnomecal $(extra_pilot_bins)
+
if HAVE_GNOME_PILOT
extra_pilot_bins = \
calendar-conduit-control-applet \
calendar-pilot-sync
endif
-bin_PROGRAMS = gnomecal $(extra_pilot_bins)
-
-ICAL_LINK_FLAGS = ../libical/src/libical/libical.la
+ICAL_LINK_FLAGS = $(top_srcdir)/libical/src/libical/libical.la
INCLUDES = \
-I$(includedir) \
@@ -28,6 +29,7 @@ INCLUDES = \
$(GNOME_CONDUIT_INCLUDEDIR) \
$(PISOCK_INCLUDEDIR) \
-I$(top_srcdir) \
+ -I$(top_srcdir)/calendar \
-I$(top_srcdir)/libical/src/libical \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
@@ -41,10 +43,10 @@ GNOMECAL_CORBA_GENERATED = \
$(GNOMECAL_CORBA_GENERATED): GnomeCal.idl
$(ORBIT_IDL) $(idl_flags) $(srcdir)/GnomeCal.idl
-corba-cal.c \
-corba-cal.h \
-corba-cal-factory.c \
-corba-cal-factory.h: GnomeCal.h
+#corba-cal.c \
+#corba-cal.h \
+#corba-cal-factory.c \
+#corba-cal-factory.h: GnomeCal.h
gnomecal_SOURCES = \
GnomeCal-common.c \
@@ -52,7 +54,6 @@ gnomecal_SOURCES = \
GnomeCal.h \
alarm.c \
alarm.h \
- calendar-conduit.h \
eventedit.c \
eventedit.h \
corba-cal.c \
@@ -118,9 +119,10 @@ calendar_pilot_sync_SOURCES = \
LINK_FLAGS = \
$(BONOBO_VFS_GNOME_LIBS) \
$(INTLLIBS) \
- cal-util/libcalutil.la \
- ../libversit/libversit.la \
- $(ICAL_LINK_FLAGS)
+ $(top_srcdir)/calendar/cal-util/libcalutil.la \
+ $(top_srcdir)/libversit/libversit.la \
+ $(ICAL_LINK_FLAGS) \
+ $(top_srcdir)/calendar/cal-client/libcal-client.la
calendar_pilot_sync_LDADD = \
$(PISOCK_LIBDIR) $(PISOCK_LIBS) \
@@ -136,6 +138,7 @@ endif
libcalendar_conduit_la_SOURCES = \
GnomeCal-common.c \
GnomeCal-stubs.c \
+ calendar-conduit.h \
calendar-conduit.c \
calobj.c \
alarm.c \
@@ -234,3 +237,4 @@ Productivity_DATA = gncal.desktop
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(help_base)/C
$(mkinstalldirs) $(Conduitsdir)
+
diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c
index b720d7a4e5..826effcbf0 100644
--- a/calendar/gui/alarm-notify/alarm.c
+++ b/calendar/gui/alarm-notify/alarm.c
@@ -11,8 +11,8 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
-#include "pcs/calobj.h"
#include "alarm.h"
+#include "cal-util/alarm-enums.h"
/* The pipes used to notify about an alarm */
int alarm_pipes [2];
@@ -26,7 +26,7 @@ typedef struct {
time_t activation_time;
AlarmFunction fn;
void *closure;
- CalendarAlarm *alarm;
+ CalendarAlarmUI *alarm;
} AlarmRecord;
enum DebugAction {
@@ -36,7 +36,7 @@ enum DebugAction {
};
void debug_alarm (AlarmRecord* ar, enum DebugAction action);
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
+void calendar_notify (time_t time, CalendarAlarmUI *which, void *data);
extern int debug_alarms;
/*
@@ -125,11 +125,11 @@ alarm_compare_by_time (gconstpointer a, gconstpointer b)
* Returns TRUE if the alarm was scheduled.
*/
gboolean
-alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure)
+alarm_add (CalendarAlarmUI *alarm, AlarmFunction fn, void *closure)
{
time_t now = time (NULL);
AlarmRecord *ar;
- time_t alarm_time = alarm->trigger;
+ time_t alarm_time = cal_client_alarm_get_trigger (alarm->alarm_handle);
ar = g_new0 (AlarmRecord, 1);
ar->activation_time = alarm_time;
@@ -215,7 +215,7 @@ void
debug_alarm (AlarmRecord* ar, enum DebugAction action)
{
time_t now = time (NULL);
- iCalObject *ico = ar->closure;
+ /* iCalObject *ico = ar->closure; */
printf ("%s", ctime(&now));
switch (action) {
case ALARM_ADDED:
@@ -230,8 +230,8 @@ debug_alarm (AlarmRecord* ar, enum DebugAction action)
}
if (ar->fn!=&calendar_notify) return;
- printf ("--- Summary: %s\n", ico->summary);
- switch (ar->alarm->type) {
+ /* printf ("--- Summary: %s\n", ico->summary);*/
+ switch (cal_client_alarm_get_type (ar->alarm->alarm_handle)) {
case ALARM_MAIL:
printf ("--- Type: Mail\n");
break;
@@ -247,4 +247,3 @@ debug_alarm (AlarmRecord* ar, enum DebugAction action)
}
}
-
diff --git a/calendar/gui/alarm-notify/alarm.h b/calendar/gui/alarm-notify/alarm.h
index 6bb5c1afa5..7e16952240 100644
--- a/calendar/gui/alarm-notify/alarm.h
+++ b/calendar/gui/alarm-notify/alarm.h
@@ -2,12 +2,25 @@
#define ALARM_H
#include <time.h>
-#include "pcs/calobj.h"
+#include "cal-client/cal-client-alarm.h"
-typedef void (*AlarmFunction)(time_t time, CalendarAlarm *which, void *closuse);
+typedef struct {
+ /* Widgets */
+ void *w_count; /* A GtkEntry */
+ void *w_enabled; /* A GtkChecButton */
+ void *w_timesel; /* A GtkMenu */
+ void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
+ void *w_label;
-void alarm_init (void);
-gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure);
-int alarm_kill (void *closure);
+ AlarmHandle alarm_handle; /* something that hooks to the server */
+} CalendarAlarmUI;
+
+typedef void (*AlarmFunction) (time_t time,
+ CalendarAlarmUI *which,
+ void *closuse);
+
+void alarm_init (void);
+gboolean alarm_add (CalendarAlarmUI *alarm, AlarmFunction fn, void *closure);
+int alarm_kill (void *closure);
#endif
diff --git a/calendar/gui/alarm.c b/calendar/gui/alarm.c
index b720d7a4e5..826effcbf0 100644
--- a/calendar/gui/alarm.c
+++ b/calendar/gui/alarm.c
@@ -11,8 +11,8 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
-#include "pcs/calobj.h"
#include "alarm.h"
+#include "cal-util/alarm-enums.h"
/* The pipes used to notify about an alarm */
int alarm_pipes [2];
@@ -26,7 +26,7 @@ typedef struct {
time_t activation_time;
AlarmFunction fn;
void *closure;
- CalendarAlarm *alarm;
+ CalendarAlarmUI *alarm;
} AlarmRecord;
enum DebugAction {
@@ -36,7 +36,7 @@ enum DebugAction {
};
void debug_alarm (AlarmRecord* ar, enum DebugAction action);
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
+void calendar_notify (time_t time, CalendarAlarmUI *which, void *data);
extern int debug_alarms;
/*
@@ -125,11 +125,11 @@ alarm_compare_by_time (gconstpointer a, gconstpointer b)
* Returns TRUE if the alarm was scheduled.
*/
gboolean
-alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure)
+alarm_add (CalendarAlarmUI *alarm, AlarmFunction fn, void *closure)
{
time_t now = time (NULL);
AlarmRecord *ar;
- time_t alarm_time = alarm->trigger;
+ time_t alarm_time = cal_client_alarm_get_trigger (alarm->alarm_handle);
ar = g_new0 (AlarmRecord, 1);
ar->activation_time = alarm_time;
@@ -215,7 +215,7 @@ void
debug_alarm (AlarmRecord* ar, enum DebugAction action)
{
time_t now = time (NULL);
- iCalObject *ico = ar->closure;
+ /* iCalObject *ico = ar->closure; */
printf ("%s", ctime(&now));
switch (action) {
case ALARM_ADDED:
@@ -230,8 +230,8 @@ debug_alarm (AlarmRecord* ar, enum DebugAction action)
}
if (ar->fn!=&calendar_notify) return;
- printf ("--- Summary: %s\n", ico->summary);
- switch (ar->alarm->type) {
+ /* printf ("--- Summary: %s\n", ico->summary);*/
+ switch (cal_client_alarm_get_type (ar->alarm->alarm_handle)) {
case ALARM_MAIL:
printf ("--- Type: Mail\n");
break;
@@ -247,4 +247,3 @@ debug_alarm (AlarmRecord* ar, enum DebugAction action)
}
}
-
diff --git a/calendar/gui/alarm.h b/calendar/gui/alarm.h
index 6bb5c1afa5..7e16952240 100644
--- a/calendar/gui/alarm.h
+++ b/calendar/gui/alarm.h
@@ -2,12 +2,25 @@
#define ALARM_H
#include <time.h>
-#include "pcs/calobj.h"
+#include "cal-client/cal-client-alarm.h"
-typedef void (*AlarmFunction)(time_t time, CalendarAlarm *which, void *closuse);
+typedef struct {
+ /* Widgets */
+ void *w_count; /* A GtkEntry */
+ void *w_enabled; /* A GtkChecButton */
+ void *w_timesel; /* A GtkMenu */
+ void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
+ void *w_label;
-void alarm_init (void);
-gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure);
-int alarm_kill (void *closure);
+ AlarmHandle alarm_handle; /* something that hooks to the server */
+} CalendarAlarmUI;
+
+typedef void (*AlarmFunction) (time_t time,
+ CalendarAlarmUI *which,
+ void *closuse);
+
+void alarm_init (void);
+gboolean alarm_add (CalendarAlarmUI *alarm, AlarmFunction fn, void *closure);
+int alarm_kill (void *closure);
#endif
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index 776f38452d..2d0ea7bb87 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/calendar.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include "calendar.h"
-#include "alarm.h"
+/*#include "alarm.h"*/
#include "timeutil.h"
#include "libversit/vcc.h"
#include "icalendar.h"
diff --git a/calendar/gui/corba-cal-factory.c b/calendar/gui/corba-cal-factory.c
index a0630fda73..e53834165c 100644
--- a/calendar/gui/corba-cal-factory.c
+++ b/calendar/gui/corba-cal-factory.c
@@ -11,7 +11,7 @@
#include <sys/stat.h>
#include "gnome-cal.h"
#include "main.h"
-#include "alarm.h"
+/*#include "alarm.h"*/
#include "cal-util/timeutil.h"
#include "libversit/vcc.h"
#include <libgnorba/gnorba.h>
diff --git a/calendar/gui/corba-cal.c b/calendar/gui/corba-cal.c
index 759b989893..b024da5205 100644
--- a/calendar/gui/corba-cal.c
+++ b/calendar/gui/corba-cal.c
@@ -11,7 +11,7 @@
#include <sys/stat.h>
#include "calendar.h"
#include "gnome-cal.h"
-#include "alarm.h"
+/*#include "alarm.h"*/
#include "cal-util/timeutil.h"
#include "libversit/vcc.h"
#include <libgnorba/gnome-factory.h>
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index e65db4e3da..dca6178c17 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -11,7 +11,9 @@
#include "calendar.h"
#include "eventedit.h"
#include "main.h"
+#include "alarm.h"
#include "cal-util/timeutil.h"
+#include "cal-client/cal-client-alarm.h"
static void event_editor_class_init (EventEditorClass *class);
@@ -19,9 +21,9 @@ static void event_editor_init (EventEditor *ee);
static void event_editor_destroy (GtkObject *object);
GtkWidget* make_spin_button (int val, int low, int high);
-void ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type,
+void ee_create_ae (GtkTable *table, char *str, CalendarAlarmUI *alarm, enum AlarmType type,
int y, gboolean control_sens, GtkSignalFunc dirty_func);
-void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type);
+void ee_store_alarm (CalendarAlarmUI *alarm, enum AlarmType type);
/* Note: do not i18n these strings, they are part of the vCalendar protocol */
static char *class_names [] = { "PUBLIC", "PRIVATE", "CONFIDENTIAL" };
@@ -304,19 +306,25 @@ timesel_new (void)
* Set the sensitive state depending on whether the alarm enabled flag.
*/
static void
-ee_alarm_setting (CalendarAlarm *alarm, int sensitive)
+ee_alarm_setting (CalendarAlarmUI *alarm, int sensitive)
{
+ enum AlarmType type;
+
gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_count), sensitive);
gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_timesel), sensitive);
- if (alarm->type == ALARM_PROGRAM || alarm->type == ALARM_MAIL){
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_entry), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_label), sensitive);
+ type = cal_client_alarm_get_type (alarm->alarm_handle);
+
+ if (type == ALARM_PROGRAM || type == ALARM_MAIL){
+ gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_entry),
+ sensitive);
+ gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_label),
+ sensitive);
}
}
static void
-alarm_toggle (GtkToggleButton *toggle, CalendarAlarm *alarm)
+alarm_toggle (GtkToggleButton *toggle, CalendarAlarmUI *alarm)
{
ee_alarm_setting (alarm, toggle->active);
}
@@ -325,13 +333,13 @@ alarm_toggle (GtkToggleButton *toggle, CalendarAlarm *alarm)
#define FS (GTK_FILL | GTK_SHRINK)
void
-ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type, int y, gboolean control_sens, GtkSignalFunc dirty_func)
+ee_create_ae (GtkTable *table, char *str, CalendarAlarmUI *alarm, enum AlarmType type, int y, gboolean control_sens, GtkSignalFunc dirty_func)
{
GtkWidget *entry;
alarm->w_enabled = gtk_check_button_new_with_label (str);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled),
- alarm->enabled);
+ cal_client_alarm_get_enabled (alarm->alarm_handle));
if (control_sens)
gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
GTK_SIGNAL_FUNC (alarm_toggle), alarm);
@@ -340,7 +348,9 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t
GTK_SIGNAL_FUNC (dirty_func), NULL);
gtk_table_attach (table, alarm->w_enabled, 0, 1, y, y+1, FS, FS, 0, 0);
- alarm->w_count = make_spin_button (alarm->count, 0, 10000);
+ alarm->w_count =
+ make_spin_button (cal_client_alarm_get_count (alarm->alarm_handle),
+ 0, 10000);
if (dirty_func)
gtk_signal_connect (GTK_OBJECT (alarm->w_count), "changed",
GTK_SIGNAL_FUNC (dirty_func), NULL);
@@ -348,7 +358,8 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t
alarm->w_timesel = timesel_new ();
/* is there a "changed" signal which we can connect to? */
- gtk_option_menu_set_history (GTK_OPTION_MENU (alarm->w_timesel), alarm->units);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (alarm->w_timesel),
+ cal_client_alarm_get_units (alarm->alarm_handle));
gtk_table_attach (table, alarm->w_timesel, 2, 3, y, y+1, FS, FS, 0, 0);
switch (type){
@@ -358,7 +369,8 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t
gtk_table_attach (table, alarm->w_label, 3, 4, y, y+1, FS, FS, 0, 0);
alarm->w_entry = gtk_entry_new ();
gtk_table_attach (table, alarm->w_entry, 4, 5, y, y+1, FXS, FS, 0, 0);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_entry), alarm->data ? alarm->data : "");
+ gtk_entry_set_text (GTK_ENTRY (alarm->w_entry),
+ cal_client_alarm_get_data (alarm->alarm_handle));
if (dirty_func)
gtk_signal_connect (GTK_OBJECT (alarm->w_entry),
"changed",
@@ -372,7 +384,8 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t
gtk_table_attach (table, alarm->w_label, 3, 4, y, y+1, FS, FS, 0, 0);
alarm->w_entry = gnome_file_entry_new ("alarm-program", _("Select program to run at alarm time"));
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (alarm->w_entry));
- gtk_entry_set_text (GTK_ENTRY (entry), alarm->data ? alarm->data : "");
+ gtk_entry_set_text (GTK_ENTRY (entry),
+ cal_client_alarm_get_data (alarm->alarm_handle));
gtk_table_attach (table, alarm->w_entry, 4, 5, y, y+1, FXS, FS, 0, 0);
if (dirty_func)
gtk_signal_connect (GTK_OBJECT (entry),
@@ -386,7 +399,8 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t
}
if (control_sens)
- ee_alarm_setting (alarm, alarm->enabled);
+ ee_alarm_setting (alarm,
+ cal_client_alarm_get_enabled (alarm->alarm_handle));
else
ee_alarm_setting (alarm, TRUE);
}
@@ -407,10 +421,14 @@ ee_alarm_widgets (EventEditor *ee)
mailto = gtk_label_new (_("Mail to:"));
mailte = gtk_entry_new ();
- ee_create_ae (GTK_TABLE (table), _("Display"), &ee->ical->dalarm, ALARM_DISPLAY, 1, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Audio"), &ee->ical->aalarm, ALARM_AUDIO, 2, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Program"), &ee->ical->palarm, ALARM_PROGRAM, 3, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Mail"), &ee->ical->malarm, ALARM_MAIL, 4, TRUE, NULL);
+ ee_create_ae (GTK_TABLE (table), _("Display"),
+ &ee->dalarmui, ALARM_DISPLAY, 1, TRUE, NULL);
+ ee_create_ae (GTK_TABLE (table), _("Audio"),
+ &ee->aalarmui, ALARM_AUDIO, 2, TRUE, NULL);
+ ee_create_ae (GTK_TABLE (table), _("Program"),
+ &ee->palarmui, ALARM_PROGRAM, 3, TRUE, NULL);
+ ee_create_ae (GTK_TABLE (table), _("Mail"),
+ &ee->malarmui, ALARM_MAIL, 4, TRUE, NULL);
return l;
}
@@ -448,31 +466,36 @@ ee_classification_widgets (EventEditor *ee)
}
/*
- * Retrieves the information from the CalendarAlarm widgets and stores them
- * on the CalendarAlarm generic values
+ * Retrieves the information from the CalendarAlarmUI widgets and stores them
+ * on the CalendarAlarmUI generic values
*/
void
-ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type)
+ee_store_alarm (CalendarAlarmUI *alarm, enum AlarmType type)
{
GtkWidget *item;
GtkMenu *menu;
GList *child;
int idx;
-
+
+ /*
if (alarm->data){
g_free (alarm->data);
alarm->data = 0;
}
+ */
- alarm->enabled = GTK_TOGGLE_BUTTON (alarm->w_enabled)->active;
+ cal_client_alarm_set_enabled (alarm->alarm_handle,
+ GTK_TOGGLE_BUTTON (alarm->w_enabled)->active);
- if (!alarm->enabled)
+ if (! cal_client_alarm_get_enabled (alarm->alarm_handle))
return;
if (type == ALARM_PROGRAM)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (alarm->w_entry))));
+ cal_client_alarm_set_data (alarm->alarm_handle,
+ gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (alarm->w_entry))));
if (type == ALARM_MAIL)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (alarm->w_entry)));
+ cal_client_alarm_set_data (alarm->alarm_handle,
+ gtk_entry_get_text (GTK_ENTRY (alarm->w_entry)));
/* Find out the index */
menu = GTK_MENU (GTK_OPTION_MENU (alarm->w_timesel)->menu);
@@ -481,9 +504,10 @@ ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type)
for (idx = 0, child = GTK_MENU_SHELL (menu)->children; child->data != item; child = child->next)
idx++;
-
- alarm->units = idx;
- alarm->count = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (alarm->w_count));
+
+ cal_client_alarm_set_units (alarm->alarm_handle, idx);
+ cal_client_alarm_set_count (alarm->alarm_handle,
+ gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (alarm->w_count)));
}
static void
@@ -504,10 +528,10 @@ ee_store_general_values_to_ical (EventEditor *ee)
ical->summary = gtk_editable_get_chars (GTK_EDITABLE (ee->general_summary), 0, -1);
- ee_store_alarm (&ical->dalarm, ALARM_DISPLAY);
- ee_store_alarm (&ical->aalarm, ALARM_AUDIO);
- ee_store_alarm (&ical->palarm, ALARM_PROGRAM);
- ee_store_alarm (&ical->malarm, ALARM_MAIL);
+ ee_store_alarm (&ee->dalarmui, ALARM_DISPLAY);
+ ee_store_alarm (&ee->aalarmui, ALARM_AUDIO);
+ ee_store_alarm (&ee->palarmui, ALARM_PROGRAM);
+ ee_store_alarm (&ee->malarmui, ALARM_MAIL);
for (idx = 2; list; list = list->next) {
if (GTK_TOGGLE_BUTTON (list->data)->active)
diff --git a/calendar/gui/eventedit.h b/calendar/gui/eventedit.h
index 4d605892dd..9411d4ac7a 100644
--- a/calendar/gui/eventedit.h
+++ b/calendar/gui/eventedit.h
@@ -9,6 +9,7 @@
#define EVENT_EDITOR_H
#include "gnome-cal.h"
+#include "alarm.h"
#include <libgnomeui/gnome-dialog.h>
BEGIN_GNOME_DECLS
@@ -57,7 +58,12 @@ typedef struct {
GtkWidget *recur_ex_clist;
/* The associated ical object */
- iCalObject *ical;
+ iCalObject *ical; /* FIX ME -- get rid of this */
+
+ CalendarAlarmUI dalarmui;
+ CalendarAlarmUI aalarmui;
+ CalendarAlarmUI palarmui;
+ CalendarAlarmUI malarmui;
/* The calendar owner of this event */
GnomeCalendar *gnome_cal;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 8682099900..038a893192 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -10,7 +10,7 @@
#include <signal.h>
#include <sys/wait.h>
#include <fcntl.h>
-#include "alarm.h"
+/*#include "alarm.h"*/
#include "calendar.h"
#include "gnome-cal.h"
#include "gncal-day-panel.h"
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index c4db8701ad..ea30d1275c 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -17,7 +17,7 @@
#include <ctype.h>
#include <errno.h>
#include "calendar.h"
-#include "alarm.h"
+/*#include "alarm.h"*/
#include "eventedit.h"
#include "gnome-cal.h"
#include "main.h"