diff options
Diffstat (limited to 'a11y/calendar')
-rw-r--r-- | a11y/calendar/ea-cal-view-event.c | 56 | ||||
-rw-r--r-- | a11y/calendar/ea-day-view.c | 25 | ||||
-rw-r--r-- | a11y/calendar/ea-week-view.c | 24 |
3 files changed, 47 insertions, 58 deletions
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; |