aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2000-05-03 06:27:45 +0800
committerDamon Chaplin <damon@src.gnome.org>2000-05-03 06:27:45 +0800
commit3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d (patch)
tree17ac1b5391e04b27d661daa109ce5d5ece327083 /calendar/gui/e-week-view.c
parent848cacc4905bc5a0423db986119fc708a4ec4ef1 (diff)
downloadgsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.tar
gsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.tar.gz
gsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.tar.bz2
gsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.tar.lz
gsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.tar.xz
gsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.tar.zst
gsoc2013-evolution-3283a9fcd37fb2b4d5a6a128e93fb19d2a61e15d.zip
set the active radio button here. Oops - it wasn't a Bonobo problem after
2000-05-02 Damon Chaplin <damon@helixcode.com> * gui/calendar-commands.c (calendar_control_activate): set the active radio button here. Oops - it wasn't a Bonobo problem after all. * gui/popup-menu.c (popup_menu): added call to e_auto_kill_popup_menu_on_hide() to destroy the menu. * gui/e-week-view.c (e_week_view_show_popup_menu): * gui/e-day-view.c (e_day_view_on_event_right_click): ico->user_data isn't useful any more, since the event editor keeps its own iCalObject. So for now we make the menu commands available even when the event is being edited in the event editor. Also corrected misspellings of 'occurance' -> 'occurrence'. * gui/eventedit.c (event_editor_destroy): destroy the iCalObject. The event editor now uses its own independent iCalObject. * gui/e-week-view.c (e_week_view_on_unrecur_appointment): * gui/e-day-view.c (e_day_view_on_unrecur_appointment): create a new uid for the new single instance. I'm not sure what we should do about the creation/last modification times of the objects. * gui/e-week-view.c (e_week_view_on_edit_appointment): * gui/e-day-view.c (e_day_view_on_edit_appointment): duplicate the iCalObject before passing it to the event editor, since it will change the fields. If we don't duplicate it we won't know what has changed when we get the "update_event" callback. * gui/e-week-view.c (e_week_view_key_press): * gui/e-day-view.c (e_day_view_key_press): set the created and last_mod times of the new iCalObject. We may want to set the default alarm as well. * cal-util/calobj.c (ical_gen_uid): made this function public so we can generate new uids if necessary. svn path=/trunk/; revision=2759
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 83eb6e5608..6f371a10c4 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -144,8 +144,8 @@ static void e_week_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_week_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
-static void e_week_view_on_delete_occurance (GtkWidget *widget,
- gpointer data);
+static void e_week_view_on_delete_occurrence (GtkWidget *widget,
+ gpointer data);
static void e_week_view_on_delete_appointment (GtkWidget *widget,
gpointer data);
static void e_week_view_on_unrecur_appointment (GtkWidget *widget,
@@ -974,7 +974,7 @@ e_week_view_update_event (EWeekView *week_view,
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
-#if 0
+#if 1
g_print ("In e_week_view_update_event\n");
#endif
@@ -1007,10 +1007,12 @@ e_week_view_update_event (EWeekView *week_view,
update the event fairly easily without changing the events arrays
or computing a new layout. */
if (e_week_view_find_event_from_uid (week_view, uid, &event_num)) {
+ g_print (" updating existing event\n");
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
if (ical_object_compare_dates (event->ico, ico)) {
+ g_print (" dates unchanged\n");
e_week_view_foreach_event_with_uid (week_view, uid, e_week_view_update_event_cb, ico);
gtk_widget_queue_draw (week_view->main_canvas);
return;
@@ -1018,6 +1020,7 @@ e_week_view_update_event (EWeekView *week_view,
/* The dates have changed, so we need to remove the
old occurrrences before adding the new ones. */
+ g_print (" dates changed\n");
e_week_view_foreach_event_with_uid (week_view, uid,
e_week_view_remove_event_cb,
NULL);
@@ -2463,6 +2466,8 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
Note that user_name is a global variable. */
ico = ical_new ("", user_name, "");
ico->new = 1;
+ ico->created = time (NULL);
+ ico->last_mod = ico->created;
ico->dtstart = week_view->day_starts[week_view->selection_start_day];
ico->dtend = week_view->day_starts[week_view->selection_end_day + 1];
@@ -2510,10 +2515,10 @@ e_week_view_show_popup_menu (EWeekView *week_view,
};
static struct menu_item recur_child_items[] = {
- { N_("Make this appointment movable"), (GtkSignalFunc) e_week_view_on_unrecur_appointment, NULL, TRUE },
{ N_("Edit this appointment..."), (GtkSignalFunc) e_week_view_on_edit_appointment, NULL, TRUE },
- { N_("Delete this occurance"), (GtkSignalFunc) e_week_view_on_delete_occurance, NULL, TRUE },
- { N_("Delete all occurances"), (GtkSignalFunc) e_week_view_on_delete_appointment, NULL, TRUE },
+ { N_("Make this appointment movable"), (GtkSignalFunc) e_week_view_on_unrecur_appointment, NULL, TRUE },
+ { N_("Delete this occurrence"), (GtkSignalFunc) e_week_view_on_delete_occurrence, NULL, TRUE },
+ { N_("Delete all occurrences"), (GtkSignalFunc) e_week_view_on_delete_appointment, NULL, TRUE },
{ NULL, NULL, NULL, TRUE },
{ N_("New appointment..."), (GtkSignalFunc) e_week_view_on_new_appointment, NULL, TRUE }
};
@@ -2529,23 +2534,26 @@ e_week_view_show_popup_menu (EWeekView *week_view,
event = &g_array_index (week_view->events,
EWeekViewEvent, event_num);
- /* Check if the event is being edited in the event editor. */
- not_being_edited = (event->ico->user_data == NULL);
+ /* This used to be set only if the event wasn't being edited
+ in the event editor, but we can't check that at present.
+ We could possibly set up another method of checking it. */
+ not_being_edited = TRUE;
if (event->ico->recur) {
num_items = 6;
context_menu = &recur_child_items[0];
+ context_menu[0].sensitive = not_being_edited;
+ context_menu[1].sensitive = not_being_edited;
+ context_menu[2].sensitive = not_being_edited;
context_menu[3].sensitive = not_being_edited;
context_menu[5].sensitive = have_selection;
} else {
num_items = 4;
context_menu = &child_items[0];
+ context_menu[0].sensitive = not_being_edited;
+ context_menu[1].sensitive = not_being_edited;
context_menu[3].sensitive = have_selection;
}
- /* These settings are common for each context sensitive menu */
- context_menu[0].sensitive = not_being_edited;
- context_menu[1].sensitive = not_being_edited;
- context_menu[2].sensitive = not_being_edited;
}
for (i = 0; i < num_items; i++)
@@ -2581,6 +2589,7 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
EWeekView *week_view;
EWeekViewEvent *event;
GtkWidget *event_editor;
+ iCalObject *ico;
week_view = E_WEEK_VIEW (data);
@@ -2590,13 +2599,17 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
- event_editor = event_editor_new (week_view->calendar, event->ico);
+ /* We must duplicate the iCalObject, since the event editor will
+ change the fields. */
+ ico = ical_object_duplicate (event->ico);
+
+ event_editor = event_editor_new (week_view->calendar, ico);
gtk_widget_show (event_editor);
}
static void
-e_week_view_on_delete_occurance (GtkWidget *widget, gpointer data)
+e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
{
EWeekView *week_view;
EWeekViewEvent *event;
@@ -2648,15 +2661,21 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
- /* New object */
+ /* For the unrecurred instance we duplicate the original object,
+ create a new uid for it, get rid of the recurrence rules, and set
+ the start & end times to the instances times. */
ico = ical_object_duplicate (event->ico);
+ g_free (ico->uid);
+ ico->uid = ical_gen_uid ();
g_free (ico->recur);
ico->recur = 0;
ico->dtstart = event->start;
ico->dtend = event->end;
- /* Duplicate, and eliminate the recurrency fields */
+ /* For the recurring object, we add a exception to get rid of the
+ instance. */
ical_object_add_exdate (event->ico, event->start);
+
gnome_calendar_object_changed (week_view->calendar, event->ico,
CHANGE_ALL);
gnome_calendar_add_object (week_view->calendar, ico);