diff options
author | Li Yuan <li.yuan@sun.com> | 2005-01-27 13:16:19 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2005-01-27 13:16:19 +0800 |
commit | d8d481373ff47bc77432b2f8d8de91afd1bd02a0 (patch) | |
tree | 8e8965a9867437704b2a317f2a52ff1a0880f71d | |
parent | 7b6ba9e828c68f9229bcb8ad41a550119260aef6 (diff) | |
download | gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.gz gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.bz2 gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.lz gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.xz gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.zst gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.zip |
add an a11y name for the popup list. make shortcut key ALT+Arrow work.
2005-01-27 Li Yuan <li.yuan@sun.com>
* e-cell-combo.c: (e_cell_combo_init), (e_cell_combo_do_popup),
(e_cell_combo_list_button_press), (e_cell_combo_button_press),
(e_cell_combo_button_release), (e_cell_combo_key_press):
add an a11y name for the popup list.
make shortcut key ALT+Arrow work.
Fixes #70261
* e-cell-text.c: (e_cell_text_class_init), (_delete_selection),
(_insert):
add "text_inserted" and "text_deleted" signals to notify the
text has been changed.
(e_cell_text_get_text_by_view):
new helper function to get the text being editted.
* e-cell-text.h:
add signal declaration.
* e-cell-toggle.c: (etog_draw):
add range check for negative values.
* e-cell-vbox.c: (e_cell_vbox_class_init):
* e-cell-vbox.h:
make ECellVboxView public since it will be used in a11y part.
* e-table-click-to-add.c: (etcta_style_set),
(create_rect_and_text), (etcta_realize), (etcta_class_init),
(e_table_click_to_add_commit):
add "style_set" signal to click_to_add and implement
the style_set function.
(etcta_init):
add a11y name to click to add.
* e-table-click-to-add.h:
add "style_set" signal to click_to_add and implement
the style_set function.
* e-table-config.c: (config_button_up), (config_button_down):
check whether the columns are empty.
* e-table-group-container.c:
* e-table-group-container.h:
make ETableGroupContainerChildNode public since it
will be used in a11y part.
* e-table-item.c: (eti_init):
init eti->cols.
(eti_event):
at GDK_KEY_PRESS event and GDK_Down key pressed, we check
view_col value before we pass it to eti_e_cell_event.
(eti_class_init):
call the new initialize function
* e-table.c: (table_canvas_focus_event_cb):
if canvas has a focused item but the etable does not
have a cursor row, just focus the first item after check
whether the click_to_add should get the focus.
svn path=/trunk/; revision=28571
-rw-r--r-- | widgets/table/e-cell-combo.c | 10 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 74 | ||||
-rw-r--r-- | widgets/table/e-cell-text.h | 6 | ||||
-rw-r--r-- | widgets/table/e-cell-toggle.c | 2 | ||||
-rw-r--r-- | widgets/table/e-cell-vbox.c | 11 | ||||
-rw-r--r-- | widgets/table/e-cell-vbox.h | 7 | ||||
-rw-r--r-- | widgets/table/e-table-click-to-add.c | 110 | ||||
-rw-r--r-- | widgets/table/e-table-click-to-add.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table-config.c | 10 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.c | 9 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.h | 10 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 15 | ||||
-rw-r--r-- | widgets/table/e-table.c | 8 |
13 files changed, 210 insertions, 63 deletions
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index 5b66fba28e..3ff3488ae5 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -56,6 +56,7 @@ #include <string.h> /* strcmp() */ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> +#include <glib/gi18n.h> #include "gal/util/e-util.h" #include "gal/widgets/e-unicode.h" #include "e-table-item.h" @@ -135,6 +136,7 @@ static void e_cell_combo_init (ECellCombo *ecc) { GtkWidget *frame; + AtkObject *a11y; /* We create one popup window for the ECell, since there will only ever be one popup in use at a time. */ @@ -167,6 +169,9 @@ e_cell_combo_init (ECellCombo *ecc) gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); gtk_widget_show (ecc->popup_list); + a11y = gtk_widget_get_accessible (ecc->popup_list); + atk_object_set_name (a11y, _("popup list")); + g_signal_connect (ecc->popup_list, "selection_changed", G_CALLBACK (e_cell_combo_selection_changed), @@ -285,6 +290,7 @@ e_cell_combo_do_popup (ECellPopup *ecp, if (error_code != 0) g_warning ("Failed to get pointer grab (%i)", error_code); gtk_grab_add (ecc->popup_window); + gdk_keyboard_grab (ecc->popup_list->window, TRUE, time); return TRUE; } @@ -516,6 +522,7 @@ e_cell_combo_list_button_press(GtkWidget *popup_list, GdkEvent *event, ECellComb e_cell_combo_update_cell (ecc); gtk_grab_remove (ecc->popup_window); gdk_pointer_ungrab (event->button.time); + gdk_keyboard_ungrab (event->button.time); gtk_widget_hide (ecc->popup_window); e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE); @@ -555,6 +562,7 @@ e_cell_combo_button_press (GtkWidget *popup_window, gtk_grab_remove (ecc->popup_window); gdk_pointer_ungrab (event->button.time); + gdk_keyboard_ungrab (event->button.time); gtk_widget_hide (ecc->popup_window); e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE); @@ -596,6 +604,7 @@ e_cell_combo_button_release (GtkWidget *popup_window, update the cell to reflect the new selection. */ gtk_grab_remove (ecc->popup_window); gdk_pointer_ungrab (event->time); + gdk_keyboard_ungrab (event->time); gtk_widget_hide (ecc->popup_window); e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE); @@ -625,6 +634,7 @@ e_cell_combo_key_press (GtkWidget *popup_window, gtk_grab_remove (ecc->popup_window); gdk_pointer_ungrab (event->time); + gdk_keyboard_ungrab (event->time); gtk_widget_hide (ecc->popup_window); e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE); diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index ecb9117e1c..cbc0fddca8 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -59,6 +59,7 @@ #define d(x) #define DO_SELECTION 1 +#define VIEW_TO_CELL(view) E_CELL_TEXT (((ECellView *)view)->ecell) #if d(!)0 #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) @@ -94,6 +95,15 @@ enum { E_SELECTION_CLIPBOARD }; +/* signals */ +enum { + TEXT_INSERTED, + TEXT_DELETED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0 }; + static GdkAtom clipboard_atom = GDK_NONE; #define PARENT_TYPE e_cell_get_type () @@ -1698,6 +1708,30 @@ e_cell_text_class_init (GObjectClass *object_class) parent_class = g_type_class_ref (PARENT_TYPE); + signals [TEXT_INSERTED] = + g_signal_new ("text_inserted", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (ECellTextClass, text_inserted), + NULL, NULL, + e_marshal_VOID__POINTER_INT_INT_INT_INT, + G_TYPE_NONE, 5, + G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); + + signals [TEXT_DELETED] = + g_signal_new ("text_deleted", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (ECellTextClass, text_deleted), + NULL, NULL, + e_marshal_VOID__POINTER_INT_INT_INT_INT, + G_TYPE_NONE, 5, + G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); + + + g_object_class_install_property (object_class, PROP_STRIKEOUT_COLUMN, g_param_spec_int ("strikeout_column", _("Strikeout Column"), @@ -2182,6 +2216,8 @@ _delete_selection (ECellTextView *text_view) memmove (sp, ep, length); edit->selection_end = edit->selection_start; + + g_signal_emit (VIEW_TO_CELL (text_view), signals[TEXT_DELETED], 0, text_view, edit->selection_start, ep-sp, edit->row, edit->model_col); } /* fixme: */ @@ -2209,6 +2245,8 @@ _insert (ECellTextView *text_view, char *string, int value) edit->selection_start += value; edit->selection_end = edit->selection_start; + + g_signal_emit (VIEW_TO_CELL (text_view), signals[TEXT_INSERTED], 0, text_view, edit->selection_end-value, value, edit->row, edit->model_col); } static void @@ -2778,3 +2816,39 @@ e_cell_text_delete_selection (ECellView *cell_view, gint col, gint row) command.position = E_TEP_SELECTION; e_cell_text_view_command (edit->tep, &command, edit); } + +/** + * e_cell_text_get_text_by_view: + * @cell_view: the given cell view + * @col: column of the given cell in the model + * @row: row of the given cell in the model + * + * Get the cell's text directly from CellEdit, + * during editting this cell, the cell's text value maybe inconsistant + * with the text got from table_model. + * The caller should free the text after using it. + * + * This API is most likely to be used by a11y implementations. + */ +char * +e_cell_text_get_text_by_view (ECellView *cell_view, gint col, gint row) +{ + ECellTextView *ectv; + CellEdit *edit; + gchar *ret, *model_text; + + ectv = (ECellTextView *)cell_view; + edit = ectv->edit; + + if (edit && ectv->edit->row == row && ectv->edit->model_col == col) { /* being editted now */ + ret = g_strdup (edit->text); + } else{ + model_text = e_cell_text_get_text (E_CELL_TEXT (cell_view->ecell), + cell_view->e_table_model, col, row); + ret = g_strdup (model_text); + e_cell_text_free_text (E_CELL_TEXT (cell_view->ecell), model_text); + } + + return ret; + +} diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h index 5310ffc5f9..0ef32b9ede 100644 --- a/widgets/table/e-cell-text.h +++ b/widgets/table/e-cell-text.h @@ -84,6 +84,9 @@ typedef struct { char *(*get_text) (ECellText *cell, ETableModel *model, int col, int row); void (*free_text) (ECellText *cell, char *text); void (*set_value) (ECellText *cell, ETableModel *model, int col, int row, const char *text); + /* signal handlers */ + void (*text_inserted) (ECellText *cell, ECellView *cell_view, int pos, int len, int row, int model_col); + void (*text_deleted) (ECellText *cell, ECellView *cell_view, int pos, int len, int row, int model_col); } ECellTextClass; GType e_cell_text_get_type (void); @@ -116,6 +119,9 @@ void e_cell_text_paste_clipboard (ECellView *cell_view, gint col, gint row); /* Deletes selected text */ void e_cell_text_delete_selection (ECellView *cell_view, gint col, gint row); +/* get text directly from view, both col and row are model format */ +char *e_cell_text_get_text_by_view (ECellView *cell_view, gint col, gint row); + G_END_DECLS #endif /* _E_CELL_TEXT_H_ */ diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index f334c3f6ca..34e8a8b76d 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -201,7 +201,7 @@ etog_draw (ECellView *ecell_view, GdkDrawable *drawable, selected = flags & E_CELL_SELECTED; - if (value >= toggle->n_states){ + if (value < 0 || value >= toggle->n_states){ g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", value, toggle->n_states); return; diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c index ab86e307c9..ee18694742 100644 --- a/widgets/table/e-cell-vbox.c +++ b/widgets/table/e-cell-vbox.c @@ -42,18 +42,13 @@ #include <gdk/gdkkeysyms.h> #include "gal/util/e-util.h" +#include "gal/a11y/e-table/gal-a11y-e-cell-registry.h" +#include "gal/a11y/e-table/gal-a11y-e-cell-vbox.h" #include "e-table-item.h" #include "e-cell-vbox.h" #define PARENT_TYPE e_cell_get_type () -typedef struct { - ECellView cell_view; - int subcell_view_count; - ECellView **subcell_views; - int *model_cols; -} ECellVboxView; - static ECellClass *parent_class; #define INDENT_AMOUNT 16 @@ -443,6 +438,8 @@ e_cell_vbox_class_init (GObjectClass *object_class) #endif parent_class = g_type_class_ref (PARENT_TYPE); + + gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_VBOX_TYPE, gal_a11y_e_cell_vbox_new); } static void diff --git a/widgets/table/e-cell-vbox.h b/widgets/table/e-cell-vbox.h index 93ddc6d25c..f08e106128 100644 --- a/widgets/table/e-cell-vbox.h +++ b/widgets/table/e-cell-vbox.h @@ -50,6 +50,13 @@ typedef struct { } ECellVbox; typedef struct { + ECellView cell_view; + int subcell_view_count; + ECellView **subcell_views; + int *model_cols; +} ECellVboxView; + +typedef struct { ECellClass parent_class; } ECellVboxClass; diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index c02e3b8869..69095c28d3 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -29,7 +29,8 @@ #include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <atk/atkregistry.h> - +#include <atk/atkutil.h> +#include <atk/atkgobjectaccessible.h> #include "e-table-header.h" #include "e-table-click-to-add.h" #include "e-table-defines.h" @@ -44,6 +45,7 @@ enum { CURSOR_CHANGE, + STYLE_SET, LAST_SIGNAL }; @@ -73,6 +75,26 @@ etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *et } static void +etcta_style_set (ETableClickToAdd *etcta, GtkStyle *previous_style) +{ + GtkWidget *widget = GTK_WIDGET(GNOME_CANVAS_ITEM(etcta)->canvas); + + if (etcta->rect) { + gnome_canvas_item_set (etcta->rect, + "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL], + "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL], + NULL ); + + } + + if (etcta->text) + gnome_canvas_item_set (etcta->text, + "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL], + NULL); + +} + +static void etcta_add_table_header (ETableClickToAdd *etcta, ETableHeader *header) { etcta->eth = header; @@ -215,6 +237,33 @@ etcta_set_property (GObject *object, guint prop_id, const GValue *value, GParamS } static void +create_rect_and_text (ETableClickToAdd *etcta) +{ + GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM(etcta)->canvas); + + if (!etcta->rect) + etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), + gnome_canvas_rect_get_type(), + "x1", (double) 0, + "y1", (double) 0, + "x2", (double) etcta->width - 1, + "y2", (double) etcta->height - 1, + "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL], + "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL], + NULL); + + if (!etcta->text) + etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), + e_text_get_type(), + "text", etcta->message ? etcta->message : "", + "anchor", GTK_ANCHOR_NW, + "width", etcta->width - 4, + "draw_background", FALSE, + "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL], + NULL); +} + +static void etcta_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { ETableClickToAdd *etcta; @@ -248,23 +297,7 @@ etcta_realize (GnomeCanvasItem *item) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); - etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) etcta->width - 1, - "y2", (double) etcta->height - 1, - "outline_color", "black", - "fill_color", "white", - NULL); - - etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), - e_text_get_type(), - "text", etcta->message ? etcta->message : "", - "anchor", GTK_ANCHOR_NW, - "width", etcta->width - 4, - "draw_background", FALSE, - NULL); + create_rect_and_text (etcta); e_canvas_item_move_absolute (etcta->text, 2, 2); if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize) @@ -448,6 +481,7 @@ etcta_class_init (ETableClickToAddClass *klass) etcta_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); klass->cursor_change = NULL; + klass->style_set = etcta_style_set; object_class->dispose = etcta_dispose; object_class->set_property = etcta_set_property; @@ -501,6 +535,16 @@ etcta_class_init (ETableClickToAddClass *klass) e_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + etcta_signals [STYLE_SET] = + g_signal_new ("style_set", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClickToAddClass, style_set), + NULL, NULL, + e_marshal_NONE__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_STYLE); + + atk_registry_set_factory_type (atk_get_default_registry (), E_TABLE_CLICK_TO_ADD_TYPE, gal_a11y_e_table_click_to_add_factory_get_type ()); @@ -511,6 +555,7 @@ static void etcta_init (GnomeCanvasItem *item) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); + AtkObject *a11y; etcta->one = NULL; etcta->model = NULL; @@ -527,6 +572,12 @@ etcta_init (GnomeCanvasItem *item) G_CALLBACK (etcta_cursor_change), etcta); e_canvas_item_set_reflow_callback(item, etcta_reflow); + + /* create its a11y object at this time if accessibility is enabled*/ + if (atk_get_root () != NULL) { + a11y = atk_gobject_accessible_for_object (G_OBJECT (etcta)); + atk_object_set_name (a11y, _("click to add")); + } } E_MAKE_TYPE(e_table_click_to_add, "ETableClickToAdd", ETableClickToAdd, etcta_class_init, etcta_init, PARENT_OBJECT_TYPE) @@ -549,25 +600,6 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta) gtk_object_destroy(GTK_OBJECT (etcta->row)); etcta->row = NULL; } - if (!etcta->rect) { - etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) etcta->width - 1, - "y2", (double) etcta->height - 1, - "outline_color", "black", - "fill_color", "white", - NULL); - } - if (!etcta->text) { - etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), - e_text_get_type(), - "text", etcta->message ? etcta->message : "", - "anchor", GTK_ANCHOR_NW, - "width", etcta->width - 4, - "draw_background", FALSE, - NULL); - e_canvas_item_move_absolute (etcta->text, 3, 3); - } + create_rect_and_text (etcta); + e_canvas_item_move_absolute (etcta->text, 3, 3); } diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h index f5417e23f9..42ffd42d07 100644 --- a/widgets/table/e-table-click-to-add.h +++ b/widgets/table/e-table-click-to-add.h @@ -66,6 +66,7 @@ typedef struct { * signals */ void (*cursor_change) (ETableClickToAdd *etcta, gint row, gint col); + void (*style_set) (ETableClickToAdd *etcta, GtkStyle *previous_style); } ETableClickToAddClass; GType e_table_click_to_add_get_type (void); diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 2ad23b7120..4e40c150fd 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -947,6 +947,11 @@ config_button_up (GtkWidget *widget, ETableConfig *config) int i; e_table_selected_row_foreach (config->shown, add_column, &columns); + + /* if no columns left, just return */ + if (columns == NULL) + return; + columns = g_list_reverse (columns); new_shown = g_new (int, config->temp_state->col_count); @@ -998,6 +1003,11 @@ config_button_down (GtkWidget *widget, ETableConfig *config) e_table_selected_row_foreach (config->shown, add_column, &columns); + /* if no columns left, just return */ + if (columns == NULL) + return; + + new_shown = g_new (int, config->temp_state->col_count); new_expansions = g_new (double, config->temp_state->col_count); diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 61b8b9f1a5..2fc0617e8f 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -59,15 +59,6 @@ enum { PROP_UNIFORM_ROW_HEIGHT }; -typedef struct { - ETableGroup *child; - void *key; - char *string; - GnomeCanvasItem *text; - GnomeCanvasItem *rect; - gint count; -} ETableGroupContainerChildNode; - static EPrintable * etgc_get_printable (ETableGroup *etg); diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index b094167c09..d1809e48fd 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -84,6 +84,16 @@ typedef struct { ETableGroupClass parent_class; } ETableGroupContainerClass; +typedef struct { + ETableGroup *child; + void *key; + char *string; + GnomeCanvasItem *text; + GnomeCanvasItem *rect; + gint count; +} ETableGroupContainerChildNode; + + ETableGroup *e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, ETableHeader *header, ETableModel *model, ETableSortInfo *sort_info, int n); void e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index a582502b7b..33798cc716 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -44,6 +44,7 @@ #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/util/e-util.h" +#include "gal/a11y/e-table/gal-a11y-e-table-item.h" #include "gal/util/e-i18n.h" #include <string.h> #include <stdlib.h> @@ -1647,6 +1648,7 @@ eti_init (GnomeCanvasItem *item) eti->cursor_y2 = -1; eti->rows = -1; + eti->cols = -1; eti->frozen_count = 0; eti->queue_show_cursor = FALSE; @@ -2669,9 +2671,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) case GDK_KP_Down: if ((e->key.state & GDK_MOD1_MASK) && ((e->key.keyval == GDK_Down ) || (e->key.keyval == GDK_KP_Down))) { - gint view_col = model_to_view_col(eti, cursor_col); - if (eti_e_cell_event (eti, eti->cell_views [view_col], e, ((GdkEventKey *)e)->time, cursor_col, view_col, model_to_view_row(eti, cursor_row), E_CELL_CURSOR)) - return TRUE; + gint view_col = model_to_view_col(eti, cursor_col); + if ((view_col >= 0) && (view_col < eti->cols)) + if (eti_e_cell_event (eti, eti->cell_views [view_col], e, ((GdkEventKey *)e)->time, cursor_col, view_col, model_to_view_row(eti, cursor_row), E_CELL_CURSOR)) + return TRUE; } else return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); break; @@ -3124,10 +3127,8 @@ eti_class_init (GObjectClass *object_class) G_TYPE_NONE, 1, G_TYPE_POINTER); - atk_registry_set_factory_type (atk_get_default_registry (), - E_TABLE_ITEM_TYPE, - gal_a11y_e_table_item_factory_get_type ()); - + /* A11y Init */ + gal_a11y_e_table_item_init (); } E_MAKE_TYPE (e_table_item, diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 00aa37e88b..200b78b151 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1126,6 +1126,14 @@ table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer d focus_first_etable_item (etable->group); } else if (canvas->focused_item) { ESelectionModel *selection = (ESelectionModel *)etable->selection; + + /* check whether click_to_add already got the focus */ + if (etable->click_to_add) { + GnomeCanvasItem *row = E_TABLE_CLICK_TO_ADD(etable->click_to_add)->row; + if (canvas->focused_item == row) + return TRUE; + } + if (e_selection_model_cursor_row (selection) == -1) focus_first_etable_item (etable->group); } |