diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar-commands.c | 34 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 2 |
2 files changed, 19 insertions, 17 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 5058b1c66a..efc33cf040 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -498,7 +498,7 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen int n_selected; GtkWidget *view; ECal *e_cal; - gboolean read_only = FALSE, has_recurrences; + gboolean selected_read_only = FALSE, default_read_only = FALSE, has_recurrences; uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); @@ -512,35 +512,37 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen n_selected = enable ? g_list_length (list) : 0; event = (ECalendarViewEvent *) list ? list->data : NULL; - if (event) { - e_cal_is_read_only (event->comp_data->client, &read_only, NULL); - } else { - e_cal = e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)); - if (e_cal) - e_cal_is_read_only (e_cal, &read_only, NULL); - else - read_only = TRUE; - } + if (event) + e_cal_is_read_only (event->comp_data->client, &selected_read_only, NULL); + else + selected_read_only = TRUE; + + /* retrieve read-onlyness of the default client */ + e_cal = e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)); + if (e_cal) + e_cal_is_read_only (e_cal, &default_read_only, NULL); + else + default_read_only = TRUE; bonobo_ui_component_set_prop (uic, "/commands/EventOpen", "sensitive", n_selected != 1 ? "0" : "1", NULL); bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive", - n_selected == 0 || read_only ? "0" : "1", + n_selected == 0 || selected_read_only ? "0" : "1", NULL); bonobo_ui_component_set_prop (uic, "/commands/Copy", "sensitive", n_selected == 0 ? "0" : "1", NULL); bonobo_ui_component_set_prop (uic, "/commands/Paste", "sensitive", - enable && !read_only ? "1" : "0", + default_read_only ? "0" : "1", NULL); bonobo_ui_component_set_prop (uic, "/commands/Delete", "sensitive", - n_selected == 0 || read_only ? "0" : "1", + n_selected == 0 || selected_read_only ? "0" : "1", NULL); /* occurrence-related menu items */ has_recurrences = FALSE; - if (n_selected > 0 && !read_only) { + if (n_selected > 0 && !selected_read_only) { if (list) { event = (ECalendarViewEvent *) list->data; if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) @@ -752,8 +754,8 @@ calendar_control_activate (BonoboControl *control, g_signal_connect (gcal, "taskpad_focus_change", G_CALLBACK (gcal_taskpad_focus_change_cb), control); - calendar_control_sensitize_calendar_commands (control, gcal, FALSE); - sensitize_taskpad_commands (gcal, control, FALSE); + calendar_control_sensitize_calendar_commands (control, gcal, TRUE); + sensitize_taskpad_commands (gcal, control, TRUE); bonobo_ui_component_thaw (uic, NULL); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 8afd6e7186..381a2fe274 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1767,7 +1767,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) /* add client to the views */ for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { ECalModel *model; - + model = e_calendar_view_get_model (priv->views[i]); e_cal_model_add_client (model, ecal); } |