atspi: Add fold markers

This makes it much easier to navigate in these
multi-implementation files.
This commit is contained in:
Matthias Clasen 2020-10-15 13:09:13 -04:00
parent 8701e65635
commit 8a14f019d0
4 changed files with 151 additions and 98 deletions

View File

@ -122,6 +122,7 @@ static GParamSpec *obj_props[N_PROPS];
G_DEFINE_TYPE (GtkAtSpiContext, gtk_at_spi_context, GTK_TYPE_AT_CONTEXT)
/* {{{ State handling */
static void
set_atspi_state (guint64 *states,
AtspiStateType state)
@ -284,7 +285,8 @@ collect_states (GtkAtSpiContext *self,
g_variant_builder_add (builder, "u", (guint32) (states & 0xffffffff));
g_variant_builder_add (builder, "u", (guint32) (states >> 32));
}
/* }}} */
/* {{{ Relation handling */
static void
collect_relations (GtkAtSpiContext *self,
GVariantBuilder *builder)
@ -328,7 +330,8 @@ collect_relations (GtkAtSpiContext *self,
g_variant_builder_add (builder, "(ua(so))", map[i].s, &b);
}
}
/* }}} */
/* {{{ Accessible implementation */
static int
get_index_in_parent (GtkWidget *widget)
{
@ -694,102 +697,8 @@ static const GDBusInterfaceVTable accessible_vtable = {
NULL,
};
static void
gtk_at_spi_context_register_object (GtkAtSpiContext *self)
{
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
GVariantBuilder interfaces = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
const GDBusInterfaceVTable *vtable;
g_variant_builder_add (&interfaces, "s", atspi_accessible_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_accessible_interface,
&accessible_vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
vtable = gtk_atspi_get_text_vtable (accessible);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_text_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_text_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
vtable = gtk_atspi_get_editable_text_vtable (accessible);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_editable_text_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_editable_text_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
vtable = gtk_atspi_get_value_vtable (accessible);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_value_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_value_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
/* Calling gtk_accessible_get_accessible_role() in here will recurse,
* so pass the role in explicitly.
*/
vtable = gtk_atspi_get_selection_vtable (accessible,
GTK_AT_CONTEXT (self)->accessible_role);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_selection_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_selection_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
self->interfaces = g_variant_ref_sink (g_variant_builder_end (&interfaces));
}
static void
gtk_at_spi_context_unregister_object (GtkAtSpiContext *self)
{
while (self->n_registered_objects > 0)
{
self->n_registered_objects--;
g_dbus_connection_unregister_object (self->connection,
self->registration_ids[self->n_registered_objects]);
self->registration_ids[self->n_registered_objects] = 0;
}
}
/* }}} */
/* {{{ Change notification */
static void
emit_text_changed (GtkAtSpiContext *self,
const char *kind,
@ -1039,6 +948,103 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
emit_state_changed (self, "focused", state);
}
}
/* }}} */
static void
gtk_at_spi_context_register_object (GtkAtSpiContext *self)
{
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
GVariantBuilder interfaces = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
const GDBusInterfaceVTable *vtable;
g_variant_builder_add (&interfaces, "s", atspi_accessible_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_accessible_interface,
&accessible_vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
vtable = gtk_atspi_get_text_vtable (accessible);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_text_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_text_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
vtable = gtk_atspi_get_editable_text_vtable (accessible);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_editable_text_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_editable_text_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
vtable = gtk_atspi_get_value_vtable (accessible);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_value_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_value_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
/* Calling gtk_accessible_get_accessible_role() in here will recurse,
* so pass the role in explicitly.
*/
vtable = gtk_atspi_get_selection_vtable (accessible,
GTK_AT_CONTEXT (self)->accessible_role);
if (vtable)
{
g_variant_builder_add (&interfaces, "s", atspi_selection_interface.name);
self->registration_ids[self->n_registered_objects] =
g_dbus_connection_register_object (self->connection,
self->context_path,
(GDBusInterfaceInfo *) &atspi_selection_interface,
vtable,
self,
NULL,
NULL);
self->n_registered_objects++;
}
self->interfaces = g_variant_ref_sink (g_variant_builder_end (&interfaces));
}
static void
gtk_at_spi_context_unregister_object (GtkAtSpiContext *self)
{
while (self->n_registered_objects > 0)
{
self->n_registered_objects--;
g_dbus_connection_unregister_object (self->connection,
self->registration_ids[self->n_registered_objects]);
self->registration_ids[self->n_registered_objects] = 0;
}
}
static void
gtk_at_spi_context_dispose (GObject *gobject)
@ -1414,3 +1420,5 @@ gtk_at_spi_context_to_ref (GtkAtSpiContext *self)
const char *name = g_dbus_connection_get_unique_name (self->connection);
return g_variant_new ("(so)", name, self->context_path);
}
/* vim:set foldmethod=marker expandtab: */

View File

@ -34,6 +34,8 @@
#include <gio/gio.h>
/* {{{ GtkEditable */
typedef struct
{
GtkWidget *widget;
@ -178,6 +180,8 @@ static const GDBusInterfaceVTable entry_vtable = {
NULL,
};
/* }}} */
/* {{{ GtkTextView */
static void
text_view_received (GObject *source,
@ -339,6 +343,7 @@ static const GDBusInterfaceVTable text_view_vtable = {
NULL,
};
/* }}} */
const GDBusInterfaceVTable *
gtk_atspi_get_editable_text_vtable (GtkAccessible *accessible)
@ -354,3 +359,4 @@ gtk_atspi_get_editable_text_vtable (GtkAccessible *accessible)
return NULL;
}
/* vim:set foldmethod=marker expandtab: */

View File

@ -61,6 +61,8 @@ find_nth (GtkWidget *box,
counter->n--;
}
/* {{{ GtkListbox */
static void
listbox_handle_method (GDBusConnection *connection,
const gchar *sender,
@ -220,6 +222,8 @@ static const GDBusInterfaceVTable listbox_vtable = {
NULL
};
/* }}} */
/* {{{ GtkListView */
static void
listview_handle_method (GDBusConnection *connection,
@ -457,6 +461,8 @@ static const GDBusInterfaceVTable listview_vtable = {
NULL
};
/* }}} */
/* {{{ GtkFlowBox */
static void
flowbox_handle_method (GDBusConnection *connection,
@ -609,6 +615,8 @@ static const GDBusInterfaceVTable flowbox_vtable = {
NULL
};
/* }}} */
/* {{{ GtkComboBox */
static void
combobox_handle_method (GDBusConnection *connection,
@ -705,6 +713,8 @@ static const GDBusInterfaceVTable combobox_vtable = {
NULL
};
/* }}} */
/* {{{ GtkStackSwitcher */
static void
stackswitcher_handle_method (GDBusConnection *connection,
@ -827,6 +837,8 @@ static const GDBusInterfaceVTable stackswitcher_vtable = {
NULL
};
/* }}} */
/* {{{ GtkNotebook */
static void
notebook_handle_method (GDBusConnection *connection,
@ -952,6 +964,8 @@ static const GDBusInterfaceVTable notebook_vtable = {
NULL
};
/* }}} */
#define IS_NOTEBOOK_TAB_LIST(s,r) \
((r == GTK_ACCESSIBLE_ROLE_TAB_LIST) && \
(gtk_widget_get_parent (GTK_WIDGET (s)) != NULL) && \
@ -978,6 +992,8 @@ gtk_atspi_get_selection_vtable (GtkAccessible *accessible,
return NULL;
}
/* {{{ GtkListView notification */
typedef struct {
GtkAtspiSelectionCallback *changed;
gpointer data;
@ -1021,6 +1037,8 @@ model_changed (GtkListBase *list,
update_model (data, gtk_list_base_get_model (list));
}
/* }}} */
void
gtk_atspi_connect_selection_signals (GtkAccessible *accessible,
GtkAtspiSelectionCallback selection_changed,
@ -1138,3 +1156,6 @@ gtk_atspi_disconnect_selection_signals (GtkAccessible *accessible)
g_object_set_data (G_OBJECT (accessible), "accessible-selection-data", NULL);
}
}
/* vim:set foldmethod=marker expandtab: */

View File

@ -41,6 +41,8 @@
#include <gio/gio.h>
/* {{{ GtkLabel */
static void
label_handle_method (GDBusConnection *connection,
const gchar *sender,
@ -404,6 +406,9 @@ static const GDBusInterfaceVTable label_vtable = {
NULL,
};
/* }}} */
/* {{{ GtkEditable */
static GtkText *
gtk_editable_get_text_widget (GtkWidget *widget)
{
@ -777,6 +782,8 @@ static const GDBusInterfaceVTable entry_vtable = {
NULL,
};
/* }}} */
/* {{{ GtkTextView */
static void
text_view_handle_method (GDBusConnection *connection,
@ -1155,6 +1162,8 @@ static const GDBusInterfaceVTable text_view_vtable = {
NULL,
};
/* }}} */
const GDBusInterfaceVTable *
gtk_atspi_get_text_vtable (GtkAccessible *accessible)
{
@ -1187,6 +1196,8 @@ typedef struct {
int selection_bound;
} TextChanged;
/* {{{ GtkEditable notification */
static void
insert_text_cb (GtkEditable *editable,
char *new_text,
@ -1274,6 +1285,9 @@ update_cursor (GtkTextBuffer *buffer,
update_selection (changed, cursor_position, selection_bound);
}
/* }}} */
/* {{{ GtkTextView notification */
static void
insert_range_cb (GtkTextBuffer *buffer,
GtkTextIter *iter,
@ -1378,6 +1392,8 @@ buffer_changed (GtkWidget *widget,
}
}
/* }}} */
void
gtk_atspi_connect_text_signals (GtkAccessible *accessible,
GtkAtspiTextChangedCallback text_changed,
@ -1450,3 +1466,5 @@ gtk_atspi_disconnect_text_signals (GtkAccessible *accessible)
g_object_set_data (G_OBJECT (accessible), "accessible-text-data", NULL);
}
/* vim:set foldmethod=marker expandtab: */