aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog17
-rw-r--r--calendar/cal-client/cal-client.c2
-rw-r--r--calendar/gui/calendar-commands.c16
-rw-r--r--calendar/gui/dialogs/event-editor.c21
-rw-r--r--calendar/gui/dialogs/task-editor.c19
-rw-r--r--calendar/gui/e-calendar-table.c18
-rw-r--r--calendar/gui/e-day-view.c17
-rw-r--r--calendar/gui/e-week-view.c23
-rw-r--r--calendar/gui/tasks-control.c15
9 files changed, 106 insertions, 42 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index ebc7cbfb3b..8755ef8fac 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,20 @@
+2002-10-02 Rodrigo Moya <rodrigo@ximian.com>
+
+ Fixes #30057
+
+ * cal-client/cal-client.c (cal_client_is_read_only): added check
+ of the status of the client before trying to make CORBA calls.
+
+ * gui/calendar-commands.c (sensitize_calendar_commands,
+ sensitize_taskpad_commands):
+ * gui/tasks-control.c (sensitize_commands):
+ * gui/dialogs/event-editor.c (set_menu_sens):
+ * gui/dialogs/task-editor.c (set_menu_sens):
+ * gui/e-calendar-table.c (e_calendar_table_on_right_click):
+ * gui/e-day-view.c (e_day_view_on_event_right_click):
+ * gui/e-week-view.c (e_week_view_show_popup_menu): take into account
+ the read-onlyness of clients to disable/enable menu items.
+
2002-10-01 Rodrigo Moya <rodrigo@ximian.com>
* idl/evolution-calendar.idl: added isReadOnly method to Cal
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 0f270c05bc..ae4ab40c94 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -1039,6 +1039,8 @@ cal_client_is_read_only (CalClient *client)
priv = client->priv;
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE);
+
CORBA_exception_init (&ev);
read_only = GNOME_Evolution_Calendar_Cal_isReadOnly (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 0dec149adf..d288b8e77c 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -506,23 +506,25 @@ sensitize_calendar_commands (GnomeCalendar *gcal, BonoboControl *control, gboole
{
BonoboUIComponent *uic;
int n_selected;
+ gboolean read_only;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
n_selected = enable ? gnome_calendar_get_num_events_selected (gcal) : 0;
+ read_only = cal_client_is_read_only (gnome_calendar_get_cal_client (gcal));
bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || 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 ? "1" : "0",
+ enable && !read_only ? "1" : "0",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/Delete", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || read_only ? "0" : "1",
NULL);
}
@@ -535,23 +537,25 @@ sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolea
{
BonoboUIComponent *uic;
int n_selected;
+ gboolean read_only;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
n_selected = enable ? gnome_calendar_get_num_tasks_selected (gcal) : 0;
+ read_only = cal_client_is_read_only (gnome_calendar_get_task_pad_cal_client (gcal));
bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || 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 ? "1" : "0",
+ enable && !read_only ? "1" : "0",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/Delete", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || read_only ? "0" : "1",
NULL);
}
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 4ee2556d97..829bebbe1e 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -141,27 +141,38 @@ static void
set_menu_sens (EventEditor *ee)
{
EventEditorPrivate *priv;
- gboolean sens, existing, user;
+ gboolean sens, existing, user, read_only;
priv = ee->priv;
existing = comp_editor_get_existing_org (COMP_EDITOR (ee));
user = comp_editor_get_user_org (COMP_EDITOR (ee));
+ read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)));
sens = priv->meeting_shown;
comp_editor_set_ui_prop (COMP_EDITOR (ee),
"/commands/ActionScheduleMeeting",
- "sensitive", sens ? "0" : "1");
+ "sensitive", sens || read_only ? "0" : "1");
- sens = priv->meeting_shown && existing && !user;
+ sens = priv->meeting_shown && existing && !user && !read_only;
comp_editor_set_ui_prop (COMP_EDITOR (ee),
"/commands/ActionRefreshMeeting",
"sensitive", sens ? "1" : "0");
- sens = priv->meeting_shown && existing && user;
+ sens = priv->meeting_shown && existing && user && !read_only;
comp_editor_set_ui_prop (COMP_EDITOR (ee),
"/commands/ActionCancelMeeting",
- "sensitive", sens ? "1" : "0");
+ "sensitive", sens? "1" : "0");
+
+ comp_editor_set_ui_prop (COMP_EDITOR (ee),
+ "/commands/FileSave",
+ "sensitive", read_only ? "0" : "1");
+ comp_editor_set_ui_prop (COMP_EDITOR (ee),
+ "/commands/FileSaveAndClose",
+ "sensitive", read_only ? "0" : "1");
+ comp_editor_set_ui_prop (COMP_EDITOR (ee),
+ "/commands/FileDelete",
+ "sensitive", read_only ? "0" : "1");
}
static void
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index e3c55ffe29..6a95013370 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -129,27 +129,38 @@ static void
set_menu_sens (TaskEditor *te)
{
TaskEditorPrivate *priv;
- gboolean sens, existing, user;
+ gboolean sens, existing, user, read_only;
priv = te->priv;
existing = comp_editor_get_existing_org (COMP_EDITOR (te));
user = comp_editor_get_user_org (COMP_EDITOR (te));
+ read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)));
- sens = priv->assignment_shown;
+ sens = priv->assignment_shown || read_only;
comp_editor_set_ui_prop (COMP_EDITOR (te),
"/commands/ActionAssignTask",
"sensitive", sens ? "0" : "1");
- sens = priv->assignment_shown && existing && !user;
+ sens = priv->assignment_shown && existing && !user && !read_only;
comp_editor_set_ui_prop (COMP_EDITOR (te),
"/commands/ActionRefreshTask",
"sensitive", sens ? "1" : "0");
- sens = priv->assignment_shown && existing && user;
+ sens = priv->assignment_shown && existing && user && !read_only;
comp_editor_set_ui_prop (COMP_EDITOR (te),
"/commands/ActionCancelTask",
"sensitive", sens ? "1" : "0");
+
+ comp_editor_set_ui_prop (COMP_EDITOR (te),
+ "/commands/FileSave",
+ "sensitive", read_only ? "0" : "1");
+ comp_editor_set_ui_prop (COMP_EDITOR (te),
+ "/commands/FileSaveAndClose",
+ "sensitive", read_only ? "0" : "1");
+ comp_editor_set_ui_prop (COMP_EDITOR (te),
+ "/commands/FileDelete",
+ "sensitive", read_only ? "0" : "1");
}
static void
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 91786ea389..f4ccea596c 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -979,6 +979,7 @@ delete_cb (GtkWidget *menuitem, gpointer data)
enum {
MASK_SINGLE = 1 << 0, /* For commands that work on 1 task. */
MASK_MULTIPLE = 1 << 1, /* For commands for multiple tasks. */
+ MASK_EDITABLE = 1 << 2 /* For commands disabled in read-only folders */
};
@@ -989,21 +990,21 @@ static EPopupMenu tasks_popup_menu [] = {
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("C_ut"), e_calendar_table_on_cut, 0),
+ E_POPUP_ITEM (N_("C_ut"), e_calendar_table_on_cut, MASK_EDITABLE),
E_POPUP_ITEM (N_("_Copy"), e_calendar_table_on_copy, 0),
- E_POPUP_ITEM (N_("_Paste"), e_calendar_table_on_paste, 0),
+ E_POPUP_ITEM (N_("_Paste"), e_calendar_table_on_paste, MASK_EDITABLE),
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Assign Task"), e_calendar_table_on_assign, MASK_SINGLE),
+ E_POPUP_ITEM (N_("_Assign Task"), e_calendar_table_on_assign, MASK_SINGLE | MASK_EDITABLE),
E_POPUP_ITEM (N_("_Forward as iCalendar"), e_calendar_table_on_forward, MASK_SINGLE),
- E_POPUP_ITEM (N_("_Mark as Complete"), mark_as_complete_cb, MASK_SINGLE),
- E_POPUP_ITEM (N_("_Mark Selected Tasks as Complete"), mark_as_complete_cb, MASK_MULTIPLE),
+ E_POPUP_ITEM (N_("_Mark as Complete"), mark_as_complete_cb, MASK_SINGLE | MASK_EDITABLE),
+ E_POPUP_ITEM (N_("_Mark Selected Tasks as Complete"), mark_as_complete_cb, MASK_MULTIPLE | MASK_EDITABLE),
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Delete"), delete_cb, MASK_SINGLE),
- E_POPUP_ITEM (N_("_Delete Selected Tasks"), delete_cb, MASK_MULTIPLE),
+ E_POPUP_ITEM (N_("_Delete"), delete_cb, MASK_SINGLE | MASK_EDITABLE),
+ E_POPUP_ITEM (N_("_Delete Selected Tasks"), delete_cb, MASK_MULTIPLE | MASK_EDITABLE),
E_POPUP_TERMINATOR
};
@@ -1028,6 +1029,9 @@ e_calendar_table_on_right_click (ETable *table,
else
hide_mask = MASK_SINGLE;
+ if (cal_client_is_read_only (calendar_model_get_cal_client (e_calendar_table_get_model (cal_table))))
+ disable_mask |= MASK_EDITABLE;
+
e_popup_menu_run (tasks_popup_menu, (GdkEvent *) event,
disable_mask, hide_mask, cal_table);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 5c91e54832..9f1ef62a6f 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -3705,13 +3705,13 @@ enum {
static EPopupMenu main_items [] = {
E_POPUP_ITEM (N_("New _Appointment"),
- e_day_view_on_new_appointment, 0),
+ e_day_view_on_new_appointment, MASK_EDITABLE),
E_POPUP_ITEM (N_("New All Day _Event"),
- e_day_view_on_new_event, 0),
+ e_day_view_on_new_event, MASK_EDITABLE),
E_POPUP_ITEM (N_("New Meeting"),
- e_day_view_on_new_meeting, 0),
+ e_day_view_on_new_meeting, MASK_EDITABLE),
E_POPUP_ITEM (N_("New Task"),
- e_day_view_on_new_task, 0),
+ e_day_view_on_new_task, MASK_EDITABLE),
E_POPUP_SEPARATOR,
@@ -3721,7 +3721,7 @@ static EPopupMenu main_items [] = {
E_POPUP_SEPARATOR,
E_POPUP_ITEM (N_("_Paste"),
- e_day_view_on_paste, 0),
+ e_day_view_on_paste, MASK_EDITABLE),
E_POPUP_SEPARATOR,
@@ -3749,7 +3749,7 @@ static EPopupMenu main_items [] = {
static EPopupMenu child_items [] = {
- E_POPUP_ITEM (N_("_Open"), e_day_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING),
+ E_POPUP_ITEM (N_("_Open"), e_day_view_on_edit_appointment, MASK_EDITING),
E_POPUP_ITEM (N_("_Save As..."), e_day_view_on_save_as, MASK_EDITING),
E_POPUP_ITEM (N_("_Print..."), e_day_view_on_print_event, MASK_EDITING),
@@ -3758,7 +3758,7 @@ static EPopupMenu child_items [] = {
E_POPUP_ITEM (N_("C_ut"), e_day_view_on_cut, MASK_EDITABLE | MASK_EDITING | MASK_MEETING_ORGANIZER),
E_POPUP_ITEM (N_("_Copy"), e_day_view_on_copy, MASK_EDITING | MASK_MEETING_ORGANIZER),
- E_POPUP_ITEM (N_("_Paste"), e_day_view_on_paste, 0),
+ E_POPUP_ITEM (N_("_Paste"), e_day_view_on_paste, MASK_EDITABLE),
E_POPUP_SEPARATOR,
@@ -3840,6 +3840,9 @@ e_day_view_on_event_right_click (EDayView *day_view,
}
}
+ if (cal_client_is_read_only (day_view->client))
+ disable_mask |= MASK_EDITABLE;
+
if (being_edited)
disable_mask |= MASK_EDITING;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index a10388bed9..084d33c414 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3512,10 +3512,10 @@ enum {
};
static EPopupMenu main_items [] = {
- E_POPUP_ITEM (N_("New _Appointment..."), e_week_view_on_new_appointment, 0),
- E_POPUP_ITEM (N_("New All Day _Event"), e_week_view_on_new_event, 0),
- E_POPUP_ITEM (N_("New Meeting"), e_week_view_on_new_meeting, 0),
- E_POPUP_ITEM (N_("New Task"), e_week_view_on_new_task, 0),
+ E_POPUP_ITEM (N_("New _Appointment..."), e_week_view_on_new_appointment, MASK_EDITABLE),
+ E_POPUP_ITEM (N_("New All Day _Event"), e_week_view_on_new_event, MASK_EDITABLE),
+ E_POPUP_ITEM (N_("New Meeting"), e_week_view_on_new_meeting, MASK_EDITABLE),
+ E_POPUP_ITEM (N_("New Task"), e_week_view_on_new_task, MASK_EDITABLE),
E_POPUP_SEPARATOR,
@@ -3523,7 +3523,7 @@ static EPopupMenu main_items [] = {
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0),
+ E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, MASK_EDITABLE),
E_POPUP_SEPARATOR,
@@ -3545,7 +3545,7 @@ static EPopupMenu main_items [] = {
};
static EPopupMenu child_items [] = {
- E_POPUP_ITEM (N_("_Open"), e_week_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING),
+ E_POPUP_ITEM (N_("_Open"), e_week_view_on_edit_appointment, MASK_EDITING),
E_POPUP_ITEM (N_("_Save As..."), e_week_view_on_save_as, MASK_EDITING),
E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print_event, MASK_EDITING),
@@ -3554,7 +3554,7 @@ static EPopupMenu child_items [] = {
E_POPUP_ITEM (N_("C_ut"), e_week_view_on_cut, MASK_EDITING | MASK_EDITABLE | MASK_MEETING_ORGANIZER),
E_POPUP_ITEM (N_("_Copy"), e_week_view_on_copy, MASK_EDITING | MASK_MEETING_ORGANIZER),
- E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0),
+ E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, MASK_EDITABLE),
E_POPUP_SEPARATOR,
@@ -3564,9 +3564,9 @@ static EPopupMenu child_items [] = {
E_POPUP_SEPARATOR,
E_POPUP_ITEM (N_("_Delete"), e_week_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_week_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete this _Occurrence"), e_week_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete _All Occurrences"), e_week_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING),
+ E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_week_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
+ E_POPUP_ITEM (N_("Delete this _Occurrence"), e_week_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
+ E_POPUP_ITEM (N_("Delete _All Occurrences"), e_week_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
E_POPUP_TERMINATOR
};
@@ -3627,6 +3627,9 @@ e_week_view_show_popup_menu (EWeekView *week_view,
}
}
+ if (cal_client_is_read_only (week_view->client))
+ disable_mask |= MASK_EDITABLE;
+
if (being_edited)
disable_mask |= MASK_EDITING;
week_view->popup_event_num = event_num;
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 1c7bc82b69..0f0166833c 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -230,21 +230,30 @@ static void
sensitize_commands (ETasks *tasks, BonoboControl *control, int n_selected)
{
BonoboUIComponent *uic;
+ gboolean read_only;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
+ read_only = cal_client_is_read_only (e_tasks_get_cal_client (tasks));
+
bonobo_ui_component_set_prop (uic, "/commands/TasksCut", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || read_only ? "0" : "1",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/TasksCopy", "sensitive",
n_selected == 0 ? "0" : "1",
NULL);
+ bonobo_ui_component_set_prop (uic, "/commands/TasksPaste", "sensitive",
+ n_selected == 0 || read_only ? "0" : "1",
+ NULL);
bonobo_ui_component_set_prop (uic, "/commands/TasksDelete", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || read_only ? "0" : "1",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/TasksMarkComplete", "sensitive",
- n_selected == 0 ? "0" : "1",
+ n_selected == 0 || read_only ? "0" : "1",
+ NULL);
+ bonobo_ui_component_set_prop (uic, "/commands/TasksExpunge", "sensitive",
+ read_only ? "0" : "1",
NULL);
}