~ubuntu-branches/ubuntu/oneiric/vte/oneiric

« back to all changes in this revision

Viewing changes to src/vteaccess.c

  • Committer: Package Import Robot
  • Author(s): Luke Yelavich
  • Date: 2011-09-09 10:31:22 UTC
  • Revision ID: package-import@ubuntu.com-20110909103122-kiu0i25tftkgxoot
Tags: 1:0.28.2-0ubuntu2
debian/patches/fix_gtk3_accessibility.patch: Slightly backported and
tweaked patch from upstream bug #654630 to fix GTK3 accessibility post
GTK/gail refactor, the original patch plus some suggested tweaks in the
bug was used to preserve GTK2 support, can be dropped once we move to
vte 0.29

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include <atk/atk.h>
30
30
#include <gtk/gtk.h>
 
31
#ifdef GDK_WINDOWING_X11
 
32
#include <gdk/gdkx.h>
 
33
#endif
31
34
#include <string.h>
32
35
#include "debug.h"
33
36
#include "vte.h"
772
775
}
773
776
 
774
777
static void
 
778
vte_terminal_accessible_destroyed (GtkWidget     *widget,
 
779
                                 GtkAccessible *accessible)
 
780
{
 
781
  gtk_accessible_set_widget (accessible, NULL);
 
782
  atk_object_notify_state_change (ATK_OBJECT (accessible), ATK_STATE_DEFUNCT, TRUE);
 
783
}
 
784
 
 
785
static gboolean
 
786
focus_cb (GtkWidget     *widget,
 
787
                GdkEventFocus *event)
 
788
{
 
789
        AtkObject* accessible;
 
790
        gboolean return_val;
 
791
        return_val = FALSE;
 
792
 
 
793
        accessible = gtk_widget_get_accessible (widget);
 
794
 
 
795
        atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED, event->in);
 
796
        return FALSE;
 
797
}
 
798
 
 
799
static void
 
800
notify_cb (GObject    *obj,
 
801
                 GParamSpec *pspec)
 
802
{
 
803
        GtkWidget* widget = GTK_WIDGET (obj);
 
804
        AtkObject* atk_obj = gtk_widget_get_accessible (widget);
 
805
        AtkState state;
 
806
        gboolean value;
 
807
 
 
808
        if (strcmp (pspec->name, "has-focus") == 0)
 
809
          /*
 
810
           * We use focus-in-event and focus-out-event signals to catch
 
811
           * focus changes so we ignore this.
 
812
           */
 
813
                return;
 
814
        else if (strcmp (pspec->name, "visible") == 0) {
 
815
                state = ATK_STATE_VISIBLE;
 
816
                value = gtk_widget_get_visible (widget);
 
817
          } else if (strcmp (pspec->name, "sensitive") == 0) {
 
818
                state = ATK_STATE_SENSITIVE;
 
819
                value = gtk_widget_get_sensitive (widget);
 
820
          } else
 
821
                return;
 
822
 
 
823
        atk_object_notify_state_change (atk_obj, state, value);
 
824
        if (state == ATK_STATE_SENSITIVE)
 
825
                atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, value);
 
826
}
 
827
 
 
828
/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */
 
829
static void
 
830
size_allocate_cb (GtkWidget     *widget,
 
831
                        GtkAllocation *allocation)
 
832
{
 
833
        AtkObject* accessible;
 
834
        AtkRectangle rect;
 
835
 
 
836
        accessible = gtk_widget_get_accessible (widget);
 
837
        rect.x = allocation->x;
 
838
        rect.y = allocation->y;
 
839
        rect.width = allocation->width;
 
840
        rect.height = allocation->height;
 
841
        g_signal_emit_by_name (accessible, "bounds_changed", &rect);
 
842
}
 
843
 
 
844
/* Translate GtkWidget mapped state into AtkObject showing */
 
845
static gint
 
846
map_cb (GtkWidget *widget)
 
847
{
 
848
        AtkObject *accessible;
 
849
 
 
850
        accessible = gtk_widget_get_accessible (widget);
 
851
        atk_object_notify_state_change (accessible, ATK_STATE_SHOWING,
 
852
                                        gtk_widget_get_mapped (widget));
 
853
        return 1;
 
854
}
 
855
 
 
856
static void
775
857
vte_terminal_initialize (AtkObject *obj, gpointer data)
776
858
{
777
859
        VteTerminal *terminal;
779
861
 
780
862
        ATK_OBJECT_CLASS (vte_terminal_accessible_parent_class)->initialize (obj, data);
781
863
 
 
864
#if GTK_CHECK_VERSION (2, 22, 0)
 
865
        gtk_accessible_set_widget (GTK_ACCESSIBLE (obj), GTK_WIDGET (data));
 
866
#endif
 
867
 
782
868
        terminal = VTE_TERMINAL (data);
783
869
 
784
870
        _vte_terminal_accessible_ref(terminal);
805
891
        g_signal_connect(terminal, "window-title-changed",
806
892
                         G_CALLBACK(vte_terminal_accessible_title_changed),
807
893
                         obj);
 
894
 
 
895
        /* everything below copied from gtkwidgetaccessible.c */
808
896
        g_signal_connect(terminal, "focus-in-event",
809
897
                         G_CALLBACK(vte_terminal_accessible_focus_in),
810
898
                         obj);
838
926
        atk_object_notify_state_change(obj,
839
927
                                       ATK_STATE_RESIZABLE, TRUE);
840
928
        obj->role = ATK_ROLE_TERMINAL;
 
929
 
 
930
        g_signal_connect_after (terminal, "destroy",
 
931
                                G_CALLBACK (vte_terminal_accessible_destroyed), obj);
 
932
        g_signal_connect_after (terminal, "focus-in-event", G_CALLBACK (focus_cb), NULL);
 
933
        g_signal_connect_after (terminal, "focus-out-event", G_CALLBACK (focus_cb), NULL);
 
934
        g_signal_connect (terminal, "notify", G_CALLBACK (notify_cb), NULL);
 
935
        g_signal_connect (terminal, "size-allocate", G_CALLBACK (size_allocate_cb), NULL);
 
936
        g_signal_connect (terminal, "map", G_CALLBACK (map_cb), NULL);
 
937
        g_signal_connect (terminal, "unmap", G_CALLBACK (map_cb), NULL);
841
938
}
842
939
 
843
940
/**
1842
1939
        g_signal_handler_disconnect(component, handler_id);
1843
1940
}
1844
1941
 
 
1942
static gboolean
 
1943
vte_terminal_accessible_grab_focus (AtkComponent *component)
 
1944
{
 
1945
        GtkWidget *widget;
 
1946
        GtkWidget *toplevel;
 
1947
 
 
1948
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
 
1949
        if (!widget)
 
1950
                return FALSE;
 
1951
 
 
1952
        if (!gtk_widget_get_can_focus (widget))
 
1953
                return FALSE;
 
1954
 
 
1955
        gtk_widget_grab_focus (widget);
 
1956
        toplevel = gtk_widget_get_toplevel (widget);
 
1957
        if (gtk_widget_is_toplevel (toplevel)) {
 
1958
#ifdef GDK_WINDOWING_X11
 
1959
                gtk_window_present_with_time (GTK_WINDOW (toplevel),
 
1960
                                              gdk_x11_get_server_time (gtk_widget_get_window (widget)));
 
1961
#else
 
1962
                gtk_window_present (GTK_WINDOW (toplevel));
 
1963
#endif
 
1964
        }
 
1965
        return TRUE;
 
1966
}
 
1967
 
1845
1968
static void
1846
1969
vte_terminal_accessible_component_init(gpointer iface, gpointer data)
1847
1970
{
1865
1988
        component->set_size = vte_terminal_accessible_set_size;
1866
1989
        component->get_layer = vte_terminal_accessible_get_layer;
1867
1990
        component->get_mdi_zorder = vte_terminal_accessible_get_mdi_zorder;
 
1991
        /* everything below copied from gtkwidgetaccessible.c */
 
1992
        component->grab_focus = vte_terminal_accessible_grab_focus;
1868
1993
}
1869
1994
 
1870
1995
/* AtkAction interface */
1978
2103
        action->get_keybinding = vte_terminal_accessible_action_get_keybinding;
1979
2104
        action->set_description = vte_terminal_accessible_action_set_description;
1980
2105
}
 
2106
 
 
2107
static const gchar *
 
2108
vte_terminal_accessible_get_description (AtkObject *accessible)
 
2109
{
 
2110
        GtkWidget *widget;
 
2111
 
 
2112
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
 
2113
        if (widget == NULL)
 
2114
                return NULL;
 
2115
 
 
2116
        if (accessible->description)
 
2117
                return accessible->description;
 
2118
 
 
2119
        return gtk_widget_get_tooltip_text (widget);
 
2120
}
 
2121
 
 
2122
static AtkObject *
 
2123
vte_terminal_accessible_get_parent (AtkObject *accessible)
 
2124
{
 
2125
        AtkObject *parent;
 
2126
        GtkWidget *widget, *parent_widget;
 
2127
 
 
2128
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
 
2129
        if (widget == NULL)
 
2130
                return NULL;
 
2131
 
 
2132
        parent = accessible->accessible_parent;
 
2133
        if (parent != NULL)
 
2134
                return parent;
 
2135
 
 
2136
        parent_widget = gtk_widget_get_parent (widget);
 
2137
        if (parent_widget == NULL)
 
2138
                return NULL;
 
2139
 
 
2140
        /* For a widget whose parent is a GtkNoteBook, we return the
 
2141
         * accessible object corresponding the GtkNotebookPage containing
 
2142
         * the widget as the accessible parent.
 
2143
         */
 
2144
        if (GTK_IS_NOTEBOOK (parent_widget)) {
 
2145
                gint page_num;
 
2146
                GtkWidget *child;
 
2147
                GtkNotebook *notebook;
 
2148
 
 
2149
                page_num = 0;
 
2150
                notebook = GTK_NOTEBOOK (parent_widget);
 
2151
                while (TRUE) {
 
2152
                        child = gtk_notebook_get_nth_page (notebook, page_num);
 
2153
                        if (!child)
 
2154
                                break;
 
2155
                        if (child == widget) {
 
2156
                                parent = gtk_widget_get_accessible (parent_widget);
 
2157
                                parent = atk_object_ref_accessible_child (parent, page_num);
 
2158
                                g_object_unref (parent);
 
2159
                                return parent;
 
2160
                        }
 
2161
                        page_num++;
 
2162
                }
 
2163
        }
 
2164
        parent = gtk_widget_get_accessible (parent_widget);
 
2165
        return parent;
 
2166
}
 
2167
 
 
2168
static gboolean
 
2169
vte_terminal_accessible_all_parents_visible (GtkWidget *widget)
 
2170
{
 
2171
        GtkWidget *iter_parent = NULL;
 
2172
        gboolean result = TRUE;
 
2173
 
 
2174
        for (iter_parent = gtk_widget_get_parent (widget); iter_parent;
 
2175
             iter_parent = gtk_widget_get_parent (iter_parent)) {
 
2176
                if (!gtk_widget_get_visible (iter_parent)) {
 
2177
                        result = FALSE;
 
2178
                        break;
 
2179
                }
 
2180
        }
 
2181
 
 
2182
        return result;
 
2183
}
 
2184
 
 
2185
static gboolean
 
2186
vte_terminal_accessible_on_screen (GtkWidget *widget)
 
2187
{
 
2188
        GtkAllocation allocation;
 
2189
        GtkWidget *viewport;
 
2190
        gboolean return_value;
 
2191
 
 
2192
        gtk_widget_get_allocation (widget, &allocation);
 
2193
 
 
2194
        viewport = gtk_widget_get_ancestor (widget, GTK_TYPE_VIEWPORT);
 
2195
        if (viewport) {
 
2196
                GtkAllocation viewport_allocation;
 
2197
                GtkAdjustment *adjustment;
 
2198
                GdkRectangle visible_rect;
 
2199
 
 
2200
                gtk_widget_get_allocation (viewport, &viewport_allocation);
 
2201
 
 
2202
#if GTK_CHECK_VERSION (3, 0, 0)
 
2203
                adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport));
 
2204
                visible_rect.y = gtk_adjustment_get_value (adjustment);
 
2205
                adjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (viewport));
 
2206
#else
 
2207
                adjustment = gtk_viewport_get_vadjustment (viewport);
 
2208
                visible_rect.y = gtk_adjustment_get_value (adjustment);
 
2209
                adjustment = gtk_viewport_get_hadjustment (viewport);
 
2210
#endif
 
2211
                visible_rect.x = gtk_adjustment_get_value (adjustment);
 
2212
                visible_rect.width = viewport_allocation.width;
 
2213
                visible_rect.height = viewport_allocation.height;
 
2214
 
 
2215
                if (((allocation.x + allocation.width) < visible_rect.x) ||
 
2216
                    ((allocation.y + allocation.height) < visible_rect.y) ||
 
2217
                    (allocation.x > (visible_rect.x + visible_rect.width)) ||
 
2218
                    (allocation.y > (visible_rect.y + visible_rect.height)))
 
2219
                        return_value = FALSE;
 
2220
                else
 
2221
                        return_value = TRUE;
 
2222
        } else {
 
2223
                /* Check whether the widget has been placed off the screen.
 
2224
                 * The widget may be MAPPED as when toolbar items do not
 
2225
                 * fit on the toolbar.
 
2226
                 */
 
2227
                if (allocation.x + allocation.width <= 0 &&
 
2228
                    allocation.y + allocation.height <= 0)
 
2229
                        return_value = FALSE;
 
2230
                else
 
2231
                        return_value = TRUE;
 
2232
        }
 
2233
 
 
2234
        return return_value;
 
2235
}
 
2236
 
 
2237
static AtkStateSet *
 
2238
vte_terminal_accessible_ref_state_set (AtkObject *accessible)
 
2239
{
 
2240
        GtkWidget *widget;
 
2241
        AtkStateSet *state_set;
 
2242
 
 
2243
        state_set = ATK_OBJECT_CLASS (vte_terminal_accessible_parent_class)->ref_state_set (accessible);
 
2244
 
 
2245
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
 
2246
        if (widget == NULL)
 
2247
                atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
 
2248
        else {
 
2249
                if (gtk_widget_is_sensitive (widget)) {
 
2250
                        atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
 
2251
                        atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
 
2252
                }
 
2253
        
 
2254
                if (gtk_widget_get_can_focus (widget)) {
 
2255
                        atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
 
2256
                }
 
2257
                /*
 
2258
                 * We do not currently generate notifications when an ATK object
 
2259
                 * corresponding to a GtkWidget changes visibility by being scrolled
 
2260
                 * on or off the screen.  The testcase for this is the main window
 
2261
                 * of the testgtk application in which a set of buttons in a GtkVBox
 
2262
                 * is in a scrolled window with a viewport.
 
2263
                 *
 
2264
                 * To generate the notifications we would need to do the following:
 
2265
                 * 1) Find the GtkViewport among the ancestors of the objects
 
2266
                 * 2) Create an accessible for the viewport
 
2267
                 * 3) Connect to the value-changed signal on the viewport
 
2268
                 * 4) When the signal is received we need to traverse the children
 
2269
                 *    of the viewport and check whether the children are visible or not
 
2270
                 *    visible; we may want to restrict this to the widgets for which
 
2271
                 *    accessible objects have been created.
 
2272
                 * 5) We probably need to store a variable on_screen in the
 
2273
                 *    GtkWidgetAccessible data structure so we can determine whether
 
2274
                 *    the value has changed.
 
2275
                 */
 
2276
                if (gtk_widget_get_visible (widget)) {
 
2277
                        atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
 
2278
                        if (vte_terminal_accessible_on_screen (widget) &&
 
2279
                            gtk_widget_get_mapped (widget) &&
 
2280
                            vte_terminal_accessible_all_parents_visible (widget))
 
2281
                                atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
 
2282
                }
 
2283
 
 
2284
                if (gtk_widget_has_focus (widget)) {
 
2285
                        AtkObject *focus_obj;
 
2286
 
 
2287
                        focus_obj = g_object_get_data (G_OBJECT (accessible), "gail-focus-object");
 
2288
                        if (focus_obj == NULL)
 
2289
                                atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
 
2290
                }
 
2291
 
 
2292
                if (gtk_widget_has_default (widget))
 
2293
                        atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);
 
2294
        }
 
2295
        return state_set;
 
2296
}
 
2297
 
 
2298
static gint
 
2299
vte_terminal_accessible_get_index_in_parent (AtkObject *accessible)
 
2300
{
 
2301
        GtkWidget *widget;
 
2302
        GtkWidget *parent_widget;
 
2303
        gint index;
 
2304
        GList *children;
 
2305
 
 
2306
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
 
2307
 
 
2308
        if (widget == NULL)
 
2309
                return -1;
 
2310
 
 
2311
        if (accessible->accessible_parent) {
 
2312
                AtkObject *parent;
 
2313
 
 
2314
                parent = accessible->accessible_parent;
 
2315
 
 
2316
                if (atk_object_get_role (parent) == ATK_ROLE_PAGE_TAB)
 
2317
                        return 0;
 
2318
                else {
 
2319
                        gint n_children, i;
 
2320
                        gboolean found = FALSE;
 
2321
 
 
2322
                        n_children = atk_object_get_n_accessible_children (parent);
 
2323
                        for (i = 0; i < n_children; i++) {
 
2324
                                AtkObject *child;
 
2325
 
 
2326
                                child = atk_object_ref_accessible_child (parent, i);
 
2327
                                if (child == accessible)
 
2328
                                        found = TRUE;
 
2329
 
 
2330
                                g_object_unref (child);
 
2331
                                if (found)
 
2332
                                        return i;
 
2333
                        }
 
2334
                }
 
2335
        }
 
2336
 
 
2337
        if (!GTK_IS_WIDGET (widget))
 
2338
                return -1;
 
2339
        parent_widget = gtk_widget_get_parent (widget);
 
2340
        if (!GTK_IS_CONTAINER (parent_widget))
 
2341
                return -1;
 
2342
 
 
2343
        children = gtk_container_get_children (GTK_CONTAINER (parent_widget));
 
2344
 
 
2345
        index = g_list_index (children, widget);
 
2346
        g_list_free (children);
 
2347
        return index;
 
2348
}
 
2349
 
 
2350
static AtkAttributeSet *
 
2351
vte_terminal_accessible_get_attributes (AtkObject *obj)
 
2352
{
 
2353
        AtkAttributeSet *attributes;
 
2354
        AtkAttribute *toolkit;
 
2355
 
 
2356
        toolkit = g_new (AtkAttribute, 1);
 
2357
        toolkit->name = g_strdup ("toolkit");
 
2358
        toolkit->value = g_strdup ("gtk");
 
2359
 
 
2360
        attributes = g_slist_append (NULL, toolkit);
 
2361
 
 
2362
        return attributes;
 
2363
}
 
2364
 
1981
2365
static void
1982
 
vte_terminal_accessible_class_init(gpointer *klass)
 
2366
vte_terminal_accessible_class_init(VteTerminalAccessibleClass *klass)
1983
2367
{
1984
2368
        GObjectClass *gobject_class;
1985
2369
        AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
1991
2375
        class->initialize = vte_terminal_initialize;
1992
2376
        /* Override the finalize method. */
1993
2377
        gobject_class->finalize = vte_terminal_accessible_finalize;
 
2378
 
 
2379
        /* everything below copied from gtkwidgetaccessible.c */
 
2380
        class->get_description = vte_terminal_accessible_get_description;
 
2381
        class->get_parent = vte_terminal_accessible_get_parent;
 
2382
        class->ref_state_set = vte_terminal_accessible_ref_state_set;
 
2383
        class->get_index_in_parent = vte_terminal_accessible_get_index_in_parent;
 
2384
        class->get_attributes = vte_terminal_accessible_get_attributes;
1994
2385
}
1995
2386
 
1996
 
GType
1997
 
vte_terminal_accessible_get_type(void)
 
2387
static void
 
2388
vte_terminal_accessible_init (VteTerminalAccessible *terminal)
1998
2389
{
1999
 
        static GType terminal_accessible_type = 0;
2000
 
 
2001
 
        if (G_UNLIKELY (terminal_accessible_type == 0)) {
2002
 
                AtkRegistry *registry;
2003
 
                AtkObjectFactory *factory;
2004
 
                GType parent_type, parent_accessible_type;
2005
 
                GTypeQuery type_info;
2006
 
 
2007
 
                GInterfaceInfo text = {
2008
 
                        vte_terminal_accessible_text_init,
2009
 
                        NULL,
2010
 
                        NULL,
2011
 
                };
2012
 
                GInterfaceInfo component = {
2013
 
                        vte_terminal_accessible_component_init,
2014
 
                        NULL,
2015
 
                        NULL,
2016
 
                };
2017
 
                GInterfaceInfo action = {
2018
 
                        vte_terminal_accessible_action_init,
2019
 
                        NULL,
2020
 
                        NULL,
2021
 
                };
2022
 
                GTypeInfo terminal_accessible_info = {
2023
 
                        0,
2024
 
                        (GBaseInitFunc)NULL,
2025
 
                        (GBaseFinalizeFunc)NULL,
2026
 
 
2027
 
                        (GClassInitFunc)vte_terminal_accessible_class_init,
2028
 
                        (GClassFinalizeFunc)NULL,
2029
 
                        (gconstpointer)NULL,
2030
 
 
2031
 
                        0,
2032
 
                        0,
2033
 
                        (GInstanceInitFunc) NULL,
2034
 
 
2035
 
                        (GTypeValueTable*)NULL,
2036
 
                };
2037
 
 
2038
 
                /* Find the Atk object used for the parent (GtkWidget) type. */
2039
 
                parent_type = g_type_parent(VTE_TYPE_TERMINAL);
2040
 
                factory = atk_registry_get_factory(atk_get_default_registry(),
2041
 
                                parent_type);
2042
 
                parent_accessible_type = atk_object_factory_get_accessible_type(factory);
2043
 
                if (!g_type_is_a(parent_accessible_type, GTK_TYPE_ACCESSIBLE)) {
2044
 
#ifdef VTE_DEBUG
2045
 
                        g_warning("Accessibility (%s) is not derived from "
2046
 
                                        "%s (GTK_MODULES=gail not set?), "
2047
 
                                        "deriving from %s instead.\n",
2048
 
                                        g_type_name(parent_accessible_type),
2049
 
                                        g_type_name(GTK_TYPE_ACCESSIBLE),
2050
 
                                        g_type_name(GTK_TYPE_ACCESSIBLE));
2051
 
#endif
2052
 
                        /* Fudge it. */
2053
 
                        parent_accessible_type = GTK_TYPE_ACCESSIBLE;
2054
 
                }
2055
 
 
2056
 
                /* Find the size of the parent type's objects. */
2057
 
                g_type_query(parent_accessible_type, &type_info);
2058
 
                terminal_accessible_info.class_size = type_info.class_size;
2059
 
                terminal_accessible_info.instance_size = type_info.instance_size;
2060
 
                /* Register the class with the GObject type system. */
2061
 
                terminal_accessible_type = g_type_register_static(parent_accessible_type,
2062
 
                                "VteTerminalAccessible",
2063
 
                                &terminal_accessible_info,
2064
 
                                0);
2065
 
 
2066
 
                /* Add a text interface to this object class. */
2067
 
                g_type_add_interface_static(terminal_accessible_type,
2068
 
                                ATK_TYPE_TEXT,
2069
 
                                &text);
2070
 
                /* Add a component interface to this object class. */
2071
 
                g_type_add_interface_static(terminal_accessible_type,
2072
 
                                ATK_TYPE_COMPONENT,
2073
 
                                &component);
2074
 
                /* Add an action interface to this object class. */
2075
 
                g_type_add_interface_static(terminal_accessible_type,
2076
 
                                ATK_TYPE_ACTION,
2077
 
                                &action);
2078
 
 
2079
 
                /* Associate the terminal and its peer factory in the
2080
 
                 * Atk type registry. */
2081
 
                registry = atk_get_default_registry();
2082
 
                atk_registry_set_factory_type(registry,
2083
 
                                VTE_TYPE_TERMINAL,
2084
 
                                VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY);
2085
 
        }
2086
 
 
2087
 
        return terminal_accessible_type;
2088
2390
}
2089
2391
 
 
2392
G_DEFINE_TYPE_WITH_CODE (VteTerminalAccessible, vte_terminal_accessible, GTK_TYPE_ACCESSIBLE,
 
2393
                         G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, vte_terminal_accessible_text_init)
 
2394
                         G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, vte_terminal_accessible_component_init)
 
2395
                         G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, vte_terminal_accessible_action_init))
 
2396
 
2090
2397
/* Create an accessible peer for the object. */
2091
2398
static AtkObject *
2092
2399
vte_terminal_accessible_factory_create_accessible(GObject *obj)