remove pkg, locale_dir parameters.
it's not mandatory for users.
Change-Id: Id865837dae6ac3cf01119f32dd74ae9a6006f378
int ret;
//Initialize ui_app. ui_app initializes basic resources including ui_viewmgr internally.
- ret = ui_application_init(PACKAGE, LOCALE_DIR);
+ ret = ui_application_init();
if (ret != UI_VIEWMGR_ERROR_NONE)
{
dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_init() is failed, ret = %d", ret);
{
public:
SampleApp()
- : UiApp(PACKAGE, LOCALE_DIR)
+ : UiApp()
{
}
~SampleApp()
/**
* @brief This is a constructor for initializing viewmgr.
*
- * @param[in] pkg The name of package.
* @param[in] key_listener The instance of UiBaseKeyListener.
*/
- UiBaseViewmgr(const char *pkg, UiBaseKeyListener *keyListener);
+ UiBaseViewmgr(UiBaseKeyListener *keyListener);
/**
* @brief This is a constructor for initializing viewmgr.
*
- * @param[in] pkg The name of package.
*/
- explicit UiBaseViewmgr(const char *pkg);
+ UiBaseViewmgr();
///Destructor.
virtual ~UiBaseViewmgr();
public:
- _UI_DISABLE_DEFAULT_CTOR(UiBaseViewmgr);
_UI_DISABLE_COPY_AND_ASSIGN(UiBaseViewmgr);
private:
/**
* @brief This is a constructor for initializing UiApp.
*
- * @param[in] pkg The name of package.
- * @param[in] loale_dir The path of locale directory.
*/
- UiApp(const char *pkg, const char *locale_dir);
+ UiApp();
///Destructor.
virtual ~UiApp();
static UiApp *getInstance();
public:
- _UI_DISABLE_DEFAULT_CTOR(UiApp);
_UI_DISABLE_COPY_AND_ASSIGN(UiApp);
};
class UiViewmgr: public efl_viewmanager::UiBaseViewmgr
{
protected:
- //Don't allow to create UiViewmgr instance
/**
* @brief This is a constructor for initializing viewmgr.
*
- * @param[in] pkg The name of package.
*/
- explicit UiViewmgr(const char *pkg);
+ UiViewmgr();
///Destructor.
virtual ~UiViewmgr();
public:
_UI_DISABLE_COPY_AND_ASSIGN(UiViewmgr);
- _UI_DISABLE_DEFAULT_CTOR(UiViewmgr);
private:
_UI_DECLARE_FRIENDS(UiView);
* @since_tizen 3.0
* @remarks Before exit application, call ui_application_term().
*
- * @param[in] pkg The name of package
- * @param[in] locale_dir The path of locale directory
- *
* @return @c 0 on success, otherwise a negative error value
* @retval #UI_VIEWMGR_ERROR_NONE Successful
* @retval #UI_VIEWMGR_ERROR_ALREADY_IN_PROGRESS Initialization was already done
* @see ui_application_term()
* @see ui_application_run()
*/
-EAPI int ui_application_init(const char *pkg, const char *locale_dir);
+EAPI int ui_application_init();
/**
* @brief Runs ui_application. This triggers application main loop.
/**
* @brief This is a constructor for initializing UiIfaceApp.
*
- * @param[in] pkg The name of package.
- * @param[in] loale_dir The path of locale directory.
* @param[in] viewmgr instance of ui_viewmgr.
*/
- UiIfaceApp(const char *pkg, const char *locale_dir, UiIfaceViewmgr *viewmgr);
+ UiIfaceApp(UiIfaceViewmgr *viewmgr);
///Destructor.
virtual ~UiIfaceApp();
bool _term();
public:
- UiBaseViewmgrImpl(UiBaseViewmgr *viewmgr, const char *pkg, UiBaseKeyListener *keyListener);
+ UiBaseViewmgrImpl(UiBaseViewmgr *viewmgr, UiBaseKeyListener *keyListener);
~UiBaseViewmgrImpl();
void activate();
return true;
}
-UiBaseViewmgrImpl::UiBaseViewmgrImpl(UiBaseViewmgr *viewmgr, const char *pkg, UiBaseKeyListener *keyListener)
+UiBaseViewmgrImpl::UiBaseViewmgrImpl(UiBaseViewmgr *viewmgr, UiBaseKeyListener *keyListener)
: _viewmgr(viewmgr), _keyListener(keyListener)
{
- if (!pkg) {
- LOGE("Invalid package name");
- return;
+ char *pkg = NULL;
+ int ret = app_get_id(&pkg);
+ if (ret != APP_ERROR_NONE)
+ {
+ LOGE("failed app_get_id(%d)", ret);
}
//Window
elm_win_indicator_mode_set(this->_win, ELM_WIN_INDICATOR_SHOW);
elm_win_indicator_opacity_set(this->_win, ELM_WIN_INDICATOR_OPAQUE);
elm_win_autodel_set(this->_win, EINA_TRUE);
+
+ free(pkg);
}
UiBaseViewmgrImpl::~UiBaseViewmgrImpl()
/* External class Implementation */
/***********************************************************************************************/
-UiBaseViewmgr::UiBaseViewmgr(const char *pkg, UiBaseKeyListener *key_listener)
+UiBaseViewmgr::UiBaseViewmgr(UiBaseKeyListener *key_listener)
: UiIfaceViewmgr()
{
- this->_impl = new UiBaseViewmgrImpl(this, pkg, key_listener);
+ this->_impl = new UiBaseViewmgrImpl(this, key_listener);
this->_impl->_init();
}
-UiBaseViewmgr::UiBaseViewmgr(const char *pkg)
- : UiBaseViewmgr(pkg, new UiBaseKeyListener(this))
+UiBaseViewmgr::UiBaseViewmgr()
+ : UiBaseViewmgr(new UiBaseKeyListener(this))
{
}
/* External class Implementation */
/***********************************************************************************************/
-UiApp::UiApp(const char *pkg, const char *locale_dir)
- : UiIfaceApp(pkg, locale_dir, new UiViewmgr(pkg))
+UiApp::UiApp()
+ : UiIfaceApp(new UiViewmgr())
{
}
/***********************************************************************************************/
/* External class Implementation */
/***********************************************************************************************/
-UiViewmgr::UiViewmgr(const char *pkg)
- : UiBaseViewmgr(pkg, new UiKeyListener(this))
+UiViewmgr::UiViewmgr()
+ : UiBaseViewmgr(new UiKeyListener(this))
{
}
}
}
- ui_app_capi(const char *pkg, const char *locale_dir)
- : UiApp(pkg, locale_dir)
+ ui_app_capi()
+ : UiApp()
{
}
static ui_app_capi *g_app = nullptr;
-EAPI int ui_application_init(const char *pkg, const char *locale_dir)
+EAPI int ui_application_init()
{
ui_app_capi *app = g_app;
if (app) return UI_VIEWMGR_ERROR_ALREADY_IN_PROGRESS;
- app = new ui_app_capi(pkg, locale_dir);
+ app = new ui_app_capi();
if (!app)
{
LOGE("Failed to create new ui_app_capi()!");
UiIfaceApp *app = nullptr;
UiIfaceViewmgr *viewmgr = nullptr;
- Eina_Stringshare *pkg = nullptr;
- Eina_Stringshare *locale_dir = nullptr;
- UiIfaceAppImpl(UiIfaceApp *app, const char *pkg, const char *locale_dir, UiIfaceViewmgr* viewmgr);
+ UiIfaceAppImpl(UiIfaceApp *app, UiIfaceViewmgr* viewmgr);
~UiIfaceAppImpl();
int run(int argc, char **argv);
- bool init();
bool onCreate();
void onTerminate();
void onPause();
app->onLowMemory(event_info);
}
-bool UiIfaceAppImpl::init()
-{
- /* Bind package locale file */
- bindtextdomain(this->pkg, this->locale_dir);
- textdomain(this->pkg);
-
- return true;
-}
-
-UiIfaceAppImpl::UiIfaceAppImpl(UiIfaceApp *app, const char *pkg, const char *locale_dir, UiIfaceViewmgr *viewmgr)
+UiIfaceAppImpl::UiIfaceAppImpl(UiIfaceApp *app, UiIfaceViewmgr *viewmgr)
: app(app), viewmgr(viewmgr)
{
- this->pkg = eina_stringshare_add(pkg);
- this->locale_dir = eina_stringshare_add(locale_dir);
}
int UiIfaceAppImpl::run(int argc, char **argv)
event_callback.resume = appResume;
event_callback.app_control = appControl;
+ //FIXME: don't add these events in default. this is a little burdensome to system.
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, uiAppLowBattery, this);
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, uiAppLowMemory, this);
ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, uiAppOrientChanged, this);
UiIfaceAppImpl::~UiIfaceAppImpl()
{
delete (this->viewmgr);
- eina_stringshare_del(this->pkg);
- eina_stringshare_del(this->locale_dir);
}
void UiIfaceAppImpl::onLangChanged(app_event_info_h event_info)
bool UiIfaceApp::onCreate()
{
- return this->_impl->init();
+ return true;
}
void UiIfaceApp::onPause()
{
}
-UiIfaceApp::UiIfaceApp(const char *pkg, const char *locale_dir, UiIfaceViewmgr *viewmgr)
+UiIfaceApp::UiIfaceApp(UiIfaceViewmgr *viewmgr)
{
if (_inst) {
throw UiIfaceException("Requested to create UiIfaceApp instance multiple times!!");
}
_inst = this;
- this->_impl = new UiIfaceAppImpl(this, pkg, locale_dir, viewmgr);
+ this->_impl = new UiIfaceAppImpl(this, viewmgr);
}
int UiIfaceApp::run(int argc, char **argv)