diff options
author | JP Rosevear <jpr@ximian.com> | 2004-05-03 21:12:33 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-05-03 21:12:33 +0800 |
commit | eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a (patch) | |
tree | 9d3787a73c884da7be46553d64816b5074835a40 | |
parent | 6aec39ddd634e28d61401295f0e5ec0a115ad62d (diff) | |
download | gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.tar gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.tar.gz gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.tar.bz2 gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.tar.lz gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.tar.xz gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.tar.zst gsoc2013-evolution-eef4d5c1a0c00b6d3d336de05d6e4aa33afaf53a.zip |
Fixes #57899
2004-05-03 JP Rosevear <jpr@ximian.com>
Fixes #57899
* gui/e-day-view.c (e_day_view_do_key_press): bail if the client
is read only (or we get an error trying to find out)
* gui/e-week-view.c (e_week_view_do_key_press): ditto
svn path=/trunk/; revision=25749
-rw-r--r-- | calendar/ChangeLog | 9 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 16 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 11 |
3 files changed, 31 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 650a7d8fd9..5cf2ecff63 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,14 @@ 2004-05-03 JP Rosevear <jpr@ximian.com> + Fixes #57899 + + * gui/e-day-view.c (e_day_view_do_key_press): bail if the client + is read only (or we get an error trying to find out) + + * gui/e-week-view.c (e_week_view_do_key_press): ditto + +2004-05-03 JP Rosevear <jpr@ximian.com> + Fixes #57894 * gui/gnome-cal.c (gnome_calendar_new_task): make sure we use the diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index b3f65de4b3..6a74ef4c28 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -4667,6 +4667,8 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) { EDayView *day_view; icalcomponent *icalcomp; + ECal *ecal; + ECalModel *model; ECalComponent *comp; gint day, event_num; gchar *initial_text; @@ -4677,7 +4679,8 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) struct icaltimetype start_tt, end_tt; const char *uid; AddEventData add_event_data; - + gboolean read_only = TRUE; + g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (E_IS_DAY_VIEW (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); @@ -4800,6 +4803,12 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) return FALSE; } + /* Check if the client is read only */ + model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); + ecal = e_cal_model_get_default_client (model); + if (!e_cal_is_read_only (ecal, &read_only, NULL) || read_only) + return FALSE; + /* We only want to start an edit with a return key or a simple character. */ if (keyval == GDK_Return) { @@ -4812,9 +4821,8 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) } else initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string); - /* Add a new event covering the selected range */ - - icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view))); + /* Add a new event covering the selected range */ + icalcomp = e_cal_model_create_component_with_defaults (model); if (!icalcomp) return FALSE; uid = icalcomponent_get_uid (icalcomp); diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 00dc957248..08589305b3 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3500,6 +3500,8 @@ static gboolean e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) { EWeekView *week_view; + ECal *ecal; + ECalModel *model; ECalComponent *comp; icalcomponent *icalcomp; gint event_num; @@ -3510,7 +3512,8 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) const char *uid; AddEventData add_event_data; guint keyval; - + gboolean read_only = TRUE; + g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); @@ -3545,6 +3548,12 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) if (week_view->selection_start_day == -1) return FALSE; + /* Check if the client is read only */ + model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); + ecal = e_cal_model_get_default_client (model); + if (!e_cal_is_read_only (ecal, &read_only, NULL) || read_only) + return FALSE; + /* We only want to start an edit with a return key or a simple character. */ if (event->keyval == GDK_Return) { |