atspi: unify atspi initialization

commit removes internal elm_atspi_init function and moves atspi_app_object
creation to atspi_bridge.
This commit is contained in:
Lukasz Stanislawski 2014-06-25 11:56:36 +02:00
parent 2b700cc8df
commit de9d24e09d
5 changed files with 17 additions and 42 deletions

View File

@ -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"

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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"