aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/gncal-day-panel.c17
-rw-r--r--calendar/gui/gncal-day-view.c2
-rw-r--r--calendar/gui/gncal-full-day.c5
-rw-r--r--calendar/gui/gncal-week-view.c4
-rw-r--r--calendar/gui/gnome-cal.c53
-rw-r--r--calendar/gui/gnome-cal.h1
6 files changed, 74 insertions, 8 deletions
diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c
index 26347428a6..5a5a052f73 100644
--- a/calendar/gui/gncal-day-panel.c
+++ b/calendar/gui/gncal-day-panel.c
@@ -78,6 +78,12 @@ calendar_day_selected (GtkCalendar *calendar, GncalDayPanel *dpanel)
gnome_calendar_goto (dpanel->calendar, mktime (&tm));
}
+static void
+retag_calendar (GtkCalendar *calendar, GncalDayPanel *dpanel)
+{
+ gnome_calendar_tag_calendar (dpanel->calendar, GTK_CALENDAR (dpanel->gtk_calendar));
+}
+
GtkWidget *
gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
{
@@ -142,6 +148,8 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
dpanel->day_selected_id = gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), "day_selected",
(GtkSignalFunc) calendar_day_selected,
dpanel);
+ gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), "month_changed",
+ GTK_SIGNAL_FUNC (retag_calendar), dpanel);
gtk_table_attach (GTK_TABLE (dpanel), w,
1, 2, 1, 2,
GTK_FILL | GTK_SHRINK,
@@ -180,9 +188,10 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
static void
update (GncalDayPanel *dpanel, int update_fullday, iCalObject *ico, int flags)
{
- if (update_fullday)
+ if (update_fullday){
gncal_full_day_update (dpanel->fullday, ico, flags);
-
+ retag_calendar (dpanel->gtk_calendar, dpanel);
+ }
gncal_todo_update (dpanel->todo, ico, flags);
}
@@ -205,7 +214,9 @@ gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day)
g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
dpanel->start_of_day = time_start_of_day (start_of_day);
-
+ if (dpanel->fullday->lower == dpanel->start_of_day)
+ return;
+
strftime (buf, sizeof (buf), "%a %b %d %Y", localtime (&dpanel->start_of_day));
gtk_label_set (GTK_LABEL (dpanel->date_label), buf);
diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c
index f513d65b83..85d61292f1 100644
--- a/calendar/gui/gncal-day-view.c
+++ b/calendar/gui/gncal-day-view.c
@@ -6,7 +6,7 @@
* Miguel de Icaza <miguel@kernel.org>
*/
-#include <gtk/gtksignal.h>
+#include <gnome.h>
#include "gncal-day-view.h"
#include "timeutil.h"
#include "view-utils.h"
diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c
index 335cc2f17a..6b30d15a77 100644
--- a/calendar/gui/gncal-full-day.c
+++ b/calendar/gui/gncal-full-day.c
@@ -5,11 +5,12 @@
* Authors: Federico Mena <quartic@gimp.org>
* Miguel de Icaza <miguel@kernel.org>
*/
-
+#include <config.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtktext.h>
+#include <libgnomeui/gtkcalendar.h>
#include "eventedit.h"
#include "gncal-full-day.h"
#include "view-utils.h"
@@ -465,7 +466,7 @@ child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data)
text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
if (child->ico->summary && strcmp (text, child->ico->summary) == 0)
- return;
+ return FALSE;
if (child->ico->summary)
g_free (child->ico->summary);
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
index 2a389f5fe5..0e280163d9 100644
--- a/calendar/gui/gncal-week-view.c
+++ b/calendar/gui/gncal-week-view.c
@@ -6,6 +6,7 @@
* Miguel de Icaza <miguel@kernel.org>
*/
+#include <config.h>
#include <string.h>
#include "gncal-week-view.h"
#include "timeutil.h"
@@ -82,6 +83,7 @@ static void
sync_week (GtkCalendar *cal, GncalWeekView *wview)
{
jump_to_day (cal, wview, wview->start_of_week.tm_mday + 7);
+ gnome_calendar_tag_calendar (wview->calendar, wview->gtk_calendar);
}
static void
@@ -132,7 +134,7 @@ gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
wview->gtk_calendar = GTK_CALENDAR (gtk_calendar_new ());
gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "day_selected_double_click",
- GTK_SIGNAL_FUNC(jump_to_day), wview);
+ GTK_SIGNAL_FUNC(jump_to_day_click), wview);
gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "month_changed",
GTK_SIGNAL_FUNC(sync_week), wview);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index d37d4156a8..e4312e9341 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -275,7 +275,7 @@ mail_notify (char *mail_address, char *text, time_t app_time)
pid = fork ();
if (pid == 0){
const int top = max_open_files ();
- int dev_null, i;
+ int dev_null;
dev_null = open ("/dev/null", O_RDWR);
dup2 (p [0], 0);
@@ -329,3 +329,54 @@ calendar_notify (time_t time, void *data)
}
}
+/*
+ * called from the calendar_iterate routine to mark the days of a GtkCalendar
+ */
+static int
+mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
+{
+ GtkCalendar *gtk_cal = c;
+ struct tm *tm_s;
+ int days, day;
+
+ tm_s = localtime (&start);
+ days = difftime (end, start) / (60*60*24);
+
+ for (day = 0; day <= days; day++){
+ time_t new = mktime (tm_s);
+ struct tm *tm_day;
+
+ tm_day = localtime (&new);
+ gtk_calendar_mark_day (gtk_cal, tm_day->tm_mday);
+ tm_s->tm_mday++;
+ }
+ return TRUE;
+}
+
+/*
+ * Tags the dates with appointments in a GtkCalendar based on the
+ * GnomeCalendar contents
+ */
+void
+gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal)
+{
+ time_t month_begin, month_end;
+ struct tm tm;
+ GList *l;
+
+ /* compute month_begin */
+ tm.tm_hour = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_mday = 0;
+ tm.tm_mon = gtk_cal->month;
+ tm.tm_year = gtk_cal->year - 1900;
+ tm.tm_isdst= -1;
+
+ month_begin = mktime (&tm);
+ tm.tm_mon++;
+ month_end = mktime (&tm);
+
+ gtk_calendar_clear_marks (gtk_cal);
+ calendar_iterate (cal->cal, month_begin, month_end, mark_gtk_calendar_day, gtk_cal);
+}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 653244b075..513bf88ad3 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -45,6 +45,7 @@ void gnome_calendar_next (GnomeCalendar *gcal);
void gnome_calendar_previous (GnomeCalendar *gcal);
void gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time);
void gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time);
+void gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal);
/* Flags is a bitmask of CalObjectChange values */
void gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags);