check to see if the component is already on the server or not
2002-09-20 JP Rosevear <jpr@ximian.com> * gui/comp-util.c (cal_comp_is_on_server): check to see if the component is already on the server or not * gui/comp-util.h: change proto * gui/e-week-view.c (e_week_view_on_editing_stopped): only delete the event if the summary is empty and the component is not already on the server * gui/e-day-view.c (e_day_view_on_editing_stopped): same Fixes #14111 svn path=/trunk/; revision=18138
This commit is contained in:
@ -1,5 +1,20 @@
|
||||
2002-09-20 JP Rosevear <jpr@ximian.com>
|
||||
|
||||
* gui/comp-util.c (cal_comp_is_on_server): check to see if the
|
||||
component is already on the server or not
|
||||
|
||||
* gui/comp-util.h: change proto
|
||||
|
||||
* gui/e-week-view.c (e_week_view_on_editing_stopped): only delete
|
||||
the event if the summary is empty and the component is not already
|
||||
on the server
|
||||
|
||||
* gui/e-day-view.c (e_day_view_on_editing_stopped): same
|
||||
|
||||
Fixes #14111
|
||||
|
||||
2002-09-20 JP Rosevear <jpr@ximian.com>
|
||||
|
||||
* gui/dialogs/meeting-page.c (meeting_page_fill_widgets): set the
|
||||
deleted attendees array to size 0 after we clean it up
|
||||
|
||||
|
||||
@ -205,19 +205,17 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
|
||||
* was on the server and the user deleted it, or whether the
|
||||
* user cancelled the deletion.
|
||||
**/
|
||||
ConfirmDeleteEmptyCompResult
|
||||
cal_comp_confirm_delete_empty_comp (CalComponent *comp, CalClient *client, GtkWidget *widget)
|
||||
gboolean
|
||||
cal_comp_is_on_server (CalComponent *comp, CalClient *client)
|
||||
{
|
||||
const char *uid;
|
||||
CalClientGetStatus status;
|
||||
CalComponent *server_comp;
|
||||
|
||||
g_return_val_if_fail (comp != NULL, EMPTY_COMP_DO_NOT_REMOVE);
|
||||
g_return_val_if_fail (IS_CAL_COMPONENT (comp), EMPTY_COMP_DO_NOT_REMOVE);
|
||||
g_return_val_if_fail (client != NULL, EMPTY_COMP_DO_NOT_REMOVE);
|
||||
g_return_val_if_fail (IS_CAL_CLIENT (client), EMPTY_COMP_DO_NOT_REMOVE);
|
||||
g_return_val_if_fail (widget != NULL, EMPTY_COMP_DO_NOT_REMOVE);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), EMPTY_COMP_DO_NOT_REMOVE);
|
||||
g_return_val_if_fail (comp != NULL, FALSE);
|
||||
g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
|
||||
g_return_val_if_fail (client != NULL, FALSE);
|
||||
g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
|
||||
|
||||
/* See if the component is on the server. If it is not, then it likely
|
||||
* means that the appointment is new, only in the day view, and we
|
||||
@ -232,30 +230,22 @@ cal_comp_confirm_delete_empty_comp (CalComponent *comp, CalClient *client, GtkWi
|
||||
switch (status) {
|
||||
case CAL_CLIENT_GET_SUCCESS:
|
||||
gtk_object_unref (GTK_OBJECT (server_comp));
|
||||
/* Will handle confirmation below */
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case CAL_CLIENT_GET_SYNTAX_ERROR:
|
||||
g_message ("confirm_delete_empty_appointment(): Syntax error when getting "
|
||||
"object `%s'",
|
||||
uid);
|
||||
/* However, the object *is* in the server, so confirm */
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case CAL_CLIENT_GET_NOT_FOUND:
|
||||
return EMPTY_COMP_REMOVE_LOCALLY;
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* The event exists in the server, so confirm whether to delete it */
|
||||
|
||||
if (delete_component_dialog (comp, TRUE, 1, CAL_COMPONENT_EVENT, widget)) {
|
||||
cal_client_remove_object (client, uid);
|
||||
return EMPTY_COMP_REMOVED_FROM_SERVER;
|
||||
} else
|
||||
return EMPTY_COMP_DO_NOT_REMOVE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -36,15 +36,8 @@ gboolean cal_comp_util_compare_event_timezones (CalComponent *comp,
|
||||
CalClient *client,
|
||||
icaltimezone *zone);
|
||||
|
||||
typedef enum {
|
||||
EMPTY_COMP_REMOVE_LOCALLY,
|
||||
EMPTY_COMP_REMOVED_FROM_SERVER,
|
||||
EMPTY_COMP_DO_NOT_REMOVE
|
||||
} ConfirmDeleteEmptyCompResult;
|
||||
|
||||
ConfirmDeleteEmptyCompResult cal_comp_confirm_delete_empty_comp (CalComponent *comp,
|
||||
CalClient *client,
|
||||
GtkWidget *widget);
|
||||
gboolean cal_comp_is_on_server (CalComponent *comp,
|
||||
CalClient *client);
|
||||
|
||||
CalComponent *cal_comp_event_new_with_defaults (void);
|
||||
|
||||
|
||||
@ -6265,46 +6265,17 @@ e_day_view_on_editing_stopped (EDayView *day_view,
|
||||
NULL);
|
||||
g_assert (text != NULL);
|
||||
|
||||
if (string_is_empty (text)) {
|
||||
ConfirmDeleteEmptyCompResult result;
|
||||
|
||||
result = cal_comp_confirm_delete_empty_comp (event->comp, day_view->client,
|
||||
GTK_WIDGET (day_view));
|
||||
|
||||
switch (result) {
|
||||
case EMPTY_COMP_REMOVE_LOCALLY: {
|
||||
const char *uid;
|
||||
|
||||
cal_component_get_uid (event->comp, &uid);
|
||||
|
||||
e_day_view_foreach_event_with_uid (day_view, uid,
|
||||
e_day_view_remove_event_cb, NULL);
|
||||
e_day_view_check_layout (day_view);
|
||||
gtk_widget_queue_draw (day_view->top_canvas);
|
||||
gtk_widget_queue_draw (day_view->main_canvas);
|
||||
goto out; }
|
||||
|
||||
case EMPTY_COMP_REMOVED_FROM_SERVER:
|
||||
goto out;
|
||||
|
||||
case EMPTY_COMP_DO_NOT_REMOVE:
|
||||
/* But we cannot keep an empty summary, so make the
|
||||
* canvas item refresh itself from the text that the
|
||||
* component already had.
|
||||
*/
|
||||
|
||||
if (day == E_DAY_VIEW_LONG_EVENT)
|
||||
e_day_view_reshape_long_event (day_view, event_num);
|
||||
else
|
||||
e_day_view_update_event_label (day_view, day, event_num);
|
||||
|
||||
goto out;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
if (string_is_empty (text) && !cal_comp_is_on_server (event->comp, day_view->client)) {
|
||||
const char *uid;
|
||||
|
||||
cal_component_get_uid (event->comp, &uid);
|
||||
|
||||
e_day_view_foreach_event_with_uid (day_view, uid,
|
||||
e_day_view_remove_event_cb, NULL);
|
||||
e_day_view_check_layout (day_view);
|
||||
gtk_widget_queue_draw (day_view->top_canvas);
|
||||
gtk_widget_queue_draw (day_view->main_canvas);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Only update the summary if necessary. */
|
||||
|
||||
@ -3258,43 +3258,16 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
|
||||
NULL);
|
||||
g_assert (text != NULL);
|
||||
|
||||
if (string_is_empty (text)) {
|
||||
ConfirmDeleteEmptyCompResult result;
|
||||
|
||||
result = cal_comp_confirm_delete_empty_comp (event->comp, week_view->client,
|
||||
GTK_WIDGET (week_view));
|
||||
|
||||
switch (result) {
|
||||
case EMPTY_COMP_REMOVE_LOCALLY: {
|
||||
const char *uid;
|
||||
|
||||
cal_component_get_uid (event->comp, &uid);
|
||||
|
||||
e_week_view_foreach_event_with_uid (week_view, uid,
|
||||
e_week_view_remove_event_cb, NULL);
|
||||
gtk_widget_queue_draw (week_view->main_canvas);
|
||||
e_week_view_check_layout (week_view);
|
||||
goto out; }
|
||||
|
||||
case EMPTY_COMP_REMOVED_FROM_SERVER:
|
||||
goto out;
|
||||
|
||||
case EMPTY_COMP_DO_NOT_REMOVE:
|
||||
/* But we cannot keep an empty summary, so make the
|
||||
* canvas item refresh itself from the text that the
|
||||
* component already had.
|
||||
*/
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (event->comp));
|
||||
e_week_view_update_event_cb (week_view, event_num, event->comp);
|
||||
gtk_object_unref (GTK_OBJECT (event->comp));
|
||||
goto out;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
if (string_is_empty (text) && !cal_comp_is_on_server (event->comp, week_view->client)) {
|
||||
const char *uid;
|
||||
|
||||
cal_component_get_uid (event->comp, &uid);
|
||||
|
||||
e_week_view_foreach_event_with_uid (week_view, uid,
|
||||
e_week_view_remove_event_cb, NULL);
|
||||
gtk_widget_queue_draw (week_view->main_canvas);
|
||||
e_week_view_check_layout (week_view);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Only update the summary if necessary. */
|
||||
|
||||
Reference in New Issue
Block a user