Re: [evolution-patches] 37552



On Thu, 2003-04-24 at 14:01, Rodrigo Moya wrote:
> On Thu, 2003-04-24 at 19:47, JP Rosevear wrote:
> > Fixes the gui bits.  Note that this breaks the string freeze.  I don't
> > see a way around this though if we have to have gui warnings for the
> > user.
> >
> apart from the comments in delete_error_dialog and the #ifndef in
> delete-error-dialog.h (which seem to have been copy/pasted from
> send_comp), it looks ok.

Updated patch attached.

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.
? 37552.patch
? conduit-libs.patch
? e-meeting.diff
? size.patch
? gui/org-attendee.patch
? gui/pane.patch
? gui/paned.patch
? gui/tmp.patch
? gui/warning.patch
? gui/dialogs/Evolution-Addressbook-SelectNames-common.c
? gui/dialogs/Evolution-Addressbook-SelectNames-skels.c
? gui/dialogs/Evolution-Addressbook-SelectNames-stubs.c
? gui/dialogs/alarm-options.gladep
? gui/dialogs/event-page.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1745
diff -u -r1.1745 ChangeLog
--- ChangeLog	23 Apr 2003 22:03:56 -0000	1.1745
+++ ChangeLog	24 Apr 2003 18:47:08 -0000
@@ -1,3 +1,23 @@
+2003-04-24  JP Rosevear  <jpr ximian com>
+
+	Fixes #37552
+	
+	* gui/dialogs/Makefile.am: build delete-error.[hc]
+
+	* gui/e-tasks.c: wrap calls to cal_client_remove_object with
+	delete_error_dialog
+
+	* gui/e-itip-control.c: ditto
+
+	* gui/e-calendar-table.c: ditto
+
+	* gui/e-week-view.c: ditto
+
+	* gui/e-day-view.c: ditto
+
+	* gui/dialogs/delete-error.[hc]: gemerate an error message based
+	on result
+
 2003-04-23  Hans Petter Jansson  <hpj ximian com>
 
 	Fixes #41641
Index: conduits/calendar/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/Makefile.am,v
retrieving revision 1.28
diff -u -r1.28 Makefile.am
--- conduits/calendar/Makefile.am	27 Feb 2003 23:06:01 -0000	1.28
+++ conduits/calendar/Makefile.am	24 Apr 2003 18:47:08 -0000
@@ -23,7 +23,7 @@
 	$(top_builddir)/libversit/libversit.la				\
 	$(top_builddir)/libical/src/libical/libical-static.la		\
 	$(top_builddir)/libwombat/libwombat-static.la		 	\
-	$(top_builddir)/e-util/libeconduit-static.la	 		\
+	$(top_builddir)/e-util/libeconduit.la	 			\
 	$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
 
 e-calendar.conduit: e-calendar.conduit.in Makefile
Index: conduits/todo/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/todo/Makefile.am,v
retrieving revision 1.28
diff -u -r1.28 Makefile.am
--- conduits/todo/Makefile.am	27 Feb 2003 23:06:01 -0000	1.28
+++ conduits/todo/Makefile.am	24 Apr 2003 18:47:08 -0000
@@ -23,7 +23,7 @@
 	$(top_builddir)/libversit/libversit.la				\
 	$(top_builddir)/libical/src/libical/libical-static.la		\
 	$(top_builddir)/libwombat/libwombat-static.la	 		\
-	$(top_builddir)/e-util/libeconduit-static.la	 		\
+	$(top_builddir)/e-util/libeconduit.la		 		\
 	$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
 
 e-todo.conduit: e-todo.conduit.in Makefile
Index: gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.87
diff -u -r1.87 e-calendar-table.c
--- gui/e-calendar-table.c	11 Apr 2003 10:41:36 -0000	1.87
+++ gui/e-calendar-table.c	24 Apr 2003 18:47:09 -0000
@@ -48,6 +48,7 @@
 #include "calendar-model.h"
 #include "print.h"
 #include "dialogs/delete-comp.h"
+#include "dialogs/delete-error.h"
 #include "dialogs/task-editor.h"
 
 /* Pixmaps. */
@@ -716,13 +717,10 @@
 
 	for (l = uids; l; l = l->next) {
 		const char *uid;
-
+		
 		uid = l->data;
 
-		/* We don't check the return value; FALSE can mean the object
-		 * was not in the server anyways.
-		 */
-		cal_client_remove_object (client, uid);
+		delete_error_dialog (cal_client_remove_object (client, uid), CAL_COMPONENT_TODO);
 	}
 
 	calendar_model_set_status_message (e_calendar_table_get_model (cal_table), NULL);
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.187
diff -u -r1.187 e-day-view.c
--- gui/e-day-view.c	23 Apr 2003 22:03:57 -0000	1.187
+++ gui/e-day-view.c	24 Apr 2003 18:47:11 -0000
@@ -54,6 +54,7 @@
 
 #include "cal-util/timeutil.h"
 #include "dialogs/delete-comp.h"
+#include "dialogs/delete-error.h"
 #include "dialogs/send-comp.h"
 #include "dialogs/cancel-comp.h"
 #include "dialogs/recur-comp.h"
@@ -2821,7 +2822,7 @@
 
 	e_day_view_copy_clipboard (day_view);
 	cal_component_get_uid (event->comp, &uid);
-	cal_client_remove_object (day_view->client, uid);
+	delete_error_dialog (cal_client_remove_object (day_view->client, uid), CAL_COMPONENT_EVENT);
 
 	e_day_view_set_status_message (day_view, NULL);
 }
@@ -4077,10 +4078,7 @@
 
 		cal_component_get_uid (event->comp, &uid);
 
-		/* We don't check the return value; FALSE can mean the object
-		 * was not in the server anyways.
-		 */
-		cal_client_remove_object (day_view->client, uid);
+		delete_error_dialog (cal_client_remove_object (day_view->client, uid), CAL_COMPONENT_EVENT);
 	}
 }
 
@@ -4141,9 +4139,9 @@
 		const char *uid;
 
 		cal_component_get_uid (event->comp, &uid);
-		if (cal_client_remove_object_with_mod (day_view->client, uid, CALOBJ_MOD_THIS) != CAL_CLIENT_RESULT_SUCCESS)
-			g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
-
+		
+		delete_error_dialog (cal_client_remove_object_with_mod (day_view->client, uid, CALOBJ_MOD_THIS),
+				     CAL_COMPONENT_EVENT);
 		return;
 	}
 	
@@ -4216,7 +4214,7 @@
 		itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, day_view->client, NULL);
 
 	cal_component_get_uid (event->comp, &uid);
-	cal_client_remove_object (day_view->client, uid);
+	delete_error_dialog (cal_client_remove_object (day_view->client, uid), CAL_COMPONENT_EVENT);
 }
 
 static void
Index: gui/e-itip-control.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-itip-control.c,v
retrieving revision 1.119
diff -u -r1.119 e-itip-control.c
--- gui/e-itip-control.c	22 Apr 2003 21:15:40 -0000	1.119
+++ gui/e-itip-control.c	24 Apr 2003 18:47:12 -0000
@@ -51,6 +51,7 @@
 #include <evolution-shell-client.h>
 #include <evolution-folder-selector-button.h>
 #include <camel/camel-mime-filter-tohtml.h>
+#include "dialogs/delete-error.h"
 #include "calendar-config.h"
 #include "itip-utils.h"
 #include "e-itip-control.h"
@@ -2036,7 +2037,8 @@
 	CalComponentVType type;
 	const char *uid;
 	GtkWidget *dialog;
-
+	CalClientResult result;
+	
 	priv = itip->priv;
 
 	type = cal_component_get_vtype (priv->comp);
@@ -2049,10 +2051,13 @@
 		return;
 	
 	cal_component_get_uid (priv->comp, &uid);
-	if (cal_client_remove_object (client, uid) == CAL_CLIENT_RESULT_SUCCESS) {
+	result = cal_client_remove_object (client, uid);
+	if (result == CAL_CLIENT_RESULT_SUCCESS || result == CAL_CLIENT_RESULT_NOT_FOUND) {
 		dialog = gnome_ok_dialog (_("Removal Complete"));
 		gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-	}
+	} else {
+		delete_error_dialog (result, type);
+	}	
 }
 
 static void
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.48
diff -u -r1.48 e-tasks.c
--- gui/e-tasks.c	4 Mar 2003 19:52:31 -0000	1.48
+++ gui/e-tasks.c	24 Apr 2003 18:47:12 -0000
@@ -32,6 +32,7 @@
 
 #include "e-util/e-url.h"
 #include "widgets/menus/gal-view-menus.h"
+#include "dialogs/delete-error.h"
 #include "dialogs/task-editor.h"
 #include "cal-search-bar.h"
 #include "calendar-config.h"
@@ -604,7 +605,7 @@
 	tasks = E_TASKS (data);
 	priv = tasks->priv;
 	
-	cal_client_remove_object (priv->client, uid);
+	delete_error_dialog (cal_client_remove_object (priv->client, uid), CAL_COMPONENT_TODO);
 }
 
 /* Callback used when an evaluation error occurs when running a query */
Index: gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.158
diff -u -r1.158 e-week-view.c
--- gui/e-week-view.c	23 Apr 2003 22:03:57 -0000	1.158
+++ gui/e-week-view.c	24 Apr 2003 18:47:13 -0000
@@ -51,6 +51,7 @@
 #include <e-util/e-categories-config.h>
 #include <e-util/e-dialog-utils.h>
 #include "dialogs/delete-comp.h"
+#include "dialogs/delete-error.h"
 #include "dialogs/send-comp.h"
 #include "dialogs/cancel-comp.h"
 #include "dialogs/recur-comp.h"
@@ -1914,7 +1915,7 @@
 
 	e_week_view_copy_clipboard (week_view);
 	cal_component_get_uid (event->comp, &uid);
-	cal_client_remove_object (week_view->client, uid);
+	delete_error_dialog (cal_client_remove_object (week_view->client, uid), CAL_COMPONENT_EVENT);
 
 	e_week_view_set_status_message (week_view, NULL);
 }
@@ -3924,10 +3925,7 @@
 
 		cal_component_get_uid (event->comp, &uid);
 
-		/* We don't check the return value; FALSE can mean the object
-		 * was not in the server anyways.
-		 */
-		cal_client_remove_object (week_view->client, uid);
+		delete_error_dialog (cal_client_remove_object (week_view->client, uid), CAL_COMPONENT_EVENT);
 	}
 }
 
@@ -3973,9 +3971,8 @@
 		const char *uid;
 
 		cal_component_get_uid (event->comp, &uid);
-		if (cal_client_remove_object_with_mod (week_view->client, uid, CALOBJ_MOD_THIS) != CAL_CLIENT_RESULT_SUCCESS)
-			g_message ("e_week_view_on_delete_occurrence(): Could not update the object!");
-
+		delete_error_dialog (cal_client_remove_object_with_mod (week_view->client, uid, CALOBJ_MOD_THIS),
+				     CAL_COMPONENT_EVENT);
 		return;
 	}
 
@@ -4037,7 +4034,7 @@
 		itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, week_view->client, NULL);
 
  	cal_component_get_uid (event->comp, &uid);
- 	cal_client_remove_object (week_view->client, uid);
+ 	delete_error_dialog (cal_client_remove_object (week_view->client, uid), CAL_COMPONENT_EVENT);
 }
 
 static void
Index: gui/dialogs/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/Makefile.am,v
retrieving revision 1.47
diff -u -r1.47 Makefile.am
--- gui/dialogs/Makefile.am	18 Apr 2003 17:44:22 -0000	1.47
+++ gui/dialogs/Makefile.am	24 Apr 2003 18:47:13 -0000
@@ -53,6 +53,8 @@
 	comp-editor-util.h	\
 	delete-comp.c		\
 	delete-comp.h		\
+	delete-error.c		\
+	delete-error.h		\
 	e-delegate-dialog.c	\
 	e-delegate-dialog.h	\
 	event-editor.c		\
Index: gui/dialogs/delete-error.c
===================================================================
RCS file: gui/dialogs/delete-error.c
diff -N gui/dialogs/delete-error.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gui/dialogs/delete-error.c	24 Apr 2003 18:47:13 -0000
@@ -0,0 +1,107 @@
+/* Evolution calendar - Send calendar component dialog
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Author: JP Rosevear <jpr ximian com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <gtk/gtkmessagedialog.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-uidefs.h>
+#include <gal/widgets/e-unicode.h>
+#include "delete-error.h"
+
+
+
+/**
+ * delete_error_dialog:
+ * 
+ * Shows any applicable error messages as the result of deleting and object
+ * 
+ **/
+void
+delete_error_dialog (CalClientResult result, CalComponentVType vtype)
+{
+	GtkWidget *dialog;
+	const char *str;
+
+	switch (result) {
+	case CAL_CLIENT_RESULT_CORBA_ERROR:
+		switch (vtype) {
+		case CAL_COMPONENT_EVENT:
+			str = _("The event could not be deleted due to a corba error");
+			break;
+		case CAL_COMPONENT_TODO:
+			str = _("The task could not be deleted due to a corba error");
+			break;
+		case CAL_COMPONENT_JOURNAL:
+			str = _("The journal entry could not be deleted due to a corba error");
+			break;
+		default:
+			str = _("The item could not be deleted due to a corba error");
+			break;
+		}
+		break;
+	case CAL_CLIENT_RESULT_PERMISSION_DENIED:
+		switch (vtype) {
+		case CAL_COMPONENT_EVENT:
+			str = _("The event could not be deleted because permission was denied");
+			break;
+		case CAL_COMPONENT_TODO:
+			str = _("The task could not be deleted because permission was denied");
+			break;
+		case CAL_COMPONENT_JOURNAL:
+			str = _("The journal entry could not be deleted because permission was denied");
+			break;
+		default:
+			str = _("The item could not be deleted because permission was denied");
+			break;
+		}
+		break;
+	case CAL_CLIENT_RESULT_INVALID_OBJECT:
+		switch (vtype) {
+		case CAL_COMPONENT_EVENT:
+			str = _("The event could not be deleted because it was invalid");
+			break;
+		case CAL_COMPONENT_TODO:
+			str = _("The task could not be deleted because it was invalid");
+			break;
+		case CAL_COMPONENT_JOURNAL:
+			str = _("The journal entry could not be deleted because it was invalid");
+			break;
+		default:
+			str = _("The item could not be deleted because it was invalid");
+			break;
+		}
+		break;
+	case CAL_CLIENT_RESULT_SUCCESS:
+	case CAL_CLIENT_RESULT_NOT_FOUND:
+	default:		
+		/* If not found, we don't care - its gone anyhow */
+		return;
+	}
+	
+	dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+					 GTK_MESSAGE_ERROR,
+					 GTK_BUTTONS_OK, str);
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
Index: gui/dialogs/delete-error.h
===================================================================
RCS file: gui/dialogs/delete-error.h
diff -N gui/dialogs/delete-error.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gui/dialogs/delete-error.h	24 Apr 2003 18:47:13 -0000
@@ -0,0 +1,30 @@
+/* Evolution calendar - Send calendar component dialog
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Author: JP Rosevear <jpr ximian com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef DELETE_ERROR_H
+#define DELETE_ERROR_H
+
+#include <glib.h>
+#include <cal-client/cal-client.h>
+#include <cal-util/cal-component.h>
+
+void delete_error_dialog (CalClientResult result, CalComponentVType vtype);
+
+#endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]