From c5a4a13b1ba9b689dd0aab9c848584005a3ef551 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 4 Mar 2004 16:46:27 +0000 Subject: set the sensitivity correctly, depending on whether the command applied to 2004-03-04 Rodrigo Moya * gui/calendar-commands.c (calendar_control_sensitize_calendar_commands): set the sensitivity correctly, depending on whether the command applied to the currently selected event or the default client. (calendar_control_activate): make sure we start with the menu items correctly enabled/disabled. svn path=/trunk/; revision=24968 --- calendar/ChangeLog | 8 ++++++++ calendar/gui/calendar-commands.c | 34 ++++++++++++++++++---------------- calendar/gui/gnome-cal.c | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 46dd8e7f0e..ed8c651f4c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2004-03-04 Rodrigo Moya + + * gui/calendar-commands.c (calendar_control_sensitize_calendar_commands): + set the sensitivity correctly, depending on whether the command applied + to the currently selected event or the default client. + (calendar_control_activate): make sure we start with the menu items + correctly enabled/disabled. + 2004-03-04 Rodrigo Moya Fixes #53496 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); } -- cgit v1.2.3