[evolution-patches] [Calendar] New Appointment - summary validation



Hi,
Came across a possible bug.

Description
When the appointment is closed using the "close" button, no check is
made for a empty summary.
Steps to reproduce the bug
1. Create a new appointment without a summary.
2. Click the close button.

Actual result:
A "Save Changes" prompt is shown

Expected Result
If the summary is empty then a prompt must be displayed informing the
user about the missing summary.

If this is a bug then here is the patch...
Please comment.

Johnny

Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2854
diff -u -p -r1.2854 ChangeLog
--- calendar/ChangeLog  25 Nov 2005 13:19:16 -0000      1.2854
+++ calendar/ChangeLog  28 Nov 2005 12:59:39 -0000
@@ -1,3 +1,8 @@
+2005-11-27  Johnny Jacob  <johnnyjacob gmail com>
+
+       * gui/dialogs/comp-editor.c (menu_file_close_cb):
+       Check wheather the summary is empty and prompt accordingly
+
 2005-11-25  Tor Lillqvist  <tml novell com>

        * gui/calendar-component.c (ensure_sources)
Index: calendar/gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.154
diff -u -p -r1.154 comp-editor.c
--- calendar/gui/dialogs/comp-editor.c  14 Nov 2005 18:18:16 -0000      1.154
+++ calendar/gui/dialogs/comp-editor.c  28 Nov 2005 13:00:45 -0000
@@ -1223,10 +1223,23 @@ menu_file_close_cb (BonoboUIComponent *u
                   const char *path)
 {
        CompEditor *editor = (CompEditor *) data;
+       ECalComponent *comp;
+       ECalComponentText text;
+       CompEditorPrivate *priv = editor->priv;
+
        commit_all_fields (editor);
-
-       if (prompt_to_save_changes (editor, TRUE))
+
+       if (prompt_to_save_changes (editor, TRUE)) {
+               comp = comp_editor_get_current_comp (editor);
+               e_cal_component_get_summary (comp, &text);
+               g_object_unref (comp);
+
+               if (!text.value)
+                       if (!send_component_prompt_subject ((GtkWindow
*) editor,
priv->client, priv->comp))
+                               return;
+
                close_dialog (editor);
+       }
 }

 static void
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2854
diff -u -p -r1.2854 ChangeLog
--- calendar/ChangeLog	25 Nov 2005 13:19:16 -0000	1.2854
+++ calendar/ChangeLog	28 Nov 2005 12:59:39 -0000
@@ -1,3 +1,8 @@
+2005-11-27  Johnny Jacob  <johnnyjacob gmail com>
+	
+	* gui/dialogs/comp-editor.c (menu_file_close_cb): 
+	Check wheather the summary is empty and prompt accordingly	
+
 2005-11-25  Tor Lillqvist  <tml novell com>
 
 	* gui/calendar-component.c (ensure_sources)
Index: calendar/gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.154
diff -u -p -r1.154 comp-editor.c
--- calendar/gui/dialogs/comp-editor.c	14 Nov 2005 18:18:16 -0000	1.154
+++ calendar/gui/dialogs/comp-editor.c	28 Nov 2005 13:00:45 -0000
@@ -1223,10 +1223,23 @@ menu_file_close_cb (BonoboUIComponent *u
 		   const char *path)
 {
 	CompEditor *editor = (CompEditor *) data;
+	ECalComponent *comp;
+	ECalComponentText text;
+	CompEditorPrivate *priv = editor->priv;
+	
 	commit_all_fields (editor);
-		
-	if (prompt_to_save_changes (editor, TRUE))
+
+	if (prompt_to_save_changes (editor, TRUE)) {
+		comp = comp_editor_get_current_comp (editor);
+		e_cal_component_get_summary (comp, &text);
+		g_object_unref (comp);
+
+		if (!text.value)
+			if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp))
+				return;
+
 		close_dialog (editor);
+	}
 }
 
 static void




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