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
This commit is contained in:
Bolian Yin
2003-08-20 08:05:00 +00:00
committed by Bolian Yin
parent 7bb25afd43
commit ef5eb5facd
14 changed files with 169 additions and 22 deletions

View File

@ -1,3 +1,22 @@
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
2003-08-12 Hans Petter Jansson <hpj@ximian.com>
* gui/calendar-offline-handler.c (impl_dispose): Chain. Prevent

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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);
}

View File

@ -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 */

View File

@ -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,

View File

@ -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 */

View File

@ -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);
}

View File

@ -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);