[evolution-patches] a patch on making a empty new appointment or task



Dear Rodrigo,

I have a patch on making a empty new appointment or task. Would you please me to review it?

   Following is the detail.

   Scene A:
   Operation:
   1.open a existing appointment or task;
   2.clear all the contents of the appointment or task;
   3.save the appointment or task.
   Result:
       The empty appointment or task can be saved.

   Scene B:
   Operation:
   1.make a new appointment or task;
   2.make no change to the appointment or task
   3.save the appointment or task.
   Result:
       The empty appointment or task can't be saved.

Compare A with B, we can find the difference: we *can't* make a empty appointment or task by making a new one.

If the user makes a new appointment or task and clicks the "save" button, that means he wants to save the appointment or task even if he makes no change to it; if he want to cancel the edit, he'll click the "close" button.

Do you think we should make some change to it? If so, I hope my patch can do it.

Best Regards

Alfred Peng
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2272
diff -u -r1.2272 ChangeLog
--- ChangeLog	22 Apr 2004 20:24:55 -0000	1.2272
+++ ChangeLog	24 Apr 2004 09:02:15 -0000
@@ -1,3 +1,25 @@
+2004-04-24  Alfred Peng <alfred peng sun com>
+
+	* gui/dialogs/comp-editor.c (comp_editor_init), 
+	(comp_editor_set_is_new): Add a new member variable "is_new"
+	and define a method to set the value.
+	(save_comp): When make a new empty appointment or task, and
+	click the "SAVE" button, save the appointment or the task
+	instead of ignoring the operation.
+	
+	* gui/dialogs/comp-editor.h: Add the method declaration.
+	
+	* gui/gnome-cal.c (gnome_calendar_new_task): Set tedit->is_new
+	to TRUE.
+	
+	* gui/comp-editor-factory.c (edit_new): Set editor->is_new to TRUE.
+
+	* gui/e-calendar-view.c (e_calendar_view_new_appointment_for):
+	Set editor->is_new to TRUE.
+
+	* gui/tasks-component.c (create_new_todo): Set editor->is_new to
+	TRUE.
+
 2004-04-22  Jeffrey Stedfast  <fejj ximian com>
 
 	* conduits/calendar/calendar-conduit.c (start_calendar_server):
Index: gui/comp-editor-factory.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/comp-editor-factory.c,v
retrieving revision 1.35
diff -u -r1.35 comp-editor-factory.c
--- gui/comp-editor-factory.c	6 Feb 2004 03:03:41 -0000	1.35
+++ gui/comp-editor-factory.c	24 Apr 2004 09:02:15 -0000
@@ -312,6 +312,7 @@
 	case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT:
 	case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING:
 		editor = COMP_EDITOR (event_editor_new (oc->client));
+		comp_editor_set_is_new(editor, TRUE);
 		comp = cal_comp_event_new_with_current_time (oc->client, FALSE);
 		break;
 	case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT:
@@ -320,6 +321,7 @@
 		break;
 	case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO:
 		editor = COMP_EDITOR (task_editor_new (oc->client));
+		comp_editor_set_is_new(editor, TRUE);
 		comp = get_default_task (oc->client);
 		break;
 	default:
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.49
diff -u -r1.49 e-calendar-view.c
--- gui/e-calendar-view.c	21 Apr 2004 17:58:09 -0000	1.49
+++ gui/e-calendar-view.c	24 Apr 2004 09:02:15 -0000
@@ -1471,6 +1471,8 @@
 	ECalComponent *comp;
 	icalcomponent *icalcomp;
 	ECalComponentTransparency transparency;
+	CompEditor *editor;
+	const char *uid;
 
 	g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
 
@@ -1521,6 +1523,11 @@
 				     e_cal_model_get_default_client (priv->model),
 				     icalcomp, meeting);
 
+	e_cal_component_get_uid (comp, &uid);
+	editor = e_comp_editor_registry_find (comp_editor_registry, uid);
+	if (editor)
+		comp_editor_set_is_new(editor, TRUE);
+
 	g_object_unref (comp);
 }
 
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.322
diff -u -r1.322 gnome-cal.c
--- gui/gnome-cal.c	21 Apr 2004 17:58:09 -0000	1.322
+++ gui/gnome-cal.c	24 Apr 2004 09:02:16 -0000
@@ -2264,6 +2264,7 @@
 
 	ecal = e_cal_model_get_default_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)));
 	tedit = task_editor_new (ecal);
+	comp_editor_set_is_new(COMP_EDITOR(tedit), TRUE);
 
 	icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (priv->week_view)));
 	comp = e_cal_component_new ();
Index: gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.62
diff -u -r1.62 tasks-component.c
--- gui/tasks-component.c	21 Apr 2004 17:58:09 -0000	1.62
+++ gui/tasks-component.c	24 Apr 2004 09:02:17 -0000
@@ -518,6 +518,7 @@
 	}
 
 	editor = task_editor_new (ecal);
+	comp_editor_set_is_new(COMP_EDITOR(editor), TRUE);
 	comp = cal_comp_task_new_with_defaults (ecal);
 
 	comp_editor_edit_comp (COMP_EDITOR (editor), comp);
Index: gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.98
diff -u -r1.98 comp-editor.c
--- gui/dialogs/comp-editor.c	19 Apr 2004 15:19:32 -0000	1.98
+++ gui/dialogs/comp-editor.c	24 Apr 2004 09:02:17 -0000
@@ -76,6 +76,7 @@
 
 	GtkWidget *filesel;
 
+	gboolean is_new;
 	gboolean changed;
 	gboolean needs_send;
 
@@ -231,6 +232,7 @@
 	setup_widgets (editor);
 
 	priv->pages = NULL;
+	priv->is_new = FALSE;
 	priv->changed = FALSE;
 	priv->needs_send = FALSE;
 	priv->mod = CALOBJ_MOD_ALL;
@@ -372,7 +374,7 @@
 
 	priv = editor->priv;
 
-	if (!priv->changed)
+	if (!priv->is_new && !priv->changed)
 		return TRUE;
 
 	/* Stop listening because we are about to change things */
@@ -611,6 +613,22 @@
 	return priv->user_org;
 }
 
+/**
+ * comp_editor_set_is_new:
+ * @editor: A component editor
+ * @is_new: Value to set the is_new state to
+ *
+ * Set the dialog is_new state to the given value
+ **/
+void
+comp_editor_set_is_new (CompEditor *editor, gboolean is_new)
+{
+	CompEditorPrivate *priv;
+
+	priv = editor->priv;
+
+	priv->is_new = is_new;
+}
 
 /**
  * comp_editor_set_changed:
Index: gui/dialogs/comp-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.h,v
retrieving revision 1.20
diff -u -r1.20 comp-editor.h
--- gui/dialogs/comp-editor.h	5 Dec 2003 16:04:17 -0000	1.20
+++ gui/dialogs/comp-editor.h	24 Apr 2004 09:02:17 -0000
@@ -59,6 +59,8 @@
 } CompEditorClass;
 
 GtkType       comp_editor_get_type         (void);
+void          comp_editor_set_is_new      (CompEditor             *editor,
+					    gboolean                is_new);
 void          comp_editor_set_changed      (CompEditor             *editor,
 					    gboolean                changed);
 gboolean      comp_editor_get_changed      (CompEditor             *editor);


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