aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-commands.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2004-03-05 00:46:27 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-03-05 00:46:27 +0800
commitc5a4a13b1ba9b689dd0aab9c848584005a3ef551 (patch)
treec3a6d4df45581fe9393f1971d55b000cd07f4be5 /calendar/gui/calendar-commands.c
parent967a116256c6c79ca9794e3a0e9c13ce02c95f2f (diff)
downloadgsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.tar
gsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.tar.gz
gsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.tar.bz2
gsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.tar.lz
gsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.tar.xz
gsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.tar.zst
gsoc2013-evolution-c5a4a13b1ba9b689dd0aab9c848584005a3ef551.zip
set the sensitivity correctly, depending on whether the command applied to
2004-03-04 Rodrigo Moya <rodrigo@ximian.com> * 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
Diffstat (limited to 'calendar/gui/calendar-commands.c')
-rw-r--r--calendar/gui/calendar-commands.c34
1 files changed, 18 insertions, 16 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);