aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog4
-rw-r--r--calendar/Makefile.am7
-rw-r--r--calendar/calcs.c8
-rw-r--r--calendar/calcs.h4
-rw-r--r--calendar/gncal.c34
-rw-r--r--calendar/gui/Makefile.am7
6 files changed, 46 insertions, 18 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 1855d0bb1a..b710acc42e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,7 @@
+1998-03-12 Craig Small <csmall@small.dropbear.id.au>
+
+ * Now linked (in some horrible way) to the gtkcalendar widget.
+
Sun Mar 8 16:38:10 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.am (INCLUDES): Added GNOME_INCLUDEDIR.
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index 62d9d348ac..9cac22c259 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -1,6 +1,7 @@
INCLUDES = \
-I$(includedir) \
- $(GNOME_INCLUDEDIR)
+ $(GNOME_INCLUDEDIR) \
+ -I../../gcalendar
bin_PROGRAMS = gncal
@@ -13,7 +14,9 @@ gncal_SOURCES = \
gncal_LDADD = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
- $(INTLLIBS)
+ $(INTLLIBS) \
+ ../../gcalendar/gtkcalendar.o \
+ ../../gcalendar/lib_date.o
EXTRA_DIST = \
gncal.desktop
diff --git a/calendar/calcs.c b/calendar/calcs.c
index 2797a31d6c..d6150f7b35 100644
--- a/calendar/calcs.c
+++ b/calendar/calcs.c
@@ -125,7 +125,7 @@ int month_atoi(const char *string)
{
int i;
for (i = MONTH_MIN; i <= MONTH_MAX; i++)
- if (strcasecmp(string, (char *)month_name(i)) == 0)
+ if (strcasecmp(string, (char *)get_month_name(i)) == 0)
return i;
return 0;
}
@@ -134,7 +134,7 @@ int day_atoi(const char *string)
{
int i;
for (i = DAY_MIN; i <= DAY_MAX; i++)
- if (strcasecmp(string, (char *)day_name(i)) == 0)
+ if (strcasecmp(string, (char *)get_day_name(i)) == 0)
return i;
return 0;
}
@@ -182,7 +182,7 @@ const char *short_day_name(const int day)
/*
* Returns the complete name of the day
*/
-const char *day_name(const int day)
+const char *get_day_name(const int day)
{
static const char *name[]={"invalid day", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
@@ -202,7 +202,7 @@ const char *short_month_name(const int month)
/*
* Returns the name of the month
*/
-const char *month_name(const int month)
+const char *get_month_name(const int month)
{
static const char *name[]={ "invalid month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
diff --git a/calendar/calcs.h b/calendar/calcs.h
index e5e6a09b23..f331bf7335 100644
--- a/calendar/calcs.h
+++ b/calendar/calcs.h
@@ -12,9 +12,9 @@ int day_atoi(const char *string);
const char *day_suffix(int day);
const char *short3_day_name(int day);
const char *short_day_name(int day);
-const char *day_name(int day);
+const char *get_day_name(int day);
const char *short_month_name(int month);
-const char *month_name(int month);
+const char *get_month_name(int month);
unsigned long int date2num(const int day, const int month, const int year);
int weekday_of_date(const int day, const int month, const int year);
diff --git a/calendar/gncal.c b/calendar/gncal.c
index 7518c9868b..dd645ce8c7 100644
--- a/calendar/gncal.c
+++ b/calendar/gncal.c
@@ -16,6 +16,7 @@
#include "gncal.h"
#include "calcs.h"
+#include "gtkcalendar.h"
static GtkMenuEntry menu_items[] =
{
@@ -34,6 +35,7 @@ GtkWidget *dailylist;
GtkWidget *calendar_days[DAY_ARRAY_MAX];
GtkWidget *calendar_buttons[DAY_ARRAY_MAX];
GtkWidget *app;
+GtkWidget *calendar;
#define ELEMENTS(x) (sizeof (x) / sizeof (x [0]))
@@ -111,6 +113,12 @@ void update_today_list(void)
/*
* updates the calendar that appears in the left collumn
*/
+void month_changed(GtkWidget *widget, gpointer data)
+{
+ curr_month = GTK_CALENDAR(widget)->month;
+ curr_year = GTK_CALENDAR(widget)->year;
+}
+
void update_calendar()
{
int tmpday;
@@ -119,6 +127,11 @@ void update_calendar()
int month_changed;
static int offset;
+ gtk_calendar_unmark_day(GTK_CALENDAR(calendar),old_day);
+ gtk_calendar_mark_day(GTK_CALENDAR(calendar), curr_day);
+ printf("Date changed (nothing happens much\n");
+/* gtk_calendar_select_day(GTK_CALENDAR(calendar), curr_day); */
+#ifdef 0
/* Only update the whole calendar if the year or month has changed */
tmpday=1;
month_changed = FALSE;
@@ -147,7 +160,7 @@ void update_calendar()
gtk_container_border_width(GTK_CONTAINER(calendar_buttons[i]), 0);
}
} /* for i */
-
+#endif /* 0 */
}
/*
@@ -159,13 +172,13 @@ void update_today(void)
char buf[50];
/* This needs to be fixed to get the right date order for the country*/
- if (curr_month != old_month) {
+/* if (curr_month != old_month) {
gtk_label_set(GTK_LABEL(month_label), month_name(curr_month));
}
if (curr_year != old_year) {
sprintf(buf, "%4d", curr_year);
gtk_label_set(GTK_LABEL(year_label), buf);
- }
+ }*/
update_today_list();
update_calendar();
}
@@ -345,7 +358,7 @@ void show_main_window()
date_hbox = gtk_hbox_new(FALSE, 1);
gtk_box_pack_start(GTK_BOX(left_vbox), date_hbox, FALSE, FALSE, 0);
gtk_widget_show(date_hbox);
-
+/*
prev_mth_but = gtk_button_new_with_label("<");
gtk_box_pack_start(GTK_BOX(date_hbox), prev_mth_but, FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(prev_mth_but), "clicked", GTK_SIGNAL_FUNC(prev_month_but_clicked), NULL);
@@ -373,9 +386,9 @@ void show_main_window()
gtk_box_pack_start(GTK_BOX(date_hbox), next_year_but, FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(next_year_but), "clicked", GTK_SIGNAL_FUNC(next_year_but_clicked), NULL);
gtk_widget_show(next_year_but);
-
+*/
/* Build up the calendar table */
- cal_table = gtk_table_new(7,7,TRUE);
+/* cal_table = gtk_table_new(7,7,TRUE);
gtk_box_pack_start(GTK_BOX(left_vbox), cal_table, FALSE, FALSE, 0);
gtk_widget_show(cal_table);
@@ -396,8 +409,13 @@ void show_main_window()
gtk_widget_show(calendar_days[i+j*7]);
}
}
-
-
+*/
+ calendar = gtk_calendar_new();
+ gtk_calendar_display_options(GTK_CALENDAR(calendar), GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING);
+ gtk_box_pack_start(GTK_BOX(left_vbox), calendar, FALSE, FALSE, 0);
+ gtk_signal_connect(GTK_OBJECT(calendar), "month_changed",
+ GTK_SIGNAL_FUNC(month_changed), NULL);
+ gtk_widget_show(calendar);
day_but_hbox = gtk_hbox_new(TRUE, 1);
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 62d9d348ac..9cac22c259 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -1,6 +1,7 @@
INCLUDES = \
-I$(includedir) \
- $(GNOME_INCLUDEDIR)
+ $(GNOME_INCLUDEDIR) \
+ -I../../gcalendar
bin_PROGRAMS = gncal
@@ -13,7 +14,9 @@ gncal_SOURCES = \
gncal_LDADD = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
- $(INTLLIBS)
+ $(INTLLIBS) \
+ ../../gcalendar/gtkcalendar.o \
+ ../../gcalendar/lib_date.o
EXTRA_DIST = \
gncal.desktop