stanluk pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=99a32ea4bc83e1bcd4d19bd47ab6434ac142e76a

commit 99a32ea4bc83e1bcd4d19bd47ab6434ac142e76a
Author: Lukasz Stanislawski <l.stanisl...@samsung.com>
Date:   Wed Jun 25 11:56:36 2014 +0200

    atspi: unify atspi initialization
    
    commit removes internal elm_atspi_init function and moves atspi_app_object
    creation to atspi_bridge.
---
 src/lib/elm_atspi_app_object.c | 29 -----------------------------
 src/lib/elm_atspi_bridge.c     | 18 ++++++++++++------
 src/lib/elm_main.c             |  3 ++-
 src/lib/elm_priv.h             |  5 +----
 src/lib/elm_win.c              |  4 ++--
 5 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/src/lib/elm_atspi_app_object.c b/src/lib/elm_atspi_app_object.c
index 8e8576a..6313250 100644
--- a/src/lib/elm_atspi_app_object.c
+++ b/src/lib/elm_atspi_app_object.c
@@ -13,8 +13,6 @@
 #include "elm_atspi_app_object.eo.h"
 
 extern Eina_List *_elm_win_list;
-static Eo *_atspi_root;
-static int _init;
 
 typedef struct _Elm_Atspi_App_Object_Data Elm_Atspi_App_Object_Data;
 
@@ -71,31 +69,4 @@ 
_elm_atspi_app_object_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSE
    return ELM_ATSPI_ROLE_APPLICATION;
 }
 
-EAPI void
-_elm_atspi_init(void)
-{
-   if (!_init)
-     {
-        _atspi_root = eo_add(ELM_ATSPI_APP_OBJECT_CLASS, NULL);
-        _init = 1;
-     }
-}
-
-EAPI void
-_elm_atspi_shutdown(void)
-{
-   if (_init)
-     {
-        eo_unref(_atspi_root);
-        _atspi_root = NULL;
-        _init = 0;
-     }
-}
-
-EAPI Eo*
-_elm_atspi_root_get(void)
-{
-   return _atspi_root;
-}
-
 #include "elm_atspi_app_object.eo.c"
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index bdfea92..16be166 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -18,6 +18,8 @@
 #include "elm_priv.h"
 #include <assert.h>
 
+#include "elm_atspi_app_object.eo.h"
+
 #include "elm_interface_atspi_accessible.h"
 #include "elm_interface_atspi_accessible.eo.h"
 #include "elm_interface_atspi_component.eo.h"
@@ -3257,14 +3259,12 @@ _elm_atspi_bridge_init(void)
    Eldbus_Message *msg;
    Eldbus_Connection *session_bus;
 
-   if (!_init_count && (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF))
+   if (!_init_count)
      {
-        _elm_atspi_init();
-
-        _root = _elm_atspi_root_get();
+        _root = eo_add(ELM_ATSPI_APP_OBJECT_CLASS, NULL);
         if (!_root)
           {
-             ERR("Unable to get root object");
+             ERR("Unable to create root object");
              return;
           }
 
@@ -3282,12 +3282,18 @@ _elm_atspi_bridge_init(void)
      }
 }
 
+EAPI Eo*
+_elm_atspi_bridge_root_get(void)
+{
+   return _root;
+}
+
 void
 _elm_atspi_bridge_shutdown(void)
 {
    if (_init_count)
      {
-        _elm_atspi_shutdown();
+        eo_unref(_root);
 
         if (_cache_update_idler)
           ecore_idler_del(_cache_update_idler);
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index 9ca9a03..feda887 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -310,7 +310,8 @@ elm_init(int    argc,
    system_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MEMORY_STATE, 
_sys_memory_changed, NULL);
    system_handlers[1] = ecore_event_handler_add(ECORE_EVENT_LOCALE_CHANGED, 
_sys_lang_changed, NULL);
 
-   _elm_atspi_bridge_init();
+   if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF)
+     _elm_atspi_bridge_init();
 
    return _elm_init_count;
 }
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index c9994df..e84bad5 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -342,10 +342,7 @@ struct _Elm_Datetime_Module_Data
                                     Elm_Datetime_Field_Type field_type);
 };
 
-void                 _elm_atspi_init(void);
-void                 _elm_atspi_shutdown(void);
-Eo                   *_elm_atspi_root_get(void);
-
+Eo                   *_elm_atspi_bridge_root_get(void);
 void                 _elm_atspi_bridge_init(void);
 void                 _elm_atspi_bridge_shutdown(void);
 
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 7e3be34..11ca2d3 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3335,7 +3335,7 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const 
char *name, Elm_Win_Type t
    if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON)
      {
         eo_do(obj, 
elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW));
-        
elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_root_get(),
 obj);
+        
elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_bridge_root_get(),
 obj);
         eo_do(obj, 
eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL));
      }
 
@@ -4819,7 +4819,7 @@ EOLIAN static Eo*
 _elm_win_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, 
Elm_Win_Data *sd EINA_UNUSED)
 {
    // attach all kinds of windows directly to ATSPI application root object
-   return _elm_atspi_root_get();
+   return _elm_atspi_bridge_root_get();
 }
 
 #include "elm_win.eo.c"

-- 


Reply via email to