X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Ftizen%2Fadaptor-impl-tizen.cpp;h=70754a9747e83ba52d8bb477df1c0e09e91c4d4b;hb=4a014cd851e4128f8efadcc3cf3aa77fda82bcc6;hp=9972162daa2464bbaec9e1fcc2c90ab7937550c2;hpb=011527701cce1d5419b5feeafdf17080a075a800;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/tizen/adaptor-impl-tizen.cpp b/adaptors/tizen/adaptor-impl-tizen.cpp index 9972162..70754a9 100644 --- a/adaptors/tizen/adaptor-impl-tizen.cpp +++ b/adaptors/tizen/adaptor-impl-tizen.cpp @@ -19,12 +19,14 @@ #include // EXTERNAL INCLUDES -#include +#include #ifdef APPCORE_WATCH_AVAILABLE #include #include #endif +#include + namespace Dali { @@ -34,6 +36,30 @@ namespace Internal namespace Adaptor { +namespace +{ + +static void OnSystemLanguageChanged( system_settings_key_e key, void* data ) +{ + char* locale = NULL; + if( system_settings_get_value_string( SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale ) != SYSTEM_SETTINGS_ERROR_NONE || + locale == NULL ) + { + DALI_LOG_ERROR( "DALI OnSystemLanguageChanged failed " ); + return; + } + + Adaptor* adaptor = static_cast< Adaptor* >( data ); + if( adaptor != NULL ) + { + adaptor->SetRootLayoutDirection( locale ); + } + + free( locale ); +} + +} // namesapce + void Adaptor::GetDataStoragePath( std::string& path) { #ifdef USE_APPFW @@ -77,11 +103,38 @@ void Adaptor::SurfaceInitialized() char *appId; app_get_id(&appId); - Ecore_Wl_Window* ecoreWlWindow = AnyCast( mNativeWindow ); - screen_connector_provider_remote_enable(appId, ecore_wl_window_surface_get(ecoreWlWindow)); + // Use strdup() in app_get_id(), so need to free memory + if( appId ) + { + Ecore_Wl_Window* ecoreWlWindow = AnyCast( mNativeWindow ); + screen_connector_provider_remote_enable(appId, ecore_wl_window_surface_get(ecoreWlWindow)); + free( appId ); + } #endif } +void Adaptor::SetupSystemInformation() +{ + if( system_settings_add_changed_cb( SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, OnSystemLanguageChanged, this ) != SYSTEM_SETTINGS_ERROR_NONE ) + { + DALI_LOG_ERROR( "DALI system_settings_set_changed_cb failed.\n" ); + return; + } + + char* locale = NULL; + if( system_settings_get_value_string( SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale ) != SYSTEM_SETTINGS_ERROR_NONE || + locale == NULL ) + { + DALI_LOG_ERROR( "DALI OnSystemLanguageChanged failed " ); + return; + } + + SetRootLayoutDirection( locale ); + + free( locale ); + +} + } // namespace Adaptor } // namespace Internal