Revert "Revert "Merge remote-tracking branch 'origin/sandbox/mniesluchow/upstream_2_1...
[platform/upstream/atk.git] / atk / atkobject.c
index 0136c7a..e9c5310 100755 (executable)
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
+
 #include <string.h>
 #include <locale.h>
 
 #include <glib-object.h>
-
-#ifdef G_OS_WIN32
-#define STRICT
-#include <windows.h>
-#undef STRICT
-#undef FOCUS_EVENT             /* <windows.h> pollutes the namespace
-                                * like a six hundred pound gorilla */
-#endif
+#include <glib/gi18n-lib.h>
 
 #include "atk.h"
 #include "atkmarshal.h"
-#include "atk-enum-types.h"
-#include "atkintl.h"
+#include "atkprivate.h"
 
 /**
  * SECTION:atkobject
@@ -207,6 +201,17 @@ enum {
   N_("block quote")
   N_("audio")
   N_("video")
+  N_("definition")
+  N_("article")
+  N_("landmark")
+  N_("log")
+  N_("marquee")
+  N_("math")
+  N_("rating")
+  N_("timer")
+  N_("description list")
+  N_("description term")
+  N_("description value")
 #endif /* 0 */
 
 static void            atk_object_class_init        (AtkObjectClass  *klass);
@@ -267,98 +272,6 @@ static const gchar* const atk_object_name_property_table_summary = "accessible-t
 static const gchar* const atk_object_name_property_table_caption_object = "accessible-table-caption-object";
 static const gchar* const atk_object_name_property_hypertext_num_links = "accessible-hypertext-nlinks";
 
-#ifdef G_OS_WIN32
-
-static HMODULE atk_dll;
-
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
-        DWORD     fdwReason,
-        LPVOID    lpvReserved)
-{
-  switch (fdwReason)
-    {
-    case DLL_PROCESS_ATTACH:
-      atk_dll = (HMODULE) hinstDLL;
-      break;
-    }
-
-  return TRUE;
-}
-
-static const char *
-get_atk_locale_dir (void)
-{
-  static gchar *atk_localedir = NULL;
-
-  if (!atk_localedir)
-    {
-      const gchar *p;
-      gchar *root, *temp;
-      
-      /* ATK_LOCALEDIR might end in either /lib/locale or
-       * /share/locale. Scan for that slash.
-       */
-      p = ATK_LOCALEDIR + strlen (ATK_LOCALEDIR);
-      while (*--p != '/')
-       ;
-      while (*--p != '/')
-       ;
-
-      root = g_win32_get_package_installation_directory_of_module (atk_dll);
-      temp = g_build_filename (root, p, NULL);
-      g_free (root);
-
-      /* atk_localedir is passed to bindtextdomain() which isn't
-       * UTF-8-aware.
-       */
-      atk_localedir = g_win32_locale_filename_from_utf8 (temp);
-      g_free (temp);
-    }
-  return atk_localedir;
-}
-
-#undef ATK_LOCALEDIR
-
-#define ATK_LOCALEDIR get_atk_locale_dir()
-
-#endif
-
-static void
-gettext_initialization (void)
-{
-#ifdef ENABLE_NLS
-  static gboolean gettext_initialized = FALSE;
-
-  if (!gettext_initialized)
-    {
-      const char *dir = g_getenv ("ATK_ALT_LOCALEDIR");
-
-      gettext_initialized = TRUE;
-      if (dir == NULL)
-        dir = ATK_LOCALEDIR;
-
-      bindtextdomain (GETTEXT_PACKAGE, dir);
-#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
-      bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-    }
-#endif
-}
-
-static void
-compact_role_name (gchar *role_name)
-{
-  gchar *p = role_name;
-
-  while (*p)
-    {
-      if (*p == '-')
-        *p = ' ';
-      p++;
-    }
-}
-
 static void
 initialize_role_names ()
 {
@@ -380,7 +293,7 @@ initialize_role_names ()
       enum_value = g_enum_get_value (G_ENUM_CLASS (enum_class), i);
       role_name = g_strdup (enum_value->value_nick);
       // We want the role names to be in the format "check button" and not "check-button"
-      compact_role_name (role_name);
+      _compact_name (role_name);
       g_ptr_array_add (role_names, role_name);
     }
 
@@ -451,7 +364,7 @@ atk_object_class_init (AtkObjectClass *klass)
   klass->visible_data_changed = NULL;
   klass->active_descendant_changed = NULL;
 
-  gettext_initialization ();
+  _gettext_initialization ();
 
   g_object_class_install_property (gobject_class,
                                    PROP_NAME,
@@ -474,6 +387,16 @@ atk_object_class_init (AtkObjectClass *klass)
                                                         _("Parent of the current accessible as returned by atk_object_get_parent()"),
                                                         ATK_TYPE_OBJECT,
                                                         G_PARAM_READWRITE));
+
+  /**
+   * AtkObject:accessible-value:
+   *
+   * Numeric value of this object, in case being and AtkValue.
+   *
+   * Deprecated: Since 2.12. Use atk_value_get_value_and_text() to get
+   * the value, and value-changed signal to be notified on their value
+   * changes.
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_VALUE,
                                    g_param_spec_double (atk_object_name_property_value,
@@ -510,6 +433,14 @@ atk_object_class_init (AtkObjectClass *klass)
                                                         G_MAXINT,
                                                         G_MININT,
                                                         G_PARAM_READABLE));
+
+  /**
+   * AtkObject:accessible-table-caption:
+   *
+   * Table caption.
+   *
+   * Deprecated: Since 1.3. Use table-caption-object instead.
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_TABLE_CAPTION,
                                    g_param_spec_string (atk_object_name_property_table_caption,
@@ -517,6 +448,14 @@ atk_object_class_init (AtkObjectClass *klass)
                                                         _("Is used to notify that the table caption has changed; this property should not be used. accessible-table-caption-object should be used instead"),
                                                         NULL,
                                                         G_PARAM_READWRITE));
+  /**
+   * AtkObject:accessible-table-column-header:
+   *
+   * Accessible table column header.
+   *
+   * Deprecated: Since 2.12. Use atk_table_get_column_header() and
+   * atk_table_set_column_header() instead.
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_TABLE_COLUMN_HEADER,
                                    g_param_spec_object (atk_object_name_property_table_column_header,
@@ -524,6 +463,15 @@ atk_object_class_init (AtkObjectClass *klass)
                                                         _("Is used to notify that the table column header has changed"),
                                                         ATK_TYPE_OBJECT,
                                                         G_PARAM_READWRITE));
+
+  /**
+   * AtkObject:accessible-table-column-description:
+   *
+   * Accessible table column description.
+   *
+   * Deprecated: Since 2.12. Use atk_table_get_column_description()
+   * and atk_table_set_column_description() instead.
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_TABLE_COLUMN_DESCRIPTION,
                                    g_param_spec_string (atk_object_name_property_table_column_description,
@@ -531,6 +479,15 @@ atk_object_class_init (AtkObjectClass *klass)
                                                         _("Is used to notify that the table column description has changed"),
                                                         NULL,
                                                         G_PARAM_READWRITE));
+
+  /**
+   * AtkObject:accessible-table-row-header:
+   *
+   * Accessible table row header.
+   *
+   * Deprecated: Since 2.12. Use atk_table_get_row_header() and
+   * atk_table_set_row_header() instead.
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_TABLE_ROW_HEADER,
                                    g_param_spec_object (atk_object_name_property_table_row_header,
@@ -538,6 +495,14 @@ atk_object_class_init (AtkObjectClass *klass)
                                                         _("Is used to notify that the table row header has changed"),
                                                         ATK_TYPE_OBJECT,
                                                         G_PARAM_READWRITE));
+  /**
+   * AtkObject:accessible-table-row-description:
+   *
+   * Accessible table row description.
+   *
+   * Deprecated: Since 2.12. Use atk_table_get_row_description() and
+   * atk_table_set_row_description() instead.
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_TABLE_ROW_DESCRIPTION,
                                    g_param_spec_string (atk_object_name_property_table_row_description,
@@ -603,7 +568,7 @@ atk_object_class_init (AtkObjectClass *klass)
    * The signal "focus-event" is emitted when an object gained or lost
    * focus.
    *
-   * Deprecated: Since 2.9.4. Use #AtkObject::state-change signal instead.
+   * Deprecated: 2.9.4: Use #AtkObject::state-change signal instead.
    */
   atk_object_signals[FOCUS_EVENT] =
     g_signal_new ("focus_event",
@@ -617,11 +582,22 @@ atk_object_class_init (AtkObjectClass *klass)
   /**
    * AtkObject::property-change:
    * @atkobject: the object which received the signal.
-   * @arg1: The new value of the property which changed.
+   * @arg1: an #AtkPropertyValues containing the new value of the
+   *   property which changed.
    *
    * The signal "property-change" is emitted when an object's property
-   * value changes. The detail identifies the name of the property
-   * whose value has changed.
+   * value changes. @arg1 contains an #AtkPropertyValues with the name
+   * and the new value of the property whose value has changed. Note
+   * that, as with GObject notify, getting this signal does not
+   * guarantee that the value of the property has actually changed; it
+   * may also be emitted when the setter of the property is called to
+   * reinstate the previous value.
+   *
+   * Toolkit implementor note: ATK implementors should use
+   * g_object_notify() to emit property-changed
+   * notifications. #AtkObject::property-changed is needed by the
+   * implementation of atk_add_global_event_listener() because GObject
+   * notify doesn't support emission hooks.
    */
   atk_object_signals[PROPERTY_CHANGE] =
     g_signal_new ("property_change",
@@ -1224,7 +1200,10 @@ atk_object_remove_property_change_handler  (AtkObject *accessible,
  * @state: an #AtkState whose state is changed
  * @value: a gboolean which indicates whether the state is being set on or off
  * 
- * Emits a state-change signal for the specified state. 
+ * Emits a state-change signal for the specified state.
+ *
+ * Note that as a general rule when the state of an existing object changes,
+ * emitting a notification is expected.
  **/
 void
 atk_object_notify_state_change (AtkObject *accessible,
@@ -1590,7 +1569,7 @@ atk_role_get_name (AtkRole role)
 const gchar*
 atk_role_get_localized_name (AtkRole role)
 {
-  gettext_initialization ();
+  _gettext_initialization ();
 
   return dgettext (GETTEXT_PACKAGE, atk_role_get_name (role));
 }
@@ -1608,7 +1587,7 @@ atk_object_real_get_object_locale (AtkObject *object)
  * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
  * of @accessible.
  *
- * Since: 2.7.90
+ * Since: 2.8
  *
  * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES
  *          locale of @accessible.