aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-05-17 00:41:35 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-05-17 00:41:35 +0800
commit48140af35f90d7ec4f994821a5265b1fe0159cfa (patch)
treedd2bde3e78c4fd5db7a97dbb754b59edf66bbb4e /calendar/gui
parentaad3ac6ddd62d5cd1b3421f5bf45ccdcf1b0ed35 (diff)
downloadgsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.gz
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.bz2
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.lz
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.xz
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.zst
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.zip
added PermissionDenied exception and make it be raised in open,
2002-05-16 Rodrigo Moya <rodrigo@ximian.com> * idl/evolution-calendar.idl: added PermissionDenied exception and make it be raised in open, updateObjects and removeObject. * pcs/cal-backend.h: added CAL_BACKEND_OPEN_PERMISSION_DENIED to CalBackendOpenStatus enumeration, added CalBackendResult enumeration. * pcs/cal.c: * pcs/cal-backend.c: * pcs/cal-backend-file.c: adapted to changes in update_objects and remove_object methods. * cal-client/cal-client.[ch]: added CalClientResult enumeration. (cal_client_update_object, cal_client_update_objects, cal_client_remove_object): changed to return a CalClientResult. * conduits/calendar/calendar-conduit.c: * calendar/conduits/todo/todo-conduit.c: * importers/icalendar-importer.c: * gui/dialogs/comp-editor.c: * gui/calendar-model.c: * gui/e-calendar-table.c: * gui/e-day-view.c: * gui/e-itip-control.c: * gui/e-week-view.c: * gui/comp-util.c: * gui/e-tasks.c: * gui/tasks-migrate.c: adapted to changes in cal_client_update_object(s) and cal_client_remove_object. svn path=/trunk/; revision=16932
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-model.c6
-rw-r--r--calendar/gui/dialogs/comp-editor.c23
-rw-r--r--calendar/gui/e-day-view.c18
-rw-r--r--calendar/gui/e-itip-control.c49
-rw-r--r--calendar/gui/e-week-view.c8
-rw-r--r--calendar/gui/tasks-migrate.c2
6 files changed, 81 insertions, 25 deletions
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index e8317402ac..927b986212 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -1320,7 +1320,7 @@ calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *val
return;
}
- if (!cal_client_update_object (priv->client, comp))
+ if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("calendar_model_set_value_at(): Could not update the object!");
}
@@ -1399,7 +1399,7 @@ calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row)
set_complete (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETE, row));
set_status (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_STATUS, row));
- if (!cal_client_update_object (priv->client, comp)) {
+ if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS) {
/* FIXME: Show error dialog. */
g_message ("calendar_model_append_row(): Could not add new object!");
}
@@ -2270,7 +2270,7 @@ calendar_model_mark_task_complete (CalendarModel *model,
ensure_task_complete (comp, -1);
- if (!cal_client_update_object (priv->client, comp))
+ if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("calendar_model_mark_task_complete(): Could not update the object!");
}
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index cad55ebf08..05710b7581 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -297,6 +297,7 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CalComponent *clone;
GList *l;
+ CalClientResult result;
priv = editor->priv;
@@ -316,11 +317,29 @@ save_comp (CompEditor *editor)
priv->updating = TRUE;
- if (!cal_client_update_object (priv->client, priv->comp)) {
+ result = cal_client_update_object (priv->client, priv->comp);
+ if (result != CAL_CLIENT_RESULT_SUCCESS) {
GtkWidget *dlg;
+ char *msg;
+
+ switch (result) {
+ case CAL_CLIENT_RESULT_INVALID_OBJECT :
+ msg = g_strdup (_("Could not update invalid object"));
+ break;
+ case CAL_CLIENT_RESULT_NOT_FOUND :
+ msg = g_strdup (_("Object not found, not updated"));
+ break;
+ case CAL_CLIENT_RESULT_PERMISSION_DENIED :
+ msg = g_strdup (_("You don't have permissions to update this object"));
+ break;
+ default :
+ msg = g_strdup (_("Could not update object"));
+ break;
+ }
- dlg = gnome_error_dialog (_("Could not update object!"));
+ dlg = gnome_error_dialog (msg);
gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+ g_free (msg);
return FALSE;
} else {
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 2a346cdbf9..d305190352 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -3996,7 +3996,7 @@ e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
comp = cal_component_clone (event->comp);
cal_comp_util_add_exdate (comp, event->start, day_view->zone);
- if (!cal_client_update_object (day_view->client, comp))
+ if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
@@ -4172,12 +4172,12 @@ e_day_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
/* Now update both CalComponents. Note that we do this last since at
* present the updates happen synchronously so our event may disappear.
*/
- if (!cal_client_update_object (day_view->client, comp))
+ if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
- if (!cal_client_update_object (day_view->client, new_comp))
+ if (cal_client_update_object (day_view->client, new_comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (new_comp));
@@ -4712,7 +4712,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
- if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
@@ -4773,7 +4773,7 @@ e_day_view_finish_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
- if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
@@ -6116,7 +6116,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
summary.altrep = NULL;
cal_component_set_summary (event->comp, &summary);
- if (cal_client_update_object (day_view->client, event->comp)) {
+ if (cal_client_update_object (day_view->client, event->comp) == CAL_CLIENT_RESULT_SUCCESS) {
if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp,
day_view->client, NULL);
@@ -7165,7 +7165,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_client_update_object (day_view->client, comp)
+ == CAL_CLIENT_RESULT_SUCCESS) {
if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
day_view->client, NULL);
@@ -7278,7 +7279,8 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_client_update_object (day_view->client, comp)
+ == CAL_CLIENT_RESULT_SUCCESS) {
if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
day_view->client, NULL);
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index f8cfe2fea3..75be4d098d 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -1548,6 +1548,7 @@ update_item (EItipControl *itip)
CalClient *client;
CalComponentVType type;
GtkWidget *dialog;
+ CalClientResult result;
priv = itip->priv;
@@ -1560,10 +1561,27 @@ update_item (EItipControl *itip)
clone = icalcomponent_new_clone (priv->ical_comp);
icalcomponent_add_component (priv->top_level, clone);
- if (!cal_client_update_objects (client, priv->top_level))
- dialog = gnome_warning_dialog (_("Calendar file could not be updated!\n"));
- else
+ result = cal_client_update_objects (client, priv->top_level);
+ switch (result) {
+ case CAL_CLIENT_RESULT_INVALID_OBJECT :
+ dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
+ break;
+ case CAL_CLIENT_RESULT_CORBA_ERROR :
+ dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n"));
+ break;
+ case CAL_CLIENT_RESULT_NOT_FOUND :
+ dialog = gnome_warning_dialog (_("Object could not be found\n"));
+ break;
+ case CAL_CLIENT_RESULT_PERMISSION_DENIED :
+ dialog = gnome_warning_dialog (_("You don't have permissions to update the calendar\n"));
+ break;
+ case CAL_CLIENT_RESULT_SUCCESS :
dialog = gnome_ok_dialog (_("Update complete\n"));
+ break;
+ default :
+ dialog = gnome_warning_dialog (_("Calendar file could not be updated!\n"));
+ break;
+ }
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
icalcomponent_remove_component (priv->top_level, clone);
@@ -1579,6 +1597,7 @@ update_attendee_status (EItipControl *itip)
CalComponentVType type;
const char *uid;
GtkWidget *dialog;
+ CalClientResult result;
priv = itip->priv;
@@ -1634,10 +1653,26 @@ update_attendee_status (EItipControl *itip)
}
}
- if (!cal_client_update_object (client, comp))
- dialog = gnome_warning_dialog (_("Attendee status could not be updated!\n"));
- else
+ result = cal_client_update_object (client, comp);
+ switch (result) {
+ case CAL_CLIENT_RESULT_INVALID_OBJECT :
+ dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
+ break;
+ case CAL_CLIENT_RESULT_CORBA_ERROR :
+ dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n"));
+ break;
+ case CAL_CLIENT_RESULT_NOT_FOUND :
+ dialog = gnome_warning_dialog (_("Object could not be found\n"));
+ break;
+ case CAL_CLIENT_RESULT_PERMISSION_DENIED :
+ dialog = gnome_warning_dialog (_("You don't have permissions to update the calendar\n"));
+ break;
+ case CAL_CLIENT_RESULT_SUCCESS :
dialog = gnome_ok_dialog (_("Attendee status updated\n"));
+ break;
+ default :
+ dialog = gnome_warning_dialog (_("Attendee status could not be updated!\n"));
+ }
} else {
dialog = gnome_warning_dialog (_("Attendee status can not be updated "
"because the item no longer exists"));
@@ -1670,7 +1705,7 @@ remove_item (EItipControl *itip)
return;
cal_component_get_uid (priv->comp, &uid);
- if (cal_client_remove_object (client, uid)) {
+ if (cal_client_remove_object (client, uid) == CAL_CLIENT_RESULT_SUCCESS) {
dialog = gnome_ok_dialog (_("Removal Complete"));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index f0913e3e28..514558cc58 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3216,7 +3216,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
summary.altrep = NULL;
cal_component_set_summary (event->comp, &summary);
- if (cal_client_update_object (week_view->client, event->comp)) {
+ if (cal_client_update_object (week_view->client, event->comp) == CAL_CLIENT_RESULT_SUCCESS) {
if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp,
week_view->client, NULL);
@@ -3870,7 +3870,7 @@ e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
comp = cal_component_clone (event->comp);
cal_comp_util_add_exdate (comp, event->start, week_view->zone);
- if (!cal_client_update_object (week_view->client, comp))
+ if (cal_client_update_object (week_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_week_view_on_delete_occurrence(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
@@ -4030,12 +4030,12 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
/* Now update both CalComponents. Note that we do this last since at
present the updates happen synchronously so our event may disappear.
*/
- if (!cal_client_update_object (week_view->client, comp))
+ if (cal_client_update_object (week_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
- if (!cal_client_update_object (week_view->client, new_comp))
+ if (cal_client_update_object (week_view->client, new_comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (new_comp));
diff --git a/calendar/gui/tasks-migrate.c b/calendar/gui/tasks-migrate.c
index 5c9a4fa7c5..c6c6309528 100644
--- a/calendar/gui/tasks-migrate.c
+++ b/calendar/gui/tasks-migrate.c
@@ -75,7 +75,7 @@ migrate (void)
switch (status) {
case CAL_CLIENT_GET_SUCCESS:
- if (cal_client_update_object (tasks_client, comp))
+ if (cal_client_update_object (tasks_client, comp) == CAL_CLIENT_RESULT_SUCCESS)
cal_client_remove_object (calendar_client, uid);
else
success = FALSE;