diff options
author | Bolian Yin <bolian.yin@sun.com> | 2003-08-20 16:05:00 +0800 |
---|---|---|
committer | Bolian Yin <byin@src.gnome.org> | 2003-08-20 16:05:00 +0800 |
commit | ef5eb5facdf293531569ca1d8b7ab7fd976fbe83 (patch) | |
tree | 5f8bce18e4c7ee5d6e31878b29facad4841f12f5 /calendar/gui | |
parent | 7bb25afd430ffab77397d9fc4e6b756251ba31d8 (diff) | |
download | gsoc2013-evolution-ef5eb5facdf293531569ca1d8b7ab7fd976fbe83.tar.gz gsoc2013-evolution-ef5eb5facdf293531569ca1d8b7ab7fd976fbe83.tar.zst gsoc2013-evolution-ef5eb5facdf293531569ca1d8b7ab7fd976fbe83.zip |
Add a11y dependency. gui/calendar-commands.c
2003-08-20 Bolian Yin <bolian.yin@sun.com>
* gui/Makefile.am : Add a11y dependency.
* gui/calendar-commands.c (calendar_get_text_for_folder_bar_label)
* gui/e-cal-view.c: Add two new events: "event_changed" and "event_added"
* gui/e-day-view.c (e_day_view_class_init): init a11y.
(e_day_view_find_event_from_item): make it public from private
(e_day_view_update_event_cb): emit "event_changed" signal
(e_day_view_reshape_day_event): emit "event_added" signal
(e_day_view_reshape_long_event): emit "event_added" signal
* gui/e-week-view.c (e_week_view_class_init): init a11y.
(e_week_view_find_event_from_item): make it public from private
(e_week_view_update_event_cb): emit "event_changed" signal
(e_week_view_reshape_event_span): emit "event_added" signal
* gui/gnome-cal.c (gnome_calendar_class_init): init a11y.
(gnome_calendar_get_e_calendar_widget),
(gnome_calendar_get_search_bar_widget),
(gnome_calendar_get_view_notebook_widget): new functions
svn path=/trunk/; revision=22303
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/Makefile.am | 2 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.c | 18 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.h | 1 | ||||
-rw-r--r-- | calendar/gui/e-cal-view.c | 29 | ||||
-rw-r--r-- | calendar/gui/e-cal-view.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 29 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 26 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 5 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 17 | ||||
-rw-r--r-- | calendar/gui/e-week-view.h | 4 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 27 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.h | 10 |
13 files changed, 150 insertions, 22 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index eef7821858..ec37100bb0 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -73,6 +73,7 @@ INCLUDES = \ -I$(top_srcdir)/addressbook/backend \ -I$(top_builddir)/addressbook/backend \ -I$(top_srcdir)/widgets \ + -I$(top_srcdir)/a11y/calendar \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ @@ -194,6 +195,7 @@ libevolution_calendar_la_LIBADD = \ $(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \ $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ + $(top_builddir)/a11y/libevolution-a11y.la \ $(EVOLUTION_CALENDAR_LIBS) libevolution_calendar_la_LDFLAGS = -avoid-version -module diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index cda78827df..6b91e79463 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -419,16 +419,15 @@ get_shell_view_interface (BonoboControl *control) return shell_view; } -/* Displays the currently displayed time range in the folder bar label on the - shell view, according to which view we are showing. */ -void -calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control) +const gchar * +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; - char buffer[512], end_buffer[256]; + static char buffer[512]; + char end_buffer[256]; GnomeCalendarViewType view; gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time); @@ -512,8 +511,17 @@ calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control) break; default: g_assert_not_reached (); + return NULL; } + return buffer; +} +/* Displays the currently displayed time range in the folder bar label on the + shell view, according to which view we are showing. */ +void +calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control) +{ + char *buffer = (char *)calendar_get_text_for_folder_bar_label (gcal); control_util_set_folder_bar_label (control, buffer); } diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h index 9ebac6eef4..6f418799d2 100644 --- a/calendar/gui/calendar-commands.h +++ b/calendar/gui/calendar-commands.h @@ -42,6 +42,7 @@ void calendar_goto_today (GnomeCalendar *gcal); void calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control); +const gchar * calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal); /* Used by calendar and tasks control to set the folder title bar label. */ void control_util_set_folder_bar_label (BonoboControl *control, char *label); diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index 24ff9ab570..ef3d8b9ab3 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-view.c @@ -42,6 +42,7 @@ #include "dialogs/recur-comp.h" #include "print.h" #include "goto.h" +#include "ea-calendar.h" /* Used for the status bar messages */ #define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" @@ -82,6 +83,8 @@ static GdkAtom clipboard_atom = GDK_NONE; enum { SELECTION_CHANGED, TIMEZONE_CHANGED, + EVENT_CHANGED, + EVENT_ADDED, LAST_SIGNAL }; @@ -113,10 +116,33 @@ e_cal_view_class_init (ECalViewClass *klass) cal_util_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); + e_cal_view_signals[EVENT_CHANGED] = + g_signal_new ("event_changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (ECalViewClass, event_changed), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + + e_cal_view_signals[EVENT_ADDED] = + g_signal_new ("event_added", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (ECalViewClass, event_added), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + /* Method override */ object_class->destroy = e_cal_view_destroy; klass->selection_changed = NULL; + klass->event_changed = NULL; + klass->event_added = NULL; + klass->get_selected_events = NULL; klass->get_selected_time_range = NULL; klass->set_selected_time_range = NULL; @@ -126,6 +152,9 @@ e_cal_view_class_init (ECalViewClass *klass) /* clipboard atom */ if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); + + /* init the accessibility support for e_day_view */ + e_cal_view_a11y_init (); } static void diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h index 1af47f74af..b957ad0e2d 100644 --- a/calendar/gui/e-cal-view.h +++ b/calendar/gui/e-cal-view.h @@ -76,6 +76,8 @@ struct _ECalViewClass { /* Notification signals */ void (* selection_changed) (ECalView *cal_view); void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone); + void (* event_changed) (ECalView *day_view, ECalViewEvent *event); + void (* event_added) (ECalView *day_view, ECalViewEvent *event); /* Virtual methods */ GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */ diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 24ff9ab570..ef3d8b9ab3 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -42,6 +42,7 @@ #include "dialogs/recur-comp.h" #include "print.h" #include "goto.h" +#include "ea-calendar.h" /* Used for the status bar messages */ #define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" @@ -82,6 +83,8 @@ static GdkAtom clipboard_atom = GDK_NONE; enum { SELECTION_CHANGED, TIMEZONE_CHANGED, + EVENT_CHANGED, + EVENT_ADDED, LAST_SIGNAL }; @@ -113,10 +116,33 @@ e_cal_view_class_init (ECalViewClass *klass) cal_util_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); + e_cal_view_signals[EVENT_CHANGED] = + g_signal_new ("event_changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (ECalViewClass, event_changed), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + + e_cal_view_signals[EVENT_ADDED] = + g_signal_new ("event_added", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (ECalViewClass, event_added), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + /* Method override */ object_class->destroy = e_cal_view_destroy; klass->selection_changed = NULL; + klass->event_changed = NULL; + klass->event_added = NULL; + klass->get_selected_events = NULL; klass->get_selected_time_range = NULL; klass->set_selected_time_range = NULL; @@ -126,6 +152,9 @@ e_cal_view_class_init (ECalViewClass *klass) /* clipboard atom */ if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); + + /* init the accessibility support for e_day_view */ + e_cal_view_a11y_init (); } static void diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index 1af47f74af..b957ad0e2d 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -76,6 +76,8 @@ struct _ECalViewClass { /* Notification signals */ void (* selection_changed) (ECalView *cal_view); void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone); + void (* event_changed) (ECalView *day_view, ECalViewEvent *event); + void (* event_added) (ECalView *day_view, ECalViewEvent *event); /* Virtual methods */ GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */ diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index dee466955e..307a0324bb 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -29,6 +29,7 @@ #include <config.h> #include "e-day-view.h" +#include "ea-calendar.h" #include <math.h> #include <time.h> @@ -285,10 +286,6 @@ static ECalViewPosition e_day_view_convert_position_in_main_canvas (EDayView *da gint *day_return, gint *row_return, gint *event_num_return); -static gboolean e_day_view_find_event_from_item (EDayView *day_view, - GnomeCanvasItem *item, - gint *day_return, - gint *event_num_return); static gboolean e_day_view_find_event_from_uid (EDayView *day_view, const gchar *uid, gint *day_return, @@ -439,7 +436,6 @@ static void e_day_view_queue_layout (EDayView *day_view); static void e_day_view_cancel_layout (EDayView *day_view); static gboolean e_day_view_layout_timeout_cb (gpointer data); - static GtkTableClass *parent_class; E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init, @@ -475,6 +471,9 @@ e_day_view_class_init (EDayViewClass *class) view_class->set_selected_time_range = e_day_view_set_selected_time_range; view_class->get_visible_time_range = e_day_view_get_visible_time_range; view_class->update_query = e_day_view_update_query; + + /* init the accessibility support for e_day_view */ + e_day_view_a11y_init (); } static void @@ -1650,6 +1649,10 @@ e_day_view_update_event_cb (EDayView *day_view, e_day_view_update_event_label (day_view, day, event_num); e_day_view_reshape_day_event (day_view, day, event_num); } + + g_signal_emit_by_name (G_OBJECT(day_view), + "event_changed", event); + return TRUE; } @@ -1902,7 +1905,7 @@ e_day_view_update_long_event_label (EDayView *day_view, /* Finds the day and index of the event with the given canvas item. If is is a long event, -1 is returned as the day. Returns TRUE if the event was found. */ -static gboolean +gboolean e_day_view_find_event_from_item (EDayView *day_view, GnomeCanvasItem *item, gint *day_return, @@ -4490,6 +4493,9 @@ e_day_view_reshape_long_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_signal_emit_by_name (G_OBJECT(day_view), + "event_added", event); + e_day_view_update_long_event_label (day_view, event_num); } @@ -4648,6 +4654,9 @@ e_day_view_reshape_day_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_signal_emit_by_name (G_OBJECT(day_view), + "event_added", event); + e_day_view_update_event_label (day_view, day, event_num); } @@ -5146,9 +5155,10 @@ e_day_view_focus (GtkWidget *widget, GtkDirectionType direction) } if (new_day != E_DAY_VIEW_LONG_EVENT && new_day != -1) { - if (e_day_view_get_event_rows (day_view, new_day, new_event_num, + if (e_day_view_get_event_rows (day_view, new_day, + new_event_num, &start_row, &end_row)) - /* ajust the scrollbar to ensure the event to be seen */ + /* ensure the event to be seen */ e_day_view_ensure_rows_visible (day_view, start_row, end_row); } diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 3a16da7daa..1e903ff59c 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -588,6 +588,11 @@ gint e_day_view_get_time_string_width (EDayView *day_view); gint e_day_view_event_sort_func (const void *arg1, const void *arg2); +gboolean e_day_view_find_event_from_item (EDayView *day_view, + GnomeCanvasItem *item, + gint *day_return, + gint *event_num_return); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index fb91cd22d3..621d2e485c 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -30,6 +30,7 @@ #include <config.h> #include "e-week-view.h" +#include "ea-calendar.h" #include <math.h> #include <gdk/gdkkeysyms.h> @@ -154,10 +155,6 @@ static void e_week_view_on_editing_started (EWeekView *week_view, GnomeCanvasItem *item); static void e_week_view_on_editing_stopped (EWeekView *week_view, GnomeCanvasItem *item); -static gboolean e_week_view_find_event_from_item (EWeekView *week_view, - GnomeCanvasItem *item, - gint *event_num, - gint *span_num); static gboolean e_week_view_find_event_from_uid (EWeekView *week_view, const gchar *uid, gint *event_num_return); @@ -232,6 +229,9 @@ e_week_view_class_init (EWeekViewClass *class) view_class->set_selected_time_range = e_week_view_set_selected_time_range; view_class->get_visible_time_range = e_week_view_get_visible_time_range; view_class->update_query = e_week_view_update_query; + + /* init the accessibility support for e_week_view */ + e_week_view_a11y_init (); } static void @@ -1900,6 +1900,9 @@ e_week_view_update_event_cb (EWeekView *week_view, span_num); } } + g_signal_emit_by_name (G_OBJECT(week_view), + "event_changed", event); + return TRUE; } @@ -2378,7 +2381,6 @@ e_week_view_add_event (CalComponent *comp, week_view->day_starts[0], week_view->day_starts[num_days], start, end); #endif - g_return_val_if_fail (start <= end, TRUE); g_return_val_if_fail (start < week_view->day_starts[num_days], TRUE); g_return_val_if_fail (end > week_view->day_starts[0], TRUE); @@ -2644,6 +2646,9 @@ e_week_view_reshape_event_span (EWeekView *week_view, g_signal_connect (span->text_item, "event", G_CALLBACK (e_week_view_on_text_item_event), week_view); + g_signal_emit_by_name (G_OBJECT(week_view), + "event_added", event); + } /* Calculate the position of the text item. @@ -3215,7 +3220,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view, } -static gboolean +gboolean e_week_view_find_event_from_item (EWeekView *week_view, GnomeCanvasItem *item, gint *event_num_return, diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index c12ad0cfca..db821a2639 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -435,6 +435,10 @@ gint e_week_view_get_time_string_width (EWeekView *week_view); gint e_week_view_event_sort_func (const void *arg1, const void *arg2); +gboolean e_week_view_find_event_from_item (EWeekView *week_view, + GnomeCanvasItem *item, + gint *event_num_return, + gint *span_num_return); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index d127f46079..a67f20e9a7 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -57,6 +57,7 @@ #include "calendar-view-factory.h" #include "tag-calendar.h" #include "misc.h" +#include "ea-calendar.h" extern ECompEditorRegistry *comp_editor_registry; @@ -353,6 +354,9 @@ gnome_calendar_class_init (GnomeCalendarClass *class) "goto_date",1, G_TYPE_ENUM, GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK); + /* init the accessibility support for gnome_calendar */ + gnome_calendar_a11y_init (); + } /* Callback used when the calendar query reports of an updated object */ @@ -3120,3 +3124,26 @@ gnome_calendar_get_task_pad (GnomeCalendar *gcal) return E_CALENDAR_TABLE (gcal->priv->todo); } +GtkWidget * +gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal) +{ + g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); + + return GTK_WIDGET(gcal->priv->date_navigator); +} + +GtkWidget * +gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal) +{ + g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); + + return GTK_WIDGET(gcal->priv->search_bar); +} + +GtkWidget * +gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal) +{ + g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); + + return GTK_WIDGET(gcal->priv->notebook); +} diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 02c77703d2..f3f9d3dc06 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -87,7 +87,7 @@ struct _GnomeCalendarClass { void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in); void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in); - void (* goto_date) (GnomeCalendar *day_view, + void (* goto_date) (GnomeCalendar *gcal, GnomeCalendarGotoDateType date); }; @@ -101,8 +101,6 @@ GtkWidget *gnome_calendar_new (void); void gnome_calendar_set_ui_component (GnomeCalendar *cal, BonoboUIComponent *ui_component); -ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal); - CalClient *gnome_calendar_get_cal_client (GnomeCalendar *gcal); CalClient *gnome_calendar_get_task_pad_cal_client(GnomeCalendar *gcal); @@ -124,6 +122,12 @@ void gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_ty gboolean range_selected, gboolean grab_focus); GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal); + +ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal); +GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal); +GtkWidget *gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal); +GtkWidget *gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal); + void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic); void gnome_calendar_discard_view_menus (GnomeCalendar *gcal); |