diff options
author | Tim Wo <tim.wo@sun.com> | 2003-09-18 21:47:25 +0800 |
---|---|---|
committer | Gilbert Fang <gilbertfang@src.gnome.org> | 2003-09-18 21:47:25 +0800 |
commit | 43eb05b879d31ed75b41ca69b4e62f800cb5237c (patch) | |
tree | 1b13050f4d88c702722b7114e888c11f4d7cab28 /a11y/e-text | |
parent | ff8411e7f136198650027ea93e24b1f922906868 (diff) | |
download | gsoc2013-evolution-43eb05b879d31ed75b41ca69b4e62f800cb5237c.tar.gz gsoc2013-evolution-43eb05b879d31ed75b41ca69b4e62f800cb5237c.tar.zst gsoc2013-evolution-43eb05b879d31ed75b41ca69b4e62f800cb5237c.zip |
make the code be compliant with C89, or it can't be compiled on solaris.
2003-09-13 Tim Wo <tim.wo@sun.com>
* gal/a11y/e-text/gal-a11y-e-text.c (et_insert_text): make the
code be compliant with C89, or it can't be compiled on solaris.
(et_copy_text): implementation added
(et_cut_text): implementation added
(et_delete_text): implementation added
(et_paste_text): implementation added
svn path=/trunk/; revision=22606
Diffstat (limited to 'a11y/e-text')
-rw-r--r-- | a11y/e-text/gal-a11y-e-text.c | 71 |
1 files changed, 59 insertions, 12 deletions
diff --git a/a11y/e-text/gal-a11y-e-text.c b/a11y/e-text/gal-a11y-e-text.c index 1ee67989ca..fe0ae709d1 100644 --- a/a11y/e-text/gal-a11y-e-text.c +++ b/a11y/e-text/gal-a11y-e-text.c @@ -360,9 +360,13 @@ et_insert_text (AtkEditableText *text, gint *position) { /* Utf8 unimplemented */ + char *result; const char *full_text = et_get_full_text (ATK_TEXT (text)); - char *result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position); + if (full_text == NULL) + return; + + result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position); et_set_full_text (text, result); @@ -376,15 +380,22 @@ et_copy_text (AtkEditableText *text, gint start_pos, gint end_pos) { - /* Unimplemented */ -} + GObject *obj; + EText *etext; -static void -et_cut_text (AtkEditableText *text, - gint start_pos, - gint end_pos) -{ - /* Unimplemented */ + g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text)); + obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); + if (obj == NULL) + return; + + g_return_if_fail (E_IS_TEXT (obj)); + etext = E_TEXT (obj); + + if (start_pos != end_pos) { + etext->selection_start = start_pos; + etext->selection_end = end_pos; + e_text_copy_clipboard (etext); + } } static void @@ -392,16 +403,52 @@ et_delete_text (AtkEditableText *text, gint start_pos, gint end_pos) { - /* Unimplemented */ + GObject *obj; + EText *etext; + + g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text)); + obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); + if (obj == NULL) + return; + + g_return_if_fail (E_IS_TEXT (obj)); + etext = E_TEXT (obj); + + etext->selection_start = start_pos; + etext->selection_end = end_pos; + + e_text_delete_selection (etext); +} + +static void +et_cut_text (AtkEditableText *text, + gint start_pos, + gint end_pos) +{ + et_copy_text (text, start_pos, end_pos); + et_delete_text (text, start_pos, end_pos); } static void et_paste_text (AtkEditableText *text, gint position) { - /* Unimplemented */ -} + GObject *obj; + EText *etext; + + g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text)); + obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); + if (obj == NULL) + return; + + g_return_if_fail (E_IS_TEXT (obj)); + etext = E_TEXT (obj); + gtk_object_set (GTK_OBJECT (etext), + "cursor_pos", position, + NULL); + e_text_paste_clipboard (etext); +} static void et_atk_component_iface_init (AtkComponentIface *iface) |