aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--calendar/gui/calendar-model.c4
-rw-r--r--calendar/gui/dialogs/alarm-notify.glade.h6
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade.h87
-rw-r--r--calendar/gui/dialogs/task-editor-dialog.glade.h33
-rw-r--r--calendar/gui/event-editor-dialog.glade58
-rw-r--r--calendar/gui/event-editor-dialog.glade.h4
-rw-r--r--calendar/gui/event-editor.c203
-rw-r--r--calendar/gui/gnome-cal.c128
-rw-r--r--calendar/gui/gnome-cal.h2
10 files changed, 278 insertions, 249 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 331c0c68ee..9a4c7a300e 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -113,6 +113,8 @@ evolution_calendar_SOURCES = \
print.c \
print.h \
prop.c \
+ tag-calendar.c \
+ tag-calendar.h \
weekday-picker.c \
weekday-picker.h
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 064e855ba1..f492840d06 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -1630,6 +1630,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
*new_idx = priv->objects->len - 1;
g_hash_table_insert (priv->uid_index_hash, (char *) new_comp_uid, new_idx);
+ e_table_model_row_inserted (E_TABLE_MODEL (model), *new_idx);
} else {
int i;
@@ -1658,9 +1659,10 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
(*comp_idx)++;
}
+
+ e_table_model_row_changed (E_TABLE_MODEL (model), *new_idx);
}
- e_table_model_row_changed (E_TABLE_MODEL (model), *new_idx);
break;
case CAL_CLIENT_GET_NOT_FOUND:
diff --git a/calendar/gui/dialogs/alarm-notify.glade.h b/calendar/gui/dialogs/alarm-notify.glade.h
index c7b8918e06..053395a4c5 100644
--- a/calendar/gui/dialogs/alarm-notify.glade.h
+++ b/calendar/gui/dialogs/alarm-notify.glade.h
@@ -1,10 +1,10 @@
/*
- * Translatable strings file generated by Glade.
- * Add this file to your project's POTFILES.in.
+ * Translatable strings file generated by extract-ui.
+ * Add this file to your project's POTFILES.in
* DO NOT compile it as part of your application.
*/
gchar *s = N_("Close");
-gchar *s = N_("Snooze");
gchar *s = N_("Edit appointment");
+gchar *s = N_("Snooze");
gchar *s = N_("Snooze time (minutes)");
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade.h b/calendar/gui/dialogs/cal-prefs-dialog.glade.h
index 0a29d11999..71ba85a8bd 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade.h
@@ -1,67 +1,52 @@
/*
- * Translatable strings file generated by Glade.
- * Add this file to your project's POTFILES.in.
+ * Translatable strings file generated by extract-ui.
+ * Add this file to your project's POTFILES.in
* DO NOT compile it as part of your application.
*/
-gchar *s = N_("Calendar Preferences");
-gchar *s = N_("Work week");
-gchar *s = N_("Mon");
-gchar *s = N_("Tue");
-gchar *s = N_("Wed");
-gchar *s = N_("Thu");
-gchar *s = N_("Fri");
-gchar *s = N_("Sat");
-gchar *s = N_("Sun");
-gchar *s = N_("First day of week:");
-gchar *s = N_("Monday");
-gchar *s = N_("Tuesday");
-gchar *s = N_("Wednesday");
-gchar *s = N_("Thursday");
-gchar *s = N_("Friday");
-gchar *s = N_("Saturday");
-gchar *s = N_("Sunday");
-gchar *s = N_("Start of day:");
-gchar *s = N_("End of day:");
-gchar *s = N_("Display options");
-gchar *s = N_("Time divisions:");
-gchar *s = N_("Time format:");
-gchar *s = N_("Show appointment end times");
-gchar *s = N_("Compress weekends");
gchar *s = N_("12 hour (am/pm)");
gchar *s = N_("24 hour");
-gchar *s = N_("60 minutes");
-gchar *s = N_("30 minutes");
-gchar *s = N_("15 minutes");
-gchar *s = N_("10 minutes");
-gchar *s = N_("05 minutes");
-gchar *s = N_("Date navigator options");
-gchar *s = N_("Show week numbers");
+gchar *s = N_("Alarms timeout after");
+gchar *s = N_("Audio Alarms");
+gchar *s = N_("Beep when alarm windows appear.");
gchar *s = N_("Calendar");
-gchar *s = N_("Show");
+gchar *s = N_("Calendar Preferences");
+gchar *s = N_("Colors");
+gchar *s = N_("Compress weekends");
+gchar *s = N_("Date navigator options");
+gchar *s = N_("Defaults");
+gchar *s = N_("Display options");
gchar *s = N_("Due Date");
-gchar *s = N_("Time Until Due");
-gchar *s = N_("Priority");
+gchar *s = N_("Enable snoozing for");
+gchar *s = N_("End of day:");
+gchar *s = N_("First day of week:");
+gchar *s = N_("Fri");
gchar *s = N_("Highlight");
-gchar *s = N_("Overdue Items");
gchar *s = N_("Items Due Today");
+gchar *s = N_("Items Due Today:");
gchar *s = N_("Items Not Yet Due");
-gchar *s = N_("Colors");
-gchar *s = N_("Pick a color");
-gchar *s = N_("Pick a color");
-gchar *s = N_("Pick a color");
gchar *s = N_("Items Not Yet Due:");
-gchar *s = N_("Items Due Today:");
+gchar *s = N_("Mon");
+gchar *s = N_("Overdue Items");
gchar *s = N_("Overdue Items:");
-gchar *s = N_("TaskPad");
-gchar *s = N_("Defaults");
+gchar *s = N_("Pick a color");
+gchar *s = N_("Priority");
gchar *s = N_("Remind me of all appointments");
-gchar *s = N_("minutes before they occur.");
+gchar *s = N_("Reminders");
+gchar *s = N_("Sat");
+gchar *s = N_("Show");
+gchar *s = N_("Show appointment end times");
+gchar *s = N_("Show week numbers");
+gchar *s = N_("Start of day:");
+gchar *s = N_("Sun");
+gchar *s = N_("TaskPad");
+gchar *s = N_("Thu");
+gchar *s = N_("Time Until Due");
+gchar *s = N_("Time divisions:");
+gchar *s = N_("Time format:");
+gchar *s = N_("Tue");
gchar *s = N_("Visual Alarms");
-gchar *s = N_("Beep when alarm windows appear.");
-gchar *s = N_("Audio Alarms");
-gchar *s = N_("Alarms timeout after");
-gchar *s = N_("seconds.");
-gchar *s = N_("Enable snoozing for");
+gchar *s = N_("Wed");
+gchar *s = N_("Work week");
+gchar *s = N_("minutes before they occur.");
gchar *s = N_("seconds.");
-gchar *s = N_("Reminders");
diff --git a/calendar/gui/dialogs/task-editor-dialog.glade.h b/calendar/gui/dialogs/task-editor-dialog.glade.h
index 8ba4eea0a1..5aa32dd38b 100644
--- a/calendar/gui/dialogs/task-editor-dialog.glade.h
+++ b/calendar/gui/dialogs/task-editor-dialog.glade.h
@@ -1,31 +1,20 @@
/*
- * Translatable strings file generated by Glade.
- * Add this file to your project's POTFILES.in.
+ * Translatable strings file generated by extract-ui.
+ * Add this file to your project's POTFILES.in
* DO NOT compile it as part of your application.
*/
-gchar *s = N_("task-editor-dialog");
-gchar *s = N_("S_ummary");
-gchar *s = N_("Sta_rt Date:");
-gchar *s = N_("_Due Date:");
gchar *s = N_("% Comp_lete:");
-gchar *s = N_("_Status:");
-gchar *s = N_("Not Started");
-gchar *s = N_("In Progress");
-gchar *s = N_("Completed");
-gchar *s = N_("Cancelled");
-gchar *s = N_("_Priority:");
-gchar *s = N_("High");
-gchar *s = N_("Normal");
-gchar *s = N_("Low");
gchar *s = N_("C_lassification:");
-gchar *s = N_("None");
-gchar *s = N_("Public");
-gchar *s = N_("Private");
-gchar *s = N_("Confidential");
-gchar *s = N_("_Contacts...");
gchar *s = N_("Ca_tegories...");
-gchar *s = N_("Task");
gchar *s = N_("Date Completed:");
-gchar *s = N_("URL:");
gchar *s = N_("Details");
+gchar *s = N_("S_ummary");
+gchar *s = N_("Sta_rt Date:");
+gchar *s = N_("Task");
+gchar *s = N_("URL:");
+gchar *s = N_("_Contacts...");
+gchar *s = N_("_Due Date:");
+gchar *s = N_("_Priority:");
+gchar *s = N_("_Status:");
+gchar *s = N_("task-editor-dialog");
diff --git a/calendar/gui/event-editor-dialog.glade b/calendar/gui/event-editor-dialog.glade
index ed1a55af7d..b2e5edc426 100644
--- a/calendar/gui/event-editor-dialog.glade
+++ b/calendar/gui/event-editor-dialog.glade
@@ -1201,8 +1201,8 @@ forever
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
<widget>
@@ -1330,22 +1330,50 @@ forever
</widget>
<widget>
- <class>GtkLabel</class>
- <name>recurrence-custom-warning</name>
- <label>This appointment has custom recurrence rules that cannot be edited by Evolution.
-
-However, the appointment will recur at the appropriate time and will be displayed properly in the calendar views.</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>True</wrap>
- <xalign>0</xalign>
- <yalign>0</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkVBox</class>
+ <name>vbox48</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label50</name>
+ <label>Rule view</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>recurrence-preview-bin</name>
+ <xalign>0</xalign>
+ <yalign>0</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
</widget>
</widget>
</widget>
diff --git a/calendar/gui/event-editor-dialog.glade.h b/calendar/gui/event-editor-dialog.glade.h
index 97a9366d66..559e1a554b 100644
--- a/calendar/gui/event-editor-dialog.glade.h
+++ b/calendar/gui/event-editor-dialog.glade.h
@@ -54,7 +54,5 @@ gchar *s = N_("Add");
gchar *s = N_("Modify");
gchar *s = N_("Delete");
gchar *s = N_("label21");
-gchar *s = N_("This appointment has custom recurrence rules that cannot be edited by Evolution.\n"
- "\n"
- "However, the appointment will recur at the appropriate time and will be displayed properly in the calendar views.");
+gchar *s = N_("Rule view");
gchar *s = N_("Recurrence");
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index 59f08c2267..edadfdcb53 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -30,6 +30,7 @@
#include <cal-util/timeutil.h>
#include "event-editor.h"
#include "e-meeting-edit.h"
+#include "tag-calendar.h"
#include "weekday-picker.h"
@@ -107,7 +108,6 @@ struct _EventEditorPrivate {
GtkWidget *recurrence_none;
GtkWidget *recurrence_simple;
GtkWidget *recurrence_custom;
- GtkWidget *recurrence_custom_warning;
GtkWidget *recurrence_params;
GtkWidget *recurrence_interval_value;
@@ -142,6 +142,11 @@ struct _EventEditorPrivate {
GtkWidget *recurrence_exception_add;
GtkWidget *recurrence_exception_modify;
GtkWidget *recurrence_exception_delete;
+
+ GtkWidget *recurrence_preview_bin;
+
+ /* For the recurrence preview, the actual widget */
+ GtkWidget *recurrence_preview_calendar;
};
@@ -163,6 +168,8 @@ static void check_all_day (EventEditor *ee);
static void set_all_day (GtkWidget *toggle, EventEditor *ee);
static void alarm_toggle (GtkWidget *toggle, EventEditor *ee);
static void date_changed_cb (EDateEdit *dedit, gpointer data);
+static void preview_recur (EventEditor *ee);
+static void recur_to_comp_object (EventEditor *ee, CalComponent *comp);
static void recurrence_exception_add_cb (GtkWidget *widget, EventEditor *ee);
static void recurrence_exception_modify_cb (GtkWidget *widget, EventEditor *ee);
static void recurrence_exception_delete_cb (GtkWidget *widget, EventEditor *ee);
@@ -710,17 +717,14 @@ sensitize_recur_widgets (EventEditor *ee)
switch (type) {
case RECUR_NONE:
gtk_widget_set_sensitive (priv->recurrence_params, FALSE);
- gtk_widget_hide (priv->recurrence_custom_warning);
break;
case RECUR_SIMPLE:
gtk_widget_set_sensitive (priv->recurrence_params, TRUE);
- gtk_widget_hide (priv->recurrence_custom_warning);
break;
case RECUR_CUSTOM:
gtk_widget_set_sensitive (priv->recurrence_params, FALSE);
- gtk_widget_show (priv->recurrence_custom_warning);
break;
default:
@@ -738,6 +742,17 @@ recurrence_type_toggled_cb (GtkWidget *widget, gpointer data)
ee = EVENT_EDITOR (data);
sensitize_recur_widgets (ee);
+ preview_recur (ee);
+}
+
+/* Callback used when the recurrence interval value spin button changes. */
+static void
+recur_interval_value_changed_cb (GtkAdjustment *adj, gpointer data)
+{
+ EventEditor *ee;
+
+ ee = EVENT_EDITOR (data);
+ preview_recur (ee);
}
/* Callback used when the recurrence interval option menu changes. We need to
@@ -750,6 +765,7 @@ recur_interval_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
ee = EVENT_EDITOR (data);
make_recurrence_special (ee);
+ preview_recur (ee);
}
/* Callback used when the recurrence ending option menu changes. We need to
@@ -762,6 +778,7 @@ recur_ending_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
ee = EVENT_EDITOR (data);
make_recurrence_ending_special (ee);
+ preview_recur (ee);
}
/* Gets the widgets from the XML file and returns if they are all available.
@@ -811,7 +828,6 @@ get_widgets (EventEditor *ee)
priv->recurrence_none = GW ("recurrence-none");
priv->recurrence_simple = GW ("recurrence-simple");
priv->recurrence_custom = GW ("recurrence-custom");
- priv->recurrence_custom_warning = GW ("recurrence-custom-warning");
priv->recurrence_params = GW ("recurrence-params");
priv->recurrence_interval_value = GW ("recurrence-interval-value");
@@ -826,6 +842,8 @@ get_widgets (EventEditor *ee)
priv->recurrence_exception_modify = GW ("recurrence-exception-modify");
priv->recurrence_exception_delete = GW ("recurrence-exception-delete");
+ priv->recurrence_preview_bin = GW ("recurrence-preview-bin");
+
#undef GW
return (priv->general_summary
@@ -854,7 +872,6 @@ get_widgets (EventEditor *ee)
&& priv->recurrence_none
&& priv->recurrence_simple
&& priv->recurrence_custom
- && priv->recurrence_custom_warning
&& priv->recurrence_params
&& priv->recurrence_interval_value
&& priv->recurrence_interval_unit
@@ -865,7 +882,8 @@ get_widgets (EventEditor *ee)
&& priv->recurrence_exception_list
&& priv->recurrence_exception_add
&& priv->recurrence_exception_modify
- && priv->recurrence_exception_delete);
+ && priv->recurrence_exception_delete
+ && priv->recurrence_preview_bin);
}
/* Syncs the contents of two entry widgets, while blocking signals from each
@@ -925,6 +943,7 @@ init_widgets (EventEditor *ee)
{
EventEditorPrivate *priv;
GtkWidget *menu;
+ GtkAdjustment *adj;
priv = ee->priv;
@@ -972,6 +991,12 @@ init_widgets (EventEditor *ee)
gtk_signal_connect (GTK_OBJECT (priv->recurrence_custom), "toggled",
GTK_SIGNAL_FUNC (recurrence_type_toggled_cb), ee);
+ /* Recurrence interval */
+
+ adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->recurrence_interval_value));
+ gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
+ GTK_SIGNAL_FUNC (recur_interval_value_changed_cb), ee);
+
/* Recurrence units */
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->recurrence_interval_unit));
@@ -992,6 +1017,13 @@ init_widgets (EventEditor *ee)
GTK_SIGNAL_FUNC (recurrence_exception_modify_cb), ee);
gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_delete), "clicked",
GTK_SIGNAL_FUNC (recurrence_exception_delete_cb), ee);
+
+ /* Recurrence preview */
+
+ priv->recurrence_preview_calendar = e_calendar_new ();
+ gtk_container_add (GTK_CONTAINER (priv->recurrence_preview_bin),
+ priv->recurrence_preview_calendar);
+ gtk_widget_show (priv->recurrence_preview_calendar);
}
static const int classification_map[] = {
@@ -1157,6 +1189,83 @@ count_by_xxx (short *field, int max_elements)
return i;
}
+/* Re-tags the recurrence preview calendar based on the current information of
+ * the event editor.
+ */
+static void
+preview_recur (EventEditor *ee)
+{
+ EventEditorPrivate *priv;
+ CalComponent *comp;
+ CalComponentDateTime cdt;
+ GSList *l;
+
+ priv = ee->priv;
+ g_assert (priv->comp != NULL);
+
+ /* Create a scratch component with the start/end and
+ * recurrence/excepttion information from the one we are editing.
+ */
+
+ comp = cal_component_new ();
+ cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
+
+ cal_component_get_dtstart (priv->comp, &cdt);
+ cal_component_set_dtstart (comp, &cdt);
+ cal_component_free_datetime (&cdt);
+
+ cal_component_get_dtend (priv->comp, &cdt);
+ cal_component_set_dtend (comp, &cdt);
+ cal_component_free_datetime (&cdt);
+
+ cal_component_get_exdate_list (priv->comp, &l);
+ cal_component_set_exdate_list (comp, l);
+ cal_component_free_exdate_list (l);
+
+ cal_component_get_exrule_list (priv->comp, &l);
+ cal_component_set_exrule_list (comp, l);
+ cal_component_free_recur_list (l);
+
+ cal_component_get_rdate_list (priv->comp, &l);
+ cal_component_set_rdate_list (comp, l);
+ cal_component_free_period_list (l);
+
+ cal_component_get_rrule_list (priv->comp, &l);
+ cal_component_set_rrule_list (comp, l);
+ cal_component_free_recur_list (l);
+
+ recur_to_comp_object (ee, comp);
+
+ tag_calendar_by_comp (E_CALENDAR (priv->recurrence_preview_calendar), comp);
+ gtk_object_unref (GTK_OBJECT (comp));
+}
+
+/* Fills in the exception widgets with the data from the calendar component */
+static void
+fill_exception_widgets (EventEditor *ee)
+{
+ EventEditorPrivate *priv;
+ GSList *list, *l;
+
+ priv = ee->priv;
+ g_assert (priv->comp != NULL);
+
+ /* Exceptions list */
+
+ cal_component_get_exdate_list (priv->comp, &list);
+
+ for (l = list; l; l = l->next) {
+ CalComponentDateTime *cdt;
+ time_t ext;
+
+ cdt = l->data;
+ ext = icaltime_as_timet (*cdt->value);
+ append_exception (ee, ext);
+ }
+
+ cal_component_free_exdate_list (list);
+}
+
/* Fills in the recurrence widgets with the values from the calendar component.
* This function is particularly tricky because it has to discriminate between
* recurrences we support for editing and the ones we don't. We only support at
@@ -1177,6 +1286,8 @@ fill_recurrence_widgets (EventEditor *ee)
priv = ee->priv;
g_assert (priv->comp != NULL);
+ fill_exception_widgets (ee);
+
/* No recurrences? */
if (!cal_component_has_rdates (priv->comp)
@@ -1184,6 +1295,7 @@ fill_recurrence_widgets (EventEditor *ee)
&& !cal_component_has_exrules (priv->comp)) {
e_dialog_radio_set (priv->recurrence_none, RECUR_NONE, recur_type_map);
sensitize_recur_widgets (ee);
+ preview_recur (ee);
return;
}
@@ -1415,6 +1527,7 @@ fill_recurrence_widgets (EventEditor *ee)
out:
cal_component_free_recur_list (rrule_list);
+ preview_recur (ee);
}
/* Fills in the widgets with the value from the calendar component */
@@ -1425,7 +1538,7 @@ fill_widgets (EventEditor *ee)
CalComponentText text;
CalComponentClassification cl;
CalComponentDateTime d;
- GSList *list, *l;
+ GSList *l;
time_t dtstart, dtend;
priv = ee->priv;
@@ -1518,21 +1631,6 @@ fill_widgets (EventEditor *ee)
/* Recurrences */
fill_recurrence_widgets (ee);
-
- /* Exceptions list */
-
- cal_component_get_exdate_list (priv->comp, &list);
-
- for (l = list; l; l = l->next) {
- CalComponentDateTime *cdt;
- time_t ext;
-
- cdt = l->data;
- ext = icaltime_as_timet (*cdt->value);
- append_exception (ee, ext);
- }
-
- cal_component_free_exdate_list (list);
}
@@ -1744,6 +1842,9 @@ recur_to_comp_object (EventEditor *ee, CalComponent *comp)
{
EventEditorPrivate *priv;
enum recur_type recur_type;
+ GtkCList *exception_list;
+ GSList *list;
+ int i;
priv = ee->priv;
@@ -1757,6 +1858,8 @@ recur_to_comp_object (EventEditor *ee, CalComponent *comp)
break;
case RECUR_SIMPLE:
+ cal_component_set_rdate_list (comp, NULL);
+ cal_component_set_exrule_list (comp, NULL);
simple_recur_to_comp_object (ee, comp);
break;
@@ -1767,6 +1870,27 @@ recur_to_comp_object (EventEditor *ee, CalComponent *comp)
default:
g_assert_not_reached ();
}
+
+ /* Set exceptions */
+
+ list = NULL;
+ exception_list = GTK_CLIST (priv->recurrence_exception_list);
+ for (i = 0; i < exception_list->rows; i++) {
+ CalComponentDateTime *cdt;
+ time_t *tim;
+
+ cdt = g_new (CalComponentDateTime, 1);
+ cdt->value = g_new (struct icaltimetype, 1);
+ cdt->tzid = NULL;
+
+ tim = gtk_clist_get_row_data (exception_list, i);
+ *cdt->value = icaltime_from_timet (*tim, FALSE, FALSE);
+
+ list = g_slist_prepend (list, cdt);
+ }
+
+ cal_component_set_exdate_list (comp, list);
+ cal_component_free_exdate_list (list);
}
/* Gets the data from the widgets and stores it in the calendar component object */
@@ -1777,10 +1901,7 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp)
CalComponentDateTime date;
time_t t;
gboolean all_day_event;
- GtkCList *exception_list;
- GSList *list;
char *str;
- int i;
priv = ee->priv;
@@ -1865,27 +1986,6 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp)
/* Recurrence information */
recur_to_comp_object (ee, comp);
- /* Set exceptions */
-
- list = NULL;
- exception_list = GTK_CLIST (priv->recurrence_exception_list);
- for (i = 0; i < exception_list->rows; i++) {
- CalComponentDateTime *cdt;
- time_t *tim;
-
- cdt = g_new (CalComponentDateTime, 1);
- cdt->value = g_new (struct icaltimetype, 1);
- cdt->tzid = NULL;
-
- tim = gtk_clist_get_row_data (exception_list, i);
- *cdt->value = icaltime_from_timet (*tim, FALSE, FALSE);
-
- list = g_slist_prepend (list, cdt);
- }
-
- cal_component_set_exdate_list (comp, list);
- cal_component_free_exdate_list (list);
-
cal_component_commit_sequence (comp);
}
@@ -2541,6 +2641,10 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
/* Set the "all day event" button as appropriate */
check_all_day (ee);
+
+ /* Retag the recurrence preview calendar */
+
+ preview_recur (ee);
}
/* Builds a static string out of an exception date */
@@ -2592,6 +2696,7 @@ recurrence_exception_add_cb (GtkWidget *widget, EventEditor *ee)
t = e_date_edit_get_time (E_DATE_EDIT (priv->recurrence_exception_date));
append_exception (ee, t);
+ preview_recur (ee);
}
/* Callback for the "modify exception" button */
@@ -2615,6 +2720,8 @@ recurrence_exception_modify_cb (GtkWidget *widget, EventEditor *ee)
*t = e_date_edit_get_time (E_DATE_EDIT (priv->recurrence_exception_date));
e_utf8_gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
+
+ preview_recur (ee);
}
/* Callback for the "delete exception" button */
@@ -2645,6 +2752,8 @@ recurrence_exception_delete_cb (GtkWidget *widget, EventEditor *ee)
gtk_widget_set_sensitive (priv->recurrence_exception_modify, FALSE);
gtk_widget_set_sensitive (priv->recurrence_exception_delete, FALSE);
}
+
+ preview_recur (ee);
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 379bbfec95..b3f1556a2c 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -27,6 +27,7 @@
#include "component-factory.h"
#include "calendar-commands.h"
#include "calendar-config.h"
+#include "tag-calendar.h"
@@ -50,6 +51,7 @@ typedef enum {
/* Private part of the GnomeCalendar structure */
struct _GnomeCalendarPrivate {
+ /* The calendar client object we monitor */
CalClient *client;
/* Loading state; we can be loading or creating a calendar */
@@ -109,6 +111,11 @@ struct _GnomeCalendarPrivate {
/* UID->alarms hash */
GHashTable *alarms;
+
+ /* Whether we are being destroyed and should not mess with the object
+ * editor hash table.
+ */
+ guint in_destroy : 1;
};
@@ -330,12 +337,12 @@ free_object_alarms (gpointer key, gpointer value, gpointer data)
/* Used from g_hash_table_foreach(); frees an UID string */
static void
-free_uid (gpointer key, gpointer value, gpointer data)
+destroy_editor_cb (gpointer key, gpointer value, gpointer data)
{
- char *uid;
+ EventEditor *ee;
- uid = key;
- g_free (uid);
+ ee = EVENT_EDITOR (value);
+ gtk_object_unref (GTK_OBJECT (ee));
}
static void
@@ -372,7 +379,8 @@ gnome_calendar_destroy (GtkObject *object)
g_hash_table_destroy (priv->alarms);
priv->alarms = NULL;
- g_hash_table_foreach (priv->object_editor_hash, free_uid, NULL);
+ priv->in_destroy = TRUE;
+ g_hash_table_foreach (priv->object_editor_hash, destroy_editor_cb, NULL);
g_hash_table_destroy (priv->object_editor_hash);
priv->object_editor_hash = NULL;
@@ -1075,7 +1083,7 @@ initial_load (GnomeCalendar *gcal)
priv = gcal->priv;
load_alarms (gcal);
- gnome_calendar_tag_calendar (gcal, priv->date_navigator);
+ tag_calendar_by_client (priv->date_navigator, priv->client);
}
/* Removes any queued alarms for the specified UID */
@@ -1271,7 +1279,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
remove_alarms_for_object (gcal, uid);
add_alarms_for_object (gcal, uid);
- gnome_calendar_tag_calendar (gcal, priv->date_navigator);
+ tag_calendar_by_client (priv->date_navigator, priv->client);
}
/* Callback from the calendar client when an object is removed */
@@ -1286,7 +1294,7 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data)
remove_alarms_for_object (gcal, uid);
- gnome_calendar_tag_calendar (gcal, priv->date_navigator);
+ tag_calendar_by_client (priv->date_navigator, priv->client);
}
@@ -1544,98 +1552,6 @@ calendar_notify (time_t activation_time, CalendarAlarm *which, void *data)
#endif
-struct calendar_tag_closure
-{
- ECalendarItem *calitem;
- time_t start_time;
- time_t end_time;
-};
-
-/* Marks the specified range in a GtkCalendar */
-static gboolean
-gnome_calendar_tag_calendar_cb (CalComponent *comp,
- time_t istart,
- time_t iend,
- gpointer data)
-{
- struct calendar_tag_closure *c = data;
- time_t t;
-
- t = time_day_begin (istart);
-
- do {
- struct tm tm;
-
- tm = *localtime (&t);
-
- e_calendar_item_mark_day (c->calitem, tm.tm_year + 1900,
- tm.tm_mon, tm.tm_mday,
- E_CALENDAR_ITEM_MARK_BOLD);
-
- t = time_day_end (t);
- } while (t < iend);
-
- return TRUE;
-}
-
-/*
- * Tags the dates with appointments in a GtkCalendar based on the
- * GnomeCalendar contents
- */
-void
-gnome_calendar_tag_calendar (GnomeCalendar *gcal, ECalendar *ecal)
-{
- GnomeCalendarPrivate *priv;
- struct calendar_tag_closure c;
- gint start_year, start_month, start_day;
- gint end_year, end_month, end_day;
- struct tm start_tm = { 0 }, end_tm = { 0 };
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (ecal != NULL);
- g_return_if_fail (E_IS_CALENDAR (ecal));
-
- priv = gcal->priv;
-
- /* If the ECalendar isn't visible, we just return. */
- if (!GTK_WIDGET_VISIBLE (ecal))
- return;
-
- e_calendar_item_clear_marks (ecal->calitem);
-
- if (!cal_client_is_loaded (priv->client))
- return;
-
- e_calendar_item_get_date_range (ecal->calitem,
- &start_year, &start_month, &start_day,
- &end_year, &end_month, &end_day);
-
- start_tm.tm_year = start_year - 1900;
- start_tm.tm_mon = start_month;
- start_tm.tm_mday = start_day;
- start_tm.tm_hour = 0;
- start_tm.tm_min = 0;
- start_tm.tm_sec = 0;
- start_tm.tm_isdst = -1;
-
- end_tm.tm_year = end_year - 1900;
- end_tm.tm_mon = end_month;
- end_tm.tm_mday = end_day;
- end_tm.tm_hour = 0;
- end_tm.tm_min = 0;
- end_tm.tm_sec = 0;
- end_tm.tm_isdst = -1;
-
- c.calitem = ecal->calitem;
- c.start_time = mktime (&start_tm);
- c.end_time = mktime (&end_tm);
-
- cal_client_generate_instances (priv->client, CALOBJ_TYPE_EVENT,
- c.start_time, c.end_time,
- gnome_calendar_tag_calendar_cb, &c);
-}
-
/* Tells the calendar to reload all config settings.
If initializing is TRUE it sets the pane positions as well. (We don't
@@ -1867,9 +1783,7 @@ editor_closed_cb (GtkWidget *widget, gpointer data)
gpointer orig_key;
char *orig_uid;
- g_print ("editor_closed_cb ()\n");
-
- ec = (struct editor_closure *)data;
+ ec = (struct editor_closure *) data;
gcal = ec->gcal;
priv = gcal->priv;
@@ -1878,8 +1792,12 @@ editor_closed_cb (GtkWidget *widget, gpointer data)
orig_uid = orig_key;
- g_hash_table_remove (priv->object_editor_hash, orig_uid);
+ if (!priv->in_destroy)
+ g_hash_table_remove (priv->object_editor_hash, orig_uid);
+
g_free (orig_uid);
+
+ g_free (ec);
}
void
@@ -2139,7 +2057,7 @@ gnome_calendar_on_date_navigator_date_range_changed (ECalendarItem *calitem,
priv = gcal->priv;
- gnome_calendar_tag_calendar (gcal, priv->date_navigator);
+ tag_calendar_by_client (priv->date_navigator, priv->client);
}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 2474e92bea..1858340fae 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -70,8 +70,6 @@ void gnome_calendar_dayjump (GnomeCalendar *gcal,
time_t time);
/* Jumps to the current day */
void gnome_calendar_goto_today (GnomeCalendar *gcal);
-void gnome_calendar_tag_calendar (GnomeCalendar *gcal,
- ECalendar *ecal);
char *gnome_calendar_get_current_view_name (GnomeCalendar *gcal);
void gnome_calendar_set_view (GnomeCalendar *gcal,
char *page_name,