[evolution-patches] Fix for Bug #248105 (Calendar-EventsPage)



Hi,

Worked on Bug #248105 :  No warning if you create an appointment in the past
Please review the patch.

Thank you,
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  27 Nov 2005 21:53:55 -0000
@@ -1,3 +1,10 @@
+2005-11-27  Johnny Jacob  <johnnyjacob gmail com>
+
+       ** See Bug # 248105
+       * gui/dialogs/event-page.c (event_page_fill_component):
+       Check wheather the event is in the past
+       * calendar.error.xml : Added new prompt "prompt-event-in-past"
+
 2005-11-25  Tor Lillqvist  <tml novell com>

        * gui/calendar-component.c (ensure_sources)
Index: calendar/gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.91
diff -u -p -r1.91 event-page.c
--- calendar/gui/dialogs/event-page.c   16 Nov 2005 13:53:47 -0000      1.91
+++ calendar/gui/dialogs/event-page.c   27 Nov 2005 21:55:24 -0000
@@ -1217,6 +1217,26 @@ event_page_fill_component (CompEditorPag
                                             &end_tt.day);
        g_assert (end_date_set);

+       /* Check wheather the event is in the past */
+
+       GDate *tmp_today, *tmp_enddate;
+       tmp_today = g_date_new();
+       tmp_enddate = g_date_new();
+
+       g_date_set_time (tmp_today, (GTime) time(NULL));
+       g_date_set_dmy (tmp_enddate, end_tt.day, end_tt.month, end_tt.year);
+
+       if (g_date_compare (tmp_enddate,tmp_today) < 0) {
+               if(e_error_run ( gtk_widget_get_toplevel (priv->main),
+                                "calendar:prompt-event-in-past",
NULL) == GTK_RESPONSE_CANCEL) {
+                       g_date_free (tmp_today);
+                       g_date_free (tmp_enddate);
+                       return FALSE;
+               }
+       }
+       g_date_free (tmp_today);
+       g_date_free (tmp_enddate);
+
        /* If the all_day toggle is set, we use DATE values for DTSTART and
           DTEND. If not, we fetch the hour & minute from the widgets. */
        all_day_event = priv->all_day_event;
Index: calendar/calendar.error.xml
===================================================================
RCS file: /cvs/gnome/evolution/calendar/calendar.error.xml,v
retrieving revision 1.5
diff -u -p -r1.5 calendar.error.xml
--- calendar/calendar.error.xml 19 Oct 2005 11:38:14 -0000      1.5
+++ calendar/calendar.error.xml 27 Nov 2005 21:56:36 -0000
@@ -240,4 +240,11 @@
  <_secondary>You are connecting to an unsupported GroupWise server
and may encounter problems using Evolution. For best results the
server should be upgraded to a supported version</_secondary>
  </error>

+ <error id="prompt-event-in-past" type="question" default="GTK_RESPONSE_YES">
+ <_primary>Appointment has expired</_primary>
+ <_secondary>Are you sure you want to save the appointment that has
expired</_secondary>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ <button _label="_Save" response="GTK_RESPONSE_YES"/>
+ </error>
+
 </error-list>
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	27 Nov 2005 21:53:55 -0000
@@ -1,3 +1,10 @@
+2005-11-27  Johnny Jacob  <johnnyjacob gmail com>
+	
+	** See Bug # 248105
+	* gui/dialogs/event-page.c (event_page_fill_component): 
+	Check wheather the event is in the past
+	* calendar.error.xml : Added new prompt "prompt-event-in-past"
+
 2005-11-25  Tor Lillqvist  <tml novell com>
 
 	* gui/calendar-component.c (ensure_sources)
Index: calendar/gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.91
diff -u -p -r1.91 event-page.c
--- calendar/gui/dialogs/event-page.c	16 Nov 2005 13:53:47 -0000	1.91
+++ calendar/gui/dialogs/event-page.c	27 Nov 2005 21:55:24 -0000
@@ -1217,6 +1217,26 @@ event_page_fill_component (CompEditorPag
 					     &end_tt.day);
 	g_assert (end_date_set);
 
+	/* Check wheather the event is in the past */ 
+
+	GDate *tmp_today, *tmp_enddate;
+	tmp_today = g_date_new();
+	tmp_enddate = g_date_new();
+
+	g_date_set_time (tmp_today, (GTime) time(NULL));
+	g_date_set_dmy (tmp_enddate, end_tt.day, end_tt.month, end_tt.year);
+
+	if (g_date_compare (tmp_enddate,tmp_today) < 0) {
+		if(e_error_run ( gtk_widget_get_toplevel (priv->main),
+				 "calendar:prompt-event-in-past", NULL) == GTK_RESPONSE_CANCEL) {
+			g_date_free (tmp_today);
+			g_date_free (tmp_enddate);
+			return FALSE;
+		}
+	}
+	g_date_free (tmp_today);
+	g_date_free (tmp_enddate);	
+
 	/* If the all_day toggle is set, we use DATE values for DTSTART and
 	   DTEND. If not, we fetch the hour & minute from the widgets. */
 	all_day_event = priv->all_day_event;
Index: calendar/calendar.error.xml
===================================================================
RCS file: /cvs/gnome/evolution/calendar/calendar.error.xml,v
retrieving revision 1.5
diff -u -p -r1.5 calendar.error.xml
--- calendar/calendar.error.xml	19 Oct 2005 11:38:14 -0000	1.5
+++ calendar/calendar.error.xml	27 Nov 2005 21:56:36 -0000
@@ -240,4 +240,11 @@
  <_secondary>You are connecting to an unsupported GroupWise server and may encounter problems using Evolution. For best results the server should be upgraded to a supported version</_secondary>
  </error>
 
+ <error id="prompt-event-in-past" type="question" default="GTK_RESPONSE_YES">
+ <_primary>Appointment has expired</_primary>
+ <_secondary>Are you sure you want to save the appointment that has expired</_secondary>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ <button _label="_Save" response="GTK_RESPONSE_YES"/>
+ </error>
+
 </error-list>



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