aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Lu <harry.lu@sun.com>2005-02-02 10:10:09 +0800
committerHarry Lu <haip@src.gnome.org>2005-02-02 10:10:09 +0800
commit53cf58b7cf4b930ada93fd871b3107bb265ac696 (patch)
treee44c9f30e09ac2c33b68e4fe535468bc4b5af7e1
parentf4fca7e3cb5364d03a482cb9db516e9206ce2335 (diff)
downloadgsoc2013-evolution-53cf58b7cf4b930ada93fd871b3107bb265ac696.tar.gz
gsoc2013-evolution-53cf58b7cf4b930ada93fd871b3107bb265ac696.tar.zst
gsoc2013-evolution-53cf58b7cf4b930ada93fd871b3107bb265ac696.zip
Fix for 71924, 71926, 71932 Don't split sentences that need translation.
2005-02-01 Harry Lu <harry.lu@sun.com> Fix for 71924, 71926, 71932 Don't split sentences that need translation. Also remove two useless variables. * calendar/ea-cal-view-event.c: (ea_cal_view_event_get_name): * calendar/ea-day-view.c: (ea_day_view_get_name): * calendar/ea-week-view.c: (ea_week_view_get_name), (ea_week_view_get_n_children): * widgets/ea-calendar-item.c: (ea_calendar_item_get_name), (e_calendar_item_get_offset_for_date): svn path=/trunk/; revision=28668
-rw-r--r--a11y/ChangeLog13
-rw-r--r--a11y/calendar/ea-cal-view-event.c56
-rw-r--r--a11y/calendar/ea-day-view.c25
-rw-r--r--a11y/calendar/ea-week-view.c24
-rw-r--r--a11y/widgets/ea-calendar-item.c29
5 files changed, 72 insertions, 75 deletions
diff --git a/a11y/ChangeLog b/a11y/ChangeLog
index d170e3f29c..f905c5a39a 100644
--- a/a11y/ChangeLog
+++ b/a11y/ChangeLog
@@ -1,3 +1,16 @@
+2005-02-01 Harry Lu <harry.lu@sun.com>
+
+ Fix for 71924, 71926, 71932
+ Don't split sentences that need translation.
+ Also remove two useless variables.
+
+ * calendar/ea-cal-view-event.c: (ea_cal_view_event_get_name):
+ * calendar/ea-day-view.c: (ea_day_view_get_name):
+ * calendar/ea-week-view.c: (ea_week_view_get_name),
+ (ea_week_view_get_n_children):
+ * widgets/ea-calendar-item.c: (ea_calendar_item_get_name),
+ (e_calendar_item_get_offset_for_date):
+
2005-01-31 Rodrigo Moya <rodrigo@novell.com>
Fixes #71929
diff --git a/a11y/calendar/ea-cal-view-event.c b/a11y/calendar/ea-cal-view-event.c
index 3a389b2324..cbd53f4ebd 100644
--- a/a11y/calendar/ea-cal-view-event.c
+++ b/a11y/calendar/ea-cal-view-event.c
@@ -216,8 +216,8 @@ ea_cal_view_event_get_name (AtkObject *accessible)
AtkGObjectAccessible *atk_gobj;
GObject *g_obj;
ECalendarViewEvent *event;
- gchar *tmp_name;
- gchar *new_name = g_strdup ("");
+ gchar *name_string;
+ gchar *alarm_string, *recur_string, *meeting_string, *summary_string;
const char *summary;
@@ -229,53 +229,33 @@ ea_cal_view_event_get_name (AtkObject *accessible)
return NULL;
event = ea_calendar_helpers_get_cal_view_event_from (GNOME_CANVAS_ITEM(g_obj));
+ alarm_string = recur_string = meeting_string = "";
if (event && event->comp_data) {
- if (e_cal_util_component_has_alarms (event->comp_data->icalcomp)) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, _("alarm "), NULL);
- g_free (tmp_name);
- }
+ if (e_cal_util_component_has_alarms (event->comp_data->icalcomp))
+ alarm_string = _("It has alarms.");
- if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, _("recurrence "), NULL);
- g_free (tmp_name);
- }
+ if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ recur_string = _("It has recurrences.");
- if (event->different_timezone) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, _("time-zone "), NULL);
- g_free (tmp_name);
- }
-
- if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, _("meeting "), NULL);
- g_free (tmp_name);
- }
+ if (e_cal_util_component_has_organizer (event->comp_data->icalcomp))
+ meeting_string = _("It is a meeting.");
+
}
- tmp_name = new_name;
- new_name = g_strconcat (new_name, _("event. Summary is "), NULL);
- g_free (tmp_name);
summary = icalcomponent_get_summary (event->comp_data->icalcomp);
- if (summary) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, summary, NULL);
- g_free (tmp_name);
- }
- else {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, _("empty"), NULL);
- g_free (tmp_name);
- }
+ if (summary)
+ summary_string = g_strdup_printf (_("Calendar Event: Summary is %s."), summary);
+ else
+ summary_string = g_strdup (_("Calendar Event: It has no summary."));
+
+ name_string = g_strdup_printf ("%s %s %s %s", summary_string, alarm_string, recur_string, meeting_string);
- ATK_OBJECT_CLASS (parent_class)->set_name (accessible, new_name);
+ ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_string);
#ifdef ACC_DEBUG
printf("EvoAcc: name for event accobj=%p, is %s\n",
(void *)accessible, new_name);
#endif
- g_free (new_name);
+ g_free (name_string);
return accessible->name;
}
diff --git a/a11y/calendar/ea-day-view.c b/a11y/calendar/ea-day-view.c
index 7374783606..cfe96634ba 100644
--- a/a11y/calendar/ea-day-view.c
+++ b/a11y/calendar/ea-day-view.c
@@ -127,16 +127,15 @@ ea_day_view_get_name (AtkObject *accessible)
GnomeCalendar *gcal;
const gchar *label_text;
GnomeCalendarViewType view_type;
- gchar buffer[128] = "";
gint n_events;
-
+ gchar *event_str, *name_str;
g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
if (!GTK_ACCESSIBLE (accessible)->widget)
return NULL;
- day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view));
label_text = ea_gnome_calendar_get_label_description (gcal);
@@ -144,16 +143,22 @@ ea_day_view_get_name (AtkObject *accessible)
/* the child main item is always there */
--n_events;
if (n_events >= 1)
- g_snprintf (buffer, sizeof (buffer), ngettext ( _(", %d event"), _(", %d events"), n_events), n_events);
+ event_str = g_strdup_printf (ngettext ("It has %d event.", "It has %d events.", n_events), n_events);
+ else
+ event_str = g_strdup (_("It has no events."));
+
view_type = gnome_calendar_get_view (gcal);
if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
- accessible->name = g_strconcat (_("work week view:"),
- label_text, buffer,
- NULL);
+ name_str = g_strdup_printf (_("Work Week View: %s. %s"),
+ label_text, event_str);
else
- accessible->name = g_strconcat (_("day view:"),
- label_text, buffer,
- NULL);
+ name_str = g_strdup_printf (_("Day View: %s. %s"),
+ label_text, event_str);
+
+ ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_str);
+ g_free (name_str);
+ g_free (event_str);
+
return accessible->name;
}
diff --git a/a11y/calendar/ea-week-view.c b/a11y/calendar/ea-week-view.c
index 1b0ea445f8..3b36ac246d 100644
--- a/a11y/calendar/ea-week-view.c
+++ b/a11y/calendar/ea-week-view.c
@@ -129,15 +129,15 @@ ea_week_view_get_name (AtkObject *accessible)
GnomeCalendar *gcal;
const gchar *label_text;
GnomeCalendarViewType view_type;
- gchar buffer[128] = "";
gint n_events;
+ gchar *event_str, *name_str;
g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
if (!GTK_ACCESSIBLE (accessible)->widget)
return NULL;
- week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+ week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view));
label_text = ea_gnome_calendar_get_label_description (gcal);
@@ -145,19 +145,24 @@ ea_week_view_get_name (AtkObject *accessible)
/* the child main item is always there */
--n_events;
if (n_events >= 1)
- g_snprintf (buffer, sizeof (buffer), ngettext ( _(", %d event"), _(", %d events"), n_events), n_events);
+ event_str = g_strdup_printf (ngettext ("It has %d event.", "It has %d events.", n_events), n_events);
+ else
+ event_str = g_strdup (_("It has no events."));
view_type = gnome_calendar_get_view (gcal);
if (view_type == GNOME_CAL_MONTH_VIEW)
- accessible->name = g_strconcat (_("month view:"),
- label_text, buffer,
- NULL);
+ name_str = g_strdup_printf (_("Month View: %s. %s"),
+ label_text, event_str);
else
- accessible->name = g_strconcat (_("week view:"),
- label_text, buffer,
- NULL);
+ name_str = g_strdup_printf (_("Week View: %s. %s"),
+ label_text, event_str);
+
+ ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_str);
+ g_free (name_str);
+ g_free (event_str);
+
return accessible->name;
}
@@ -192,7 +197,6 @@ static gint
ea_week_view_get_n_children (AtkObject *accessible)
{
EWeekView *week_view;
- GnomeCanvasGroup *canvas_group;
gint i, count = 0;
gint event_index;
diff --git a/a11y/widgets/ea-calendar-item.c b/a11y/widgets/ea-calendar-item.c
index ac5eb1ff41..b80bbdcb77 100644
--- a/a11y/widgets/ea-calendar-item.c
+++ b/a11y/widgets/ea-calendar-item.c
@@ -267,17 +267,14 @@ ea_calendar_item_get_name (AtkObject *accessible)
ECalendarItem *calitem;
gint start_year, start_month, start_day;
gint end_year, end_month, end_day;
- static gchar new_name[256] = "";
- gchar buffer_start[128] = "";
- gchar buffer_end[128] = "";
- struct tm day_start = { 0 };
- struct tm day_end = { 0 };
+ gchar *name_str = NULL;
+ gchar buffer_start[128] = "";
+ gchar buffer_end[128] = "";
+ struct tm day_start = { 0 };
+ struct tm day_end = { 0 };
g_return_val_if_fail (EA_IS_CALENDAR_ITEM (accessible), NULL);
- if (accessible->name)
- return accessible->name;
-
g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible));
g_return_val_if_fail (E_IS_CALENDAR_ITEM (g_obj), NULL);
@@ -290,19 +287,15 @@ ea_calendar_item_get_name (AtkObject *accessible)
day_start.tm_mon = start_month;
day_start.tm_mday = start_day;
day_start.tm_isdst = -1;
- e_utf8_strftime (buffer_start, sizeof (buffer_start), _(" %d %B %Y"), &day_start);
+ e_utf8_strftime (buffer_start, sizeof (buffer_start), _("%d %B %Y"), &day_start);
day_end.tm_year = end_year - 1900;
day_end.tm_mon = end_month;
day_end.tm_mday = end_day;
day_end.tm_isdst = -1;
- e_utf8_strftime (buffer_end, sizeof (buffer_end), _(" %d %B %Y"), &day_end);
+ e_utf8_strftime (buffer_end, sizeof (buffer_end), _("%d %B %Y"), &day_end);
- strcat (new_name, _("calendar (from "));
- strcat (new_name, buffer_start);
- strcat (new_name, _(" to "));
- strcat (new_name, buffer_end);
- strcat (new_name, _(")"));
+ name_str = g_strdup_printf (_("Calendar: from %s to %s"), buffer_start, buffer_end);
}
#if 0
@@ -325,7 +318,10 @@ ea_calendar_item_get_name (AtkObject *accessible)
}
#endif
- return new_name;
+ ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_str);
+ g_free (name_str);
+
+ return accessible->name;
}
static G_CONST_RETURN gchar*
@@ -1264,7 +1260,6 @@ e_calendar_item_get_offset_for_date (ECalendarItem *calitem,
gint start_year, start_month, start_day;
gint end_year, end_month, end_day;
GDate *start_date, *end_date;
- gint n_days;
*offset = 0;
g_return_val_if_fail (E_IS_CALENDAR_ITEM (calitem), FALSE);