[evolution-patches] patch to fix a crash problem
- From: Li Yuan <Li Yuan Sun COM>
- To: Rodrigo Moya <rodrigo novell com>, jpr novell com
- Cc: evolution-patches ximian com
- Subject: [evolution-patches] patch to fix a crash problem
- Date: Tue, 26 Oct 2004 18:49:26 +0800
hi,
for *calendar_get_text_for_folder_bar_label* which is being used in a11y
directory has been removed form calendar-commands.c,
when evolution starts with contacts view or else and then switches to
calendar view, the evolution may crash. ( with a11y on)
so i move the function to a11y directory.
attach is the patch, please review it.
thanks,
li
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/a11y/ChangeLog,v
retrieving revision 1.20
diff -u -r1.20 ChangeLog
--- ChangeLog 30 Sep 2004 07:32:36 -0000 1.20
+++ ChangeLog 26 Oct 2004 10:36:31 -0000
@@ -1,3 +1,14 @@
+2004-10-26 Li Yuan <li yuan sun com>
+
+ * calendar/ea-day-view.c: (ea_day_view_get_name):
+ * calendar/ea-gnome-calendar.c:
+ (ea_gnome_calendar_get_text_for_folder_bar_label),
+ (ea_gcal_dates_change_cb):
+ * calendar/ea-gnome-calendar.h:
+ * calendar/ea-week-view.c: (ea_week_view_get_name):
+ for calendar_get_text_for_folder_bar_label has been removed form
+ calendar-commands.c, we implement it ourself.
+
2004-09-23 Li Yuan <li yuan sun com>
* calendar/ea-cal-view-event.c: (ea_cal_view_event_get_type),
Index: calendar/ea-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-day-view.c,v
retrieving revision 1.5
diff -u -r1.5 ea-day-view.c
--- calendar/ea-day-view.c 30 Sep 2004 07:32:36 -0000 1.5
+++ calendar/ea-day-view.c 26 Oct 2004 10:36:31 -0000
@@ -27,6 +27,7 @@
#include "ea-cal-view-event.h"
#include "ea-calendar-helpers.h"
+#include "ea-gnome-calendar.h"
#include "calendar-commands.h"
#include <glib/gstrfuncs.h>
#include <libgnome/gnome-i18n.h>
@@ -137,7 +138,7 @@
day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view));
- label_text = calendar_get_text_for_folder_bar_label (gcal);
+ label_text = ea_gnome_calendar_get_text_for_folder_bar_label (gcal);
n_events = atk_object_get_n_accessible_children (accessible);
/* the child main item is always there */
Index: calendar/ea-gnome-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-gnome-calendar.c,v
retrieving revision 1.5
diff -u -r1.5 ea-gnome-calendar.c
--- calendar/ea-gnome-calendar.c 30 Sep 2004 07:32:36 -0000 1.5
+++ calendar/ea-gnome-calendar.c 26 Oct 2004 10:36:32 -0000
@@ -25,7 +25,9 @@
#include "ea-gnome-calendar.h"
#include "calendar-commands.h"
+#include <string.h>
#include <gtk/gtknotebook.h>
+#include <libecal/e-cal-time-util.h>
#include <libgnome/gnome-i18n.h>
static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
@@ -135,6 +137,108 @@
return accessible;
}
+const gchar *
+ea_gnome_calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal)
+{
+ icaltimezone *zone;
+ struct icaltimetype start_tt, end_tt;
+ time_t start_time, end_time;
+ struct tm start_tm, end_tm;
+ static char buffer[512];
+ char end_buffer[256];
+ GnomeCalendarViewType view;
+
+ gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time);
+ zone = gnome_calendar_get_timezone (gcal);
+
+ start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone);
+ start_tm.tm_year = start_tt.year - 1900;
+ start_tm.tm_mon = start_tt.month - 1;
+ start_tm.tm_mday = start_tt.day;
+ start_tm.tm_hour = start_tt.hour;
+ start_tm.tm_min = start_tt.minute;
+ start_tm.tm_sec = start_tt.second;
+ start_tm.tm_isdst = -1;
+ start_tm.tm_wday = time_day_of_week (start_tt.day, start_tt.month - 1,
+ start_tt.year);
+
+ /* Take one off end_time so we don't get an extra day. */
+ end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, zone);
+ end_tm.tm_year = end_tt.year - 1900;
+ end_tm.tm_mon = end_tt.month - 1;
+ end_tm.tm_mday = end_tt.day;
+ end_tm.tm_hour = end_tt.hour;
+ end_tm.tm_min = end_tt.minute;
+ end_tm.tm_sec = end_tt.second;
+ end_tm.tm_isdst = -1;
+ end_tm.tm_wday = time_day_of_week (end_tt.day, end_tt.month - 1,
+ end_tt.year);
+
+ view = gnome_calendar_get_view (gcal);
+
+ switch (view) {
+ case GNOME_CAL_DAY_VIEW:
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ case GNOME_CAL_WEEK_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year
+ && start_tm.tm_mon == end_tm.tm_mon
+ && start_tm.tm_mday == end_tm.tm_mday) {
+ e_utf8_strftime (buffer, sizeof (buffer),
+ _("%A %d %b %Y"), &start_tm);
+ } else if (start_tm.tm_year == end_tm.tm_year) {
+ e_utf8_strftime (buffer, sizeof (buffer),
+ _("%a %d %b"), &start_tm);
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ e_utf8_strftime (buffer, sizeof (buffer),
+ _("%a %d %b %Y"), &start_tm);
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+ case GNOME_CAL_MONTH_VIEW:
+ case GNOME_CAL_LIST_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year) {
+ if (start_tm.tm_mon == end_tm.tm_mon) {
+ if (start_tm.tm_mday == end_tm.tm_mday) {
+ buffer [0] = '\0';
+ } else {
+ e_utf8_strftime (buffer, sizeof (buffer),
+ "%d", &start_tm);
+ strcat (buffer, " - ");
+ }
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, end_buffer);
+ } else {
+ e_utf8_strftime (buffer, sizeof (buffer),
+ _("%d %b"), &start_tm);
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ } else {
+ e_utf8_strftime (buffer, sizeof (buffer),
+ _("%d %b %Y"), &start_tm);
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
+ return buffer;
+}
+
static G_CONST_RETURN gchar*
ea_gnome_calendar_get_name (AtkObject *accessible)
{
@@ -239,7 +343,7 @@
g_return_if_fail (data);
g_return_if_fail (EA_IS_GNOME_CALENDAR (data));
- new_name = calendar_get_text_for_folder_bar_label (gcal);
+ new_name = ea_gnome_calendar_get_text_for_folder_bar_label (gcal);
atk_object_set_name (ATK_OBJECT(data), new_name);
g_signal_emit_by_name (data, "visible_data_changed");
Index: calendar/ea-gnome-calendar.h
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-gnome-calendar.h,v
retrieving revision 1.2
diff -u -r1.2 ea-gnome-calendar.h
--- calendar/ea-gnome-calendar.h 20 Aug 2003 07:46:05 -0000 1.2
+++ calendar/ea-gnome-calendar.h 26 Oct 2004 10:36:32 -0000
@@ -57,6 +57,8 @@
AtkObject* ea_gnome_calendar_new (GtkWidget *widget);
+const gchar * ea_gnome_calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: calendar/ea-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-week-view.c,v
retrieving revision 1.8
diff -u -r1.8 ea-week-view.c
--- calendar/ea-week-view.c 30 Sep 2004 07:32:36 -0000 1.8
+++ calendar/ea-week-view.c 26 Oct 2004 10:36:32 -0000
@@ -27,6 +27,7 @@
#include "ea-cal-view.h"
#include "ea-cal-view-event.h"
#include "ea-calendar-helpers.h"
+#include "ea-gnome-calendar.h"
#include "calendar-commands.h"
#include <gal/e-text/e-text.h>
#include <libgnome/gnome-i18n.h>
@@ -138,7 +139,7 @@
week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view));
- label_text = calendar_get_text_for_folder_bar_label (gcal);
+ label_text = ea_gnome_calendar_get_text_for_folder_bar_label (gcal);
n_events = atk_object_get_n_accessible_children (accessible);
/* the child main item is always there */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]