[evolution-patches] bug 47034, gal: AtkEditableText interface implementation for GalA11yEText
- From: Tianyu Tim-Wo <tim wo sun com>
- To: Mike Kestner <mkestner ximian com>
- Cc: evolution-patches ximian com, sceri-evolution-acc sun com
- Subject: [evolution-patches] bug 47034, gal: AtkEditableText interface implementation for GalA11yEText
- Date: Sat, 13 Sep 2003 16:44:18 +0800
Hi Mike,
Would you please take a look at this patch.
gal/a11y/e-text/gal-a11y-e-text.c is modified:
(et_insert_text): make the code be compliant with C89, or it can't be
compiled on solaris. (see bug 48286)
(et_copy_text): implementation added
(et_cut_text): implementation added
(et_delete_text): implementation added
(et_paste_text): implementation added
--
Tim-Wo <tim wo sun com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.806
diff -u -r1.806 ChangeLog
--- ChangeLog 12 Sep 2003 13:55:55 -0000 1.806
+++ ChangeLog 13 Sep 2003 08:33:13 -0000
@@ -1,3 +1,12 @@
+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
+
2003-09-08 Tim Wo <tim wo sun com>
* gal/a11y/e-text/gal-a11y-e-text-factory.h: GalA11yETextFactory
Index: gal/a11y/e-text/gal-a11y-e-text.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-text/gal-a11y-e-text.c,v
retrieving revision 1.2
diff -u -r1.2 gal-a11y-e-text.c
--- gal/a11y/e-text/gal-a11y-e-text.c 12 Sep 2003 13:55:56 -0000 1.2
+++ gal/a11y/e-text/gal-a11y-e-text.c 13 Sep 2003 08:33:13 -0000
@@ -360,9 +360,13 @@
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 @@
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 @@
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]