[at-spi2-core: 2/2] Merge branch 'enum-types'



commit e74c40ea4b7616930557ca2e9eda73f5b344a4b5
Merge: a29788d 7afb51e
Author: Mike Gorse <mgorse suse com>
Date:   Fri May 10 18:56:32 2013 -0500

    Merge branch 'enum-types'
    
    Conflicts:
        atspi/Makefile.am
        atspi/atspi-accessible.c

 atspi/Makefile.am                 |   17 ++++-
 atspi/atspi-accessible.c          |  155 ++++---------------------------------
 atspi/atspi-accessible.h          |    2 -
 atspi/atspi-constants.h           |    4 +-
 atspi/atspi-enum-types.c.template |   39 +++++++++
 atspi/atspi-enum-types.h.template |   27 +++++++
 atspi/atspi-misc-private.h        |    2 +
 atspi/atspi-misc.c                |   14 ++++
 atspi/atspi-registry.c            |    3 +-
 atspi/atspi-registry.h            |    3 +-
 atspi/atspi-stateset.c            |   71 +++--------------
 atspi/atspi-types.h               |    6 +-
 atspi/atspi.h                     |    2 +
 configure.ac                      |    2 +
 14 files changed, 138 insertions(+), 209 deletions(-)
---
diff --cc atspi/Makefile.am
index f89d13a,2855185..4d34540
--- a/atspi/Makefile.am
+++ b/atspi/Makefile.am
@@@ -109,29 -113,49 +113,38 @@@ BUILT_SOURCES = 
  #atspi-constants.h: $(top_srcdir)/xml/spec.xml $(top_srcdir)/tools/c-constants-gen.py
  #     python $(top_srcdir)/tools/c-constants-gen.py Atspi $(top_srcdir)/xml/spec.xml atspi-constants
  
+ ENUM_TYPES = \
+       atspi-constants.h \
+       atspi-types.h
+ 
+ atspi-enum-types.h: atspi-enum-types.h.template $(ENUM_TYPES) $(GLIB_MKENUMS)
+       $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template atspi-enum-types.h.template $(ENUM_TYPES)) > 
$@
+ 
+ atspi-enum-types.c: atspi-enum-types.c.template $(ENUM_TYPES) $(GLIB_MKENUMS)
+       $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template atspi-enum-types.c.template $(ENUM_TYPES)) > 
$@
+ 
 +-include $(INTROSPECTION_MAKEFILE)
 +INTROSPECTION_GIRS =
 +INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
 +INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
 +
  if HAVE_INTROSPECTION
- 
 -INTROSPECTION_FILES = $(libatspi_la_SOURCES)
 -
 -Atspi-2.0.gir: $(INTROSPECTION_SCANNER) \
 -              libatspi.la \
 -              $(INTROSPECTION_FILES)
 -      $(AM_V_GEN)$(INTROSPECTION_SCANNER) -v \
 -              --namespace Atspi \
 -              --nsversion=2.0 \
 -              -I$(top_builddir) \
 -              -I$(top_srcdir) \
 -              --include=GLib-2.0 \
 -              --include=GObject-2.0 \
 -              --libtool="$(top_builddir)/libtool" \
 -              --library=libatspi.la \
 -              --library=$(top_builddir)/dbind/libdbind.la \
 -              --pkg dbus-1 \
 -              --warn-all \
 -              --output $@ \
 -              $(addprefix $(srcdir)/, $(INTROSPECTION_FILES))
 +Atspi-2.0.gir: libatspi.la
 +Atspi_2_0_gir_INCLUDES = GLib-2.0 GObject-2.0
 +Atspi_2_0_gir_PACKAGES = dbus-1
 +Atspi_2_0_gir_EXPORT_PACKAGES = atspi-2
 +Atspi_2_0_gir_CFLAGS = -I$(top_builddir) -I$(top_srcdir)
 +Atspi_2_0_gir_LIBS = libatspi.la $(top_builddir)/dbind/libdbind.la
 +Atspi_2_0_gir_FILES = $(libatspi_la_SOURCES)
 +Atspi_2_0_gir_SCANNERFLAGS = --namespace Atspi --nsversion=2.0
 +INTROSPECTION_SCANNER_ARGS += --c-include='atspi/atspi.h'
 +INTROSPECTION_GIRS += Atspi-2.0.gir
  
  girdir = $(datadir)/gir-1.0
 -gir_DATA = Atspi-2.0.gir
 -
 -%.typelib: %.gir $(INTROSPECTION_COMPILER)
 -      $(AM_V_GEN)$(top_builddir)/libtool --mode=execute \
 -          $(INTROSPECTION_COMPILER) \
 -              --includedir=$(srcdir) \
 -              --includedir=. \
 -              $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
 +gir_DATA = $(INTROSPECTION_GIRS)
  
 -typelibsdir = $(libdir)/girepository-1.0/
 -typelibs_DATA = $(gir_DATA:.gir=.typelib)
 +typelibdir = $(libdir)/girepository-1.0
 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
  
  CLEANFILES = \
      $(gir_DATA) \
diff --cc atspi/atspi-accessible.c
index 03bceca,9461ece..fc2b48f
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@@ -197,143 -176,9 +197,10 @@@ atspi_accessible_class_init (AtspiAcces
  
    object_class->dispose = atspi_accessible_dispose;
    object_class->finalize = atspi_accessible_finalize;
 -}
  
 +  quark_locale = g_quark_from_string ("accessible-locale");
 +}
  
- /* TODO: Generate following from spec? */
- static const char *role_names [] =
- {
-   "invalid",
-   "accelerator label",
-   "alert",
-   "animation",
-   "arrow",
-   "calendar",
-   "canvas",
-   "check box",
-   "check menu item",
-   "color chooser",
-   "column header",
-   "combo box",
-   "dateeditor",
-   "desktop icon",
-   "desktop frame",
-   "dial",
-   "dialog",
-   "directory pane",
-   "drawing area",
-   "file chooser",
-   "filler",
-   "focus traversable",
-   "fontchooser",
-   "frame",
-   "glass pane",
-   "html container",
-   "icon",
-   "image",
-   "internal frame",
-   "label",
-   "layered pane",
-   "list",
-   "list item",
-   "menu",
-   "menu bar",
-   "menu item",
-   "option pane",
-   "page tab",
-   "page tab list",
-   "panel",
-   "password text",
-   "popup menu",
-   "progress bar",
-   "push button",
-   "radio button",
-   "radio menu item",
-   "root pane",
-   "row header",
-   "scroll bar",
-   "scroll pane",
-   "separator",
-   "slider",
-   "spin button",
-   "split pane",
-   "statusbar",
-   "table",
-   "table cell",
-   "table column header",
-   "table row header",
-   "tear off menu item",
-   "terminal",
-   "text",
-   "toggle button",
-   "tool bar",
-   "tool tip",
-   "tree",
-   "tree table",
-   "unknown",
-   "viewport",
-   "window",
-   NULL,
-   "header",
-   "footer",
-   "paragraph",
-   "ruler",
-   "application",
-   "autocomplete",
-   "editbar",
-   "embedded component",
-   "entry",
-   "chart",
-   "caption",
-   "document frame",
-   "heading",
-   "page",
-   "section",
-   "redundant object",
-   "form",
-   "link",
-   "input method window",
-   "table row",
-   "tree item",
-   "document spreadsheet",
-   "document presentation",
-   "document text",
-   "document web",
-   "document email",
-   "comment",
-   "list box",
-   "grouping",
-   "image map",
-   "notification",
-   "info bar",
-   "level bar"
- };
- 
- #define MAX_ROLES (sizeof (role_names) / sizeof (char *))
- 
- /**
-  * atspi_role_get_name:
-  * @role: an #AtspiRole object to query.
-  *
-  * Gets a localizable string that indicates the name of an #AtspiRole.
-  * <em>DEPRECATED.</em>
-  *
-  * Returns: a localizable string name for an #AtspiRole enumerated type.
-  **/
- gchar *
- atspi_role_get_name (AtspiRole role)
- {
-   if (role < MAX_ROLES && role_names [(int) role])
-     {
-       return g_strdup (role_names [(int) role]);
-     }
-   else
-     {
-       return g_strdup ("");
-     }
- }
- 
  /**
   * atspi_accessible_get_name:
   * @obj: a pointer to the #AtspiAccessible object on which to operate.
@@@ -621,14 -461,26 +488,24 @@@ atspi_accessible_get_role (AtspiAccessi
  gchar *
  atspi_accessible_get_role_name (AtspiAccessible *obj, GError **error)
  {
+   AtspiRole role = atspi_accessible_get_role (obj, error);
    char *retval = NULL;
-   AtspiRole role;
+   GTypeClass *type_class;
+   GEnumValue *value;
+   const gchar *name = NULL;
  
-   g_return_val_if_fail (obj != NULL, NULL);
+   type_class = g_type_class_ref (ATSPI_TYPE_ROLE);
+   g_return_val_if_fail (G_IS_ENUM_CLASS (type_class), NULL);
+ 
+   value = g_enum_get_value (G_ENUM_CLASS (type_class), role);
+ 
+   if (value)
+     {
+       retval = value->value_nick;
+     }
  
-   role = atspi_accessible_get_role (obj, error);
-   if (role >= 0 && role < MAX_ROLES && role != ATSPI_ROLE_EXTENDED)
-     return g_strdup (role_names [role]);
+   if (retval)
 -    return g_strdup (retval);
 -
 -  g_return_val_if_fail (obj != NULL, NULL);
++    return _atspi_name_compat (g_strdup (retval));
  
    _atspi_dbus_call (obj, atspi_interface_accessible, "GetRoleName", error, "=>s", &retval);
  
@@@ -1478,9 -1312,10 +1355,9 @@@ _atspi_accessible_new (AtspiApplicatio
  
  /**
   * atspi_accessible_set_cache_mask:
 - *
   * @accessible: The #AtspiAccessible to operate on.  Must be the desktop or
   *             the root of an application.
-  * @mask: (type int): An #AtspiCache specifying a bit mask of the types of data to cache.
+  * @mask: An #AtspiCache specifying a bit mask of the types of data to cache.
   *
   * Sets the type of data to cache for accessibles.
   * If this is not set for an application or is reset to ATSPI_CACHE_UNDEFINED,
diff --cc atspi/atspi-accessible.h
index 7047016,bbee0ce..f4e2ed3
--- a/atspi/atspi-accessible.h
+++ b/atspi/atspi-accessible.h
@@@ -66,10 -64,8 +66,8 @@@ struct _AtspiAccessibleClas
  GType atspi_accessible_get_type (void); 
  
  AtspiAccessible *
 -atspi_accessible_new (AtspiApplication *app, const gchar *path);
 +_atspi_accessible_new (AtspiApplication *app, const gchar *path);
  
- gchar * atspi_role_get_name (AtspiRole role);
- 
  gchar * atspi_accessible_get_name (AtspiAccessible *obj, GError **error);
  
  gchar * atspi_accessible_get_description (AtspiAccessible *obj, GError **error);
diff --cc atspi/atspi-misc-private.h
index c7de37b,865ab5f..26fb793
--- a/atspi/atspi-misc-private.h
+++ b/atspi/atspi-misc-private.h
@@@ -154,8 -186,4 +154,10 @@@ typedef enu
  
  extern GMainLoop *atspi_main_loop;
  extern gboolean atspi_no_cache;
 +
 +GHashTable *_atspi_get_live_refs ();
++
++gchar *_atspi_name_compat (gchar *in);
 +G_END_DECLS
 +
  #endif        /* _ATSPI_MISC_PRIVATE_H_ */
diff --cc atspi/atspi-misc.c
index 67b92df,616dc22..efd2ba6
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@@ -1575,54 -1374,5 +1575,68 @@@ atspi_get_a11y_bus (void
        }
      }
    
 -  return bus;
 +  /* Simulate a weak ref on the bus */
 +  dbus_connection_set_data (a11y_bus, a11y_dbus_slot, a11y_bus, a11y_bus_free);
 +
 +  return a11y_bus;
 +}
 +
 +/**
 + *  Set the timeout used for method calls. If this is not set explicitly,
 + *  a default of 0.8 ms is used.
 + *  Note that at-spi2-registryd currently uses a timeout of 3 seconds when
 + *  sending a keyboard event notification. This means that, if an AT makes
 + *  a call in response to the keyboard notification and the application
 + *  being called does not respond before the timeout is reached,
 + *  at-spi2-registryd will time out on the keyboard event notification and
 + *  pass the key onto the application (ie, reply to indicate that the key
 + *  was not consumed), so this may make it undesirable to set a timeout
 + *  larger than 3 seconds.
 + *
 + *  @val: The timeout value, in milliseconds, or -1 to disable the timeout.
 + *  @startup_time: The amount of time, in milliseconds, to allow to pass
 + *  before enforcing timeouts on an application. Can be used to prevent
 + *  timeout exceptions if an application is likely to block for an extended
 + *  period of time on initialization. -1 can be passed to disable this
 + *  behavior.
 + *
 + * By default, the normal timeout is set to 800 ms, and the application startup
 + * timeout is set to 15 seconds.
 + */
 +void
 +atspi_set_timeout (gint val, gint startup_time)
 +{
 +  method_call_timeout = val;
 +  app_startup_time = startup_time;
 +}
 +
 +#ifdef DEBUG_REF_COUNTS
 +static void
 +print_disposed (gpointer key, gpointer value, gpointer data)
 +{
 +  AtspiAccessible *accessible = key;
 +  if (accessible->parent.app)
 +    return;
 +  g_print ("disposed: %s %d\n", accessible->name, accessible->role);
 +}
 +
 +void
 +debug_disposed ()
 +{
 +  g_hash_table_foreach (live_refs, print_disposed, NULL);
 +}
 +#endif
++
++gchar *
++_atspi_name_compat (gchar *name)
++{
++  gchar *p = name;
++
++  while (*p)
++  {
++    if (*p == '-')
++      *p = ' ';
++    p++;
++  }
++  return name;
+ }
diff --cc atspi/atspi-registry.c
index 116da19,51392d0..fa87660
--- a/atspi/atspi-registry.c
+++ b/atspi/atspi-registry.c
@@@ -197,27 -119,32 +197,28 @@@ atspi_register_keystroke_listener (Atsp
                                         GArray             *key_set,
                                         AtspiKeyMaskType         modmask,
                                         AtspiKeyEventMask        event_types,
-                                        gint sync_type, GError **error)
+                                        AtspiKeyListenerSyncType sync_type,
+                                          GError **error)
  {
 -  GArray *d_key_set;
 -  gchar *path = _atspi_device_listener_get_path (listener);
 -  gint                                i;
 -  dbus_uint32_t d_modmask = modmask;
 -  dbus_uint32_t d_event_types = event_types;
 -  AtspiEventListenerMode     listener_mode;
 -  gboolean                          retval = FALSE;
 -  DBusError d_error;
 +  DeviceListenerEntry *e;
  
 -  if (!listener)
 -    {
 -      return retval;
 -    }
 +  g_return_val_if_fail (listener != NULL, FALSE);
  
 -  /* copy the keyval filter values from the C api into the DBind KeySet */
 +  e = g_new0 (DeviceListenerEntry, 1);
 +  e->listener = listener;
 +  e->modmask = modmask;
 +  e->event_types = event_types;
 +  e->sync_type = sync_type;
    if (key_set)
      {
 -      d_key_set = g_array_sized_new (FALSE, TRUE, sizeof (AtspiKeyDefinition), key_set->len);
 -      d_key_set->len = key_set->len;
 -      for (i = 0; i < key_set->len; ++i)
 +      gint i;
 +      e->key_set = g_array_sized_new (FALSE, TRUE, sizeof (AtspiKeyDefinition),
 +                                      key_set->len);
 +      e->key_set->len = key_set->len;
 +      for (i = 0; i < key_set->len; i++)
          {
          AtspiKeyDefinition *kd =  ((AtspiKeyDefinition *) key_set->data) + i;
 -        AtspiKeyDefinition *d_kd =  ((AtspiKeyDefinition *) d_key_set->data) + i;
 +        AtspiKeyDefinition *d_kd =  ((AtspiKeyDefinition *) e->key_set->data) + i;
            d_kd->keycode = kd->keycode;
          d_kd->keysym = kd->keysym;
          if (kd->keystring)
diff --cc atspi/atspi-stateset.c
index fd6fc0c,28e272f..33c28a7
--- a/atspi/atspi-stateset.c
+++ b/atspi/atspi-stateset.c
@@@ -319,4 -271,4 +273,3 @@@ atspi_state_set_remove (AtspiStateSet *
    g_return_if_fail (set != NULL);
    set->states &= ~((gint64)1 << state);
  }
--


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]