Re: [g-a-devel]RFE: boolean returns in several at-spi methods
- From: Bill Haneman <bill haneman sun com>
- To: gnome2-release-team gnome org, gnome-accessibility-devel gnome org
- Subject: Re: [g-a-devel]RFE: boolean returns in several at-spi methods
- Date: Mon, 15 Apr 2002 16:20:09 +0100
Bill Haneman wrote:
>
> Hi:
>
> The following at-spi idl methods do not currently return boolean
> values to indicate success...
Here is the patch.
-Bill
? boolean-patch.diff
? table-selection-patch.diff
? atspi-boolean-patch.diff
? docs/reference/cspi/tmpl/at-spi-cspi-unused.sgml
? registryd/at-spi-registryd
? test/key-listener-test
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-spi/ChangeLog,v
retrieving revision 1.184
diff -u -r1.184 ChangeLog
--- ChangeLog 15 Apr 2002 11:25:09 -0000 1.184
+++ ChangeLog 15 Apr 2002 14:17:27 -0000
@@ -1,3 +1,33 @@
+2002-04-15 Bill Haneman <bill haneman sun com>
+
+ * idl/Accessibility_Component.idl
+ (Accessibility_Component_grabFocus):
+ Made this method return boolean to indicate success or failure, to
+ be consistent with cspi and the corresponding ATK method.
+
+ * idl/Accessibility_Selection.idl
+ (Accessibility_Selection_selectAll) :
+ Made these methods return boolean to indicate success or
+ failure, to be consistent with cspi and the corresponding ATK methods.
+
+ * idl/Accessibility_EditableText.idl
+ (Accessibility_EditableText_setTextContents,
+ Accessibility_EditableText_insertText,
+ Accessibility_EditableText_cutText,
+ Accessibility_EditableText_deleteText,
+ Accessibility_EditableText_pasteText):
+ Made these methods return boolean to indicate
+ success or failure.
+
+ * cspi/spi_editabletext.c:
+ Made these methods return booleans.
+
+ * libspi/selection.c:
+ * libspi/component.c:
+ * libspi/editabletext.c:
+ Connected the boolean returns from ATK
+ to the server-side code referenced above.
+
2002-04-14 Bill Haneman <bill haneman sun com>
* idl/Accessibility_Table.idl: Added missing methods,
Index: cspi/spi.h
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi.h,v
retrieving revision 1.44
diff -u -r1.44 spi.h
--- cspi/spi.h 8 Jan 2002 09:11:44 -0000 1.44
+++ cspi/spi.h 15 Apr 2002 14:17:28 -0000
@@ -305,7 +305,7 @@
long int *height);
AccessibleComponentLayer
AccessibleComponent_getLayer (AccessibleComponent *obj);
-void AccessibleComponent_grabFocus (AccessibleComponent *obj);
+SPIBoolean AccessibleComponent_grabFocus (AccessibleComponent *obj);
short AccessibleComponent_getMDIZOrder(AccessibleComponent *obj);
/* AccessibleEditableText function prototypes */
@@ -486,7 +486,7 @@
SPIBoolean
AccessibleSelection_selectAll (AccessibleSelection *obj);
-void
+SPIBoolean
AccessibleSelection_clearSelection (AccessibleSelection *obj);
Index: cspi/spi_component.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_component.c,v
retrieving revision 1.16
diff -u -r1.16 spi_component.c
--- cspi/spi_component.c 10 Dec 2001 20:29:40 -0000 1.16
+++ cspi/spi_component.c 15 Apr 2002 14:17:28 -0000
@@ -273,8 +273,12 @@
*
* Attempt to set the keyboard input focus to the specified
* #AccessibleComponent.
+ *
+ * Returns: #TRUE if successful, #FALSE otherwise.
+ *
**/
-void
+SPIBoolean
AccessibleComponent_grabFocus (AccessibleComponent *obj)
{
+ return FALSE;
}
Index: cspi/spi_selection.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_selection.c,v
retrieving revision 1.15
diff -u -r1.15 spi_selection.c
--- cspi/spi_selection.c 11 Dec 2001 14:55:28 -0000 1.15
+++ cspi/spi_selection.c 15 Apr 2002 14:17:28 -0000
@@ -202,14 +202,19 @@
*
* Clear the current selection, removing all selected children from the
* specified #AccessibleSelection implementor's selection list.
+ *
+ * Returns: #TRUE if successful, #FALSE otherwise.
+ *
**/
-void
+SPIBoolean
AccessibleSelection_clearSelection (AccessibleSelection *obj)
{
cspi_return_if_fail (obj != NULL);
Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ());
cspi_check_ev ("clearSelection");
+
+ return TRUE;
}
Index: docs/reference/cspi/tmpl/spi_component.sgml
===================================================================
RCS file: /cvs/gnome/at-spi/docs/reference/cspi/tmpl/spi_component.sgml,v
retrieving revision 1.6
diff -u -r1.6 spi_component.sgml
--- docs/reference/cspi/tmpl/spi_component.sgml 12 Feb 2002 14:11:44 -0000 1.6
+++ docs/reference/cspi/tmpl/spi_component.sgml 15 Apr 2002 14:17:29 -0000
@@ -138,5 +138,6 @@
</para>
@obj:
+ Returns:
Index: docs/reference/cspi/tmpl/spi_selection.sgml
===================================================================
RCS file: /cvs/gnome/at-spi/docs/reference/cspi/tmpl/spi_selection.sgml,v
retrieving revision 1.4
diff -u -r1.4 spi_selection.sgml
--- docs/reference/cspi/tmpl/spi_selection.sgml 12 Feb 2002 14:11:44 -0000 1.4
+++ docs/reference/cspi/tmpl/spi_selection.sgml 15 Apr 2002 14:17:29 -0000
@@ -89,6 +89,7 @@
</para>
@obj:
+ Returns:
<!-- ##### FUNCTION AccessibleSelection_selectAll ##### -->
Index: idl/Accessibility_Component.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Component.idl,v
retrieving revision 1.7
diff -u -r1.7 Accessibility_Component.idl
--- idl/Accessibility_Component.idl 1 Jan 2002 22:35:29 -0000 1.7
+++ idl/Accessibility_Component.idl 15 Apr 2002 14:17:29 -0000
@@ -44,7 +44,7 @@
void getSize (out long width, out long height);
ComponentLayer getLayer ();
short getMDIZOrder ();
- void grabFocus ();
+ boolean grabFocus ();
void registerFocusHandler (in EventListener handler);
void deregisterFocusHandler (in EventListener handler);
Index: idl/Accessibility_EditableText.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_EditableText.idl,v
retrieving revision 1.3
diff -u -r1.3 Accessibility_EditableText.idl
--- idl/Accessibility_EditableText.idl 1 Jan 2002 22:35:29 -0000 1.3
+++ idl/Accessibility_EditableText.idl 15 Apr 2002 14:17:29 -0000
@@ -26,13 +26,13 @@
interface EditableText : Text {
- void setTextContents (in string newContents);
- void insertText (in long position, in string text, in long length);
+ boolean setTextContents (in string newContents);
+ boolean insertText (in long position, in string text, in long length);
boolean setAttributes (in string attributes, in long startPos, in long endPos);
void copyText (in long startPos, in long endPos);
- void cutText (in long startPos, in long endPos);
- void deleteText (in long startPos, in long endPos);
- void pasteText (in long position);
+ boolean cutText (in long startPos, in long endPos);
+ boolean deleteText (in long startPos, in long endPos);
+ boolean pasteText (in long position);
/**
* unImplemented5:
*
Index: idl/Accessibility_Selection.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Selection.idl,v
retrieving revision 1.5
diff -u -r1.5 Accessibility_Selection.idl
--- idl/Accessibility_Selection.idl 1 Jan 2002 22:35:30 -0000 1.5
+++ idl/Accessibility_Selection.idl 15 Apr 2002 14:17:29 -0000
@@ -30,8 +30,8 @@
boolean selectChild (in long childIndex);
boolean deselectSelectedChild (in long selectedChildIndex);
boolean isChildSelected (in long childIndex);
- void selectAll ();
- void clearSelection ();
+ boolean selectAll ();
+ boolean clearSelection ();
/**
* unImplemented:
Index: libspi/editabletext.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/editabletext.c,v
retrieving revision 1.13
diff -u -r1.13 editabletext.c
--- libspi/editabletext.c 18 Dec 2001 13:38:44 -0000 1.13
+++ libspi/editabletext.c 15 Apr 2002 14:17:29 -0000
@@ -39,11 +39,11 @@
const CORBA_long startPos,
const CORBA_long endPos,
CORBA_Environment *ev);
-static void
+static CORBA_boolean
impl_setTextContents (PortableServer_Servant servant,
const CORBA_char * newContents,
CORBA_Environment *ev);
-static void
+static CORBA_boolean
impl_insertText (PortableServer_Servant servant,
const CORBA_long position,
const CORBA_char * text,
@@ -53,15 +53,15 @@
impl_copyText (PortableServer_Servant servant,
const CORBA_long startPos, const CORBA_long endPos,
CORBA_Environment *ev);
-static void
+static CORBA_boolean
impl_cutText (PortableServer_Servant servant,
const CORBA_long startPos, const CORBA_long endPos,
CORBA_Environment *ev);
-static void
+static CORBA_boolean
impl_deleteText (PortableServer_Servant servant,
const CORBA_long startPos, const CORBA_long endPos,
CORBA_Environment *ev);
-static void
+static CORBA_boolean
impl_pasteText (PortableServer_Servant servant,
const CORBA_long position, CORBA_Environment *ev);
@@ -133,20 +133,22 @@
}
-static void
+static CORBA_boolean
impl_setTextContents (PortableServer_Servant servant,
const CORBA_char *newContents,
CORBA_Environment *ev)
{
AtkEditableText *editable = get_editable_text_from_servant (servant);
- g_return_if_fail (editable != NULL);
+ g_return_val_if_fail (editable != NULL, FALSE);
atk_editable_text_set_text_contents (editable, (gchar *) newContents);
+
+ return TRUE;
}
-static void
+static CORBA_boolean
impl_insertText (PortableServer_Servant servant,
const CORBA_long position,
const CORBA_char *text,
@@ -155,12 +157,13 @@
{
AtkEditableText *editable = get_editable_text_from_servant (servant);
- g_return_if_fail (editable != NULL);
+ g_return_val_if_fail (editable != NULL, FALSE);
atk_editable_text_insert_text (editable,
(gchar *) text,
(gint) length,
(gint *) &position);
+ return TRUE;
}
@@ -174,42 +177,49 @@
g_return_if_fail (editable != NULL);
atk_editable_text_copy_text (editable, (gint) startPos, (gint) endPos);
+
}
-static void
+static CORBA_boolean
impl_cutText (PortableServer_Servant servant,
const CORBA_long startPos, const CORBA_long endPos,
CORBA_Environment *ev)
{
AtkEditableText *editable = get_editable_text_from_servant (servant);
- g_return_if_fail (editable != NULL);
+ g_return_val_if_fail (editable != NULL, FALSE);
+
+ atk_editable_text_cut_text (editable, startPos, endPos);
- atk_editable_text_cut_text (editable, (gint) startPos, (gint) endPos);
+ return TRUE;
}
-static void
+static CORBA_boolean
impl_deleteText (PortableServer_Servant servant,
const CORBA_long startPos, const CORBA_long endPos,
CORBA_Environment *ev)
{
AtkEditableText *editable = get_editable_text_from_servant (servant);
- g_return_if_fail (editable != NULL);
+ g_return_val_if_fail (editable != NULL, FALSE);
- atk_editable_text_delete_text (editable, (gint) startPos, (gint) endPos);
+ atk_editable_text_delete_text (editable, startPos, endPos);
+
+ return TRUE;
}
-static void
+static CORBA_boolean
impl_pasteText (PortableServer_Servant servant,
const CORBA_long position, CORBA_Environment *ev)
{
AtkEditableText *editable = get_editable_text_from_servant (servant);
- g_return_if_fail (editable != NULL);
+ g_return_val_if_fail (editable != NULL, FALSE);
atk_editable_text_paste_text (editable, position);
+
+ return TRUE;
}
Index: libspi/selection.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/selection.c,v
retrieving revision 1.10
diff -u -r1.10 selection.c
--- libspi/selection.c 18 Dec 2001 13:38:44 -0000 1.10
+++ libspi/selection.c 15 Apr 2002 14:17:30 -0000
@@ -99,8 +99,7 @@
g_return_val_if_fail (selection != NULL, FALSE);
- return (CORBA_boolean)
- atk_selection_add_selection (selection, (gint) childIndex);
+ return atk_selection_add_selection (selection, childIndex);
}
@@ -127,32 +126,32 @@
g_return_val_if_fail (selection != NULL, FALSE);
- return (CORBA_boolean)
- atk_selection_is_child_selected (selection, (gint) childIndex);
+ return atk_selection_is_child_selected (selection, childIndex);
}
-static void
+static CORBA_boolean
impl_selectAll (PortableServer_Servant servant,
CORBA_Environment *ev)
{
AtkSelection *selection = get_selection_from_servant (servant);
- g_return_if_fail (selection != NULL);
+ g_return_val_if_fail (selection != NULL, FALSE);
+
+ return atk_selection_select_all_selection (selection);
- atk_selection_select_all_selection (selection);
}
-static void
+static CORBA_boolean
impl_clearSelection (PortableServer_Servant servant,
CORBA_Environment *ev)
{
AtkSelection *selection = get_selection_from_servant (servant);
- g_return_if_fail (selection != NULL);
+ g_return_val_if_fail (selection != NULL, FALSE);
- atk_selection_clear_selection (selection);
+ return atk_selection_clear_selection (selection);
}
Index: libspi/table.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/table.c,v
retrieving revision 1.12
diff -u -r1.12 table.c
--- libspi/table.c 18 Dec 2001 13:38:44 -0000 1.12
+++ libspi/table.c 15 Apr 2002 14:17:30 -0000
@@ -117,8 +117,7 @@
g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL);
- atk_object = atk_table_ref_at (table,
- (gint) row, (gint) column);
+ atk_object = atk_table_ref_at (table, row, column);
return spi_accessible_new_return (atk_object, TRUE, ev);
}
@@ -134,8 +133,7 @@
g_return_val_if_fail (table != NULL, 0);
- return (CORBA_long)
- atk_table_get_index_at (table, (gint) row, (gint) column);
+ return atk_table_get_index_at (table, row, column);
}
@@ -148,8 +146,7 @@
g_return_val_if_fail (table != NULL, 0);
- return (CORBA_long)
- atk_table_get_row_at_index (table, (gint) index);
+ return atk_table_get_row_at_index (table, index);
}
@@ -162,8 +159,7 @@
g_return_val_if_fail (table != NULL, 0);
- return (CORBA_long)
- atk_table_get_column_at_index (table, (gint) index);
+ return atk_table_get_column_at_index (table, index);
}
@@ -223,9 +219,7 @@
g_return_val_if_fail (table != NULL, -1);
- return (CORBA_long)
- atk_table_get_row_extent_at (table,
- (gint) row, (gint) column);
+ return atk_table_get_row_extent_at (table, row, column);
}
@@ -239,9 +233,7 @@
g_return_val_if_fail (table != NULL, -1);
- return (CORBA_long)
- atk_table_get_column_extent_at (table,
- (gint) row, (gint) column);
+ return atk_table_get_column_extent_at (table, row, column);
}
@@ -255,7 +247,7 @@
g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL);
- header = atk_table_get_row_header (table, (gint) row);
+ header = atk_table_get_row_header (table, row);
return spi_accessible_new_return (header, FALSE, ev);
}
@@ -271,7 +263,7 @@
g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL);
- header = atk_table_get_column_header (table, (gint) column);
+ header = atk_table_get_column_header (table, column);
return spi_accessible_new_return (header, FALSE, ev);
}
@@ -346,7 +338,7 @@
g_return_val_if_fail (table != NULL, FALSE);
- return (CORBA_boolean) atk_table_is_row_selected (table, (gint) row);
+ return atk_table_is_row_selected (table, row);
}
@@ -359,7 +351,58 @@
g_return_val_if_fail (table != NULL, FALSE);
- return (CORBA_boolean) atk_table_is_column_selected (table, (gint) column);
+ return atk_table_is_column_selected (table, column);
+}
+
+static CORBA_boolean
+impl_addRowSelection (PortableServer_Servant servant,
+ const CORBA_long row,
+ CORBA_Environment *ev)
+{
+ AtkTable *table = get_table_from_servant (servant);
+
+ g_return_val_if_fail (table != NULL, FALSE);
+
+ return atk_table_add_row_selection (table, row);
+}
+
+
+static CORBA_boolean
+impl_addColumnSelection (PortableServer_Servant servant,
+ const CORBA_long column,
+ CORBA_Environment *ev)
+{
+ AtkTable *table = get_table_from_servant (servant);
+
+ g_return_val_if_fail (table != NULL, FALSE);
+
+ return atk_table_add_column_selection (table, column);
+}
+
+
+static CORBA_boolean
+impl_removeRowSelection (PortableServer_Servant servant,
+ const CORBA_long row,
+ CORBA_Environment *ev)
+{
+ AtkTable *table = get_table_from_servant (servant);
+
+ g_return_val_if_fail (table != NULL, FALSE);
+
+ return atk_table_remove_row_selection (table, row);
+}
+
+
+static CORBA_boolean
+impl_removeColumnSelection (PortableServer_Servant servant,
+ const CORBA_long column,
+ CORBA_Environment *ev)
+{
+ AtkTable *table = get_table_from_servant (servant);
+
+ g_return_val_if_fail (table != NULL, FALSE);
+
+ return atk_table_remove_column_selection (table, column);
}
@@ -373,8 +416,8 @@
g_return_val_if_fail (table != NULL, FALSE);
- return (CORBA_boolean) atk_table_is_selected (table,
- (gint) row, (gint) column);
+ return atk_table_is_selected (table,
+ row, column);
}
@@ -403,6 +446,10 @@
epv->getSelectedColumns = impl_getSelectedColumns;
epv->isRowSelected = impl_isRowSelected;
epv->isColumnSelected = impl_isColumnSelected;
+ epv->addRowSelection = impl_addRowSelection;
+ epv->addColumnSelection = impl_addColumnSelection;
+ epv->removeRowSelection = impl_removeRowSelection;
+ epv->removeColumnSelection = impl_removeColumnSelection;
epv->isSelected = impl_isSelected;
}
Index: registryd/deviceeventcontroller.c
===================================================================
RCS file: /cvs/gnome/at-spi/registryd/deviceeventcontroller.c,v
retrieving revision 1.33
diff -u -r1.33 deviceeventcontroller.c
--- registryd/deviceeventcontroller.c 13 Apr 2002 18:41:42 -0000 1.33
+++ registryd/deviceeventcontroller.c 15 Apr 2002 14:17:31 -0000
@@ -24,7 +24,7 @@
#include <config.h>
-#undef SPI_DEBUG
+#define SPI_DEBUG
#include <string.h>
#include <ctype.h>
Index: test/test-simple.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/test-simple.c,v
retrieving revision 1.26
diff -u -r1.26 test-simple.c
--- test/test-simple.c 7 Mar 2002 14:00:18 -0000 1.26
+++ test/test-simple.c 15 Apr 2002 14:17:31 -0000
@@ -713,6 +713,7 @@
while (!(stroke.type & SPI_KEY_PRESSED))
g_main_context_iteration (NULL, TRUE);
fprintf (stderr, "p");
+ g_assert (!strcmp (stroke.keystring, "="));
while (!(stroke.type & SPI_KEY_RELEASED))
g_main_context_iteration (NULL, TRUE);
fprintf (stderr, "r ");
@@ -720,7 +721,6 @@
g_assert (SPI_deregisterAccessibleKeystrokeListener (key_listener, 0));
SPI_freeAccessibleKeySet (test_keyset);
- g_assert (!strcmp (stroke.keystring, "="));
fprintf (stderr, "\n");
AccessibleKeystrokeListener_unref (key_listener);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]