#ifndef __AIR_SETTINGS_FAVORITEMGR_H__
#define __AIR_SETTINGS_FAVORITEMGR_H__
+#include <Elementary.h>
+
/**
* @brief Sets the favorite star on or off on the object.
*
/**
* @brief
*
-* @return
-*/
-struct data_class *get_location_data_class(void);
-
-/**
-* @brief
-*
* @param selected_item
*/
void data_location_set_new_system_location(Elm_Object_Item *selected_item);
* @param lang
*/
void data_location_fill_list_data(struct listmgr *list_mgr, Elm_Object_Item **get_country, const char *lang);
+void data_location_free_list_data();
#endif /* __AIR_SETTINGS_DATA_LOCATION_H__ */
void set_favorite(Evas_Object *obj, Eina_Bool status)
{
- SETTING_TRACE_BEGIN;
if(EINA_TRUE == status) {
elm_object_signal_emit(obj, SIG_FAV_ADD, SRC_ELM);
} else {
static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev)
{
- SETTING_TRACE_BEGIN;
struct menumgr *m = NULL;
if (!data || !ev || !obj) {
void menumgr_update(struct menumgr *m)
{
- SETTING_TRACE_BEGIN;
int i;
char *str = NULL;
#include <utils_i18n.h>
#include "app_debug.h"
-#include "common/datamgr.h"
-#include "common/inputmgr.h"
#include "data/system/data_location.h"
#define DEFAULT_COUNTRY "US"
#define MAX_COUNTRY_NAME_LENGTH 250
-struct _priv {
- Eina_List *list;
- void (*event_cb)(enum event_type type, void *data);
- void *cb_data;
-};
+Eina_List *_country_list = NULL;
-static void *_create(void (*event_cb)(enum event_type type, void *data),
- void *cb_data)
-{
- struct _priv *priv = NULL;
-
- priv = calloc(1, sizeof(*priv));
- if (!priv) {
- _ERR("Calloc failed.");
- return NULL;
- }
-
- if (event_cb)
- priv->event_cb = event_cb;
-
- if (cb_data)
- priv->cb_data = cb_data;
-
- return priv;
-}
-
-static void _free_country_list(Eina_List *list)
+void data_location_free_list_data()
{
struct country_info_s *country_info = NULL;
- EINA_LIST_FREE(list, country_info) {
+ EINA_LIST_FREE(_country_list, country_info) {
if (!country_info)
continue;
free(country_info->long_name);
free(country_info);
- country_info = NULL;
- }
-}
-
-static bool _destroy(void *dclass_data)
-{
- struct _priv *priv = dclass_data;
-
- if (!priv) {
- _ERR("Invalid argument.");
- return false;
- }
-
- _free_country_list(priv->list);
- priv->list = NULL;
-
- free(priv);
-
- return true;
-}
-
-static bool _select(void *dclass_data, Elm_Object_Item *it, void *data)
-{
- struct _priv *priv = dclass_data;
-
- if (!priv || !it) {
- _ERR("Invalid argument.");
- return false;
}
-
- if (priv->event_cb)
- priv->event_cb(EVENT_DATA_SELECT_DONE, priv->cb_data);
-
- return true;
-}
-
-static Eina_List *_get_data(void *dclass_data)
-{
- struct _priv *priv = dclass_data;
-
- if (!priv) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- return priv->list;
-}
-
-static struct data_class _dclass = {
- .create = _create,
- .destroy = _destroy,
- .select = _select,
- .get_data = _get_data,
-};
-
-struct data_class *get_location_data_class(void)
-{
- return &_dclass;
+ _country_list = NULL;
}
void data_location_set_new_system_location(Elm_Object_Item *selected_item)
void data_location_fill_list_data(struct listmgr *list_mgr, Elm_Object_Item **get_country, const char *lang)
{
- Eina_List *list = NULL;
struct country_info_s *country_info = NULL;
struct country_info_s *select_first = NULL;
char *current_country = NULL;
}
current_country = _get_current_country();
+ if (_country_list)
+ data_location_free_list_data();
+
while (*code_tab) {
fake_code[1] = (*code_tab)[0];
fake_code[2] = (*code_tab)[1];
if (current_country && (*code_tab)[0] == current_country[0] && (*code_tab)[1] == current_country[1]) {
select_first = country_info;
}
- list = eina_list_append(list, country_info);
+ _country_list = eina_list_append(_country_list, country_info);
++code_tab;
}
free(current_country);
- if (!listmgr_fill_grid(list_mgr, LOCATION_LIST_ID, list, select_first, get_country)) {
+ if (!listmgr_fill_grid(list_mgr, LOCATION_LIST_ID, _country_list, select_first, get_country)) {
_ERR("Fill location list failed.");
}
listmgr_set_list_next_focus(list_mgr, LOCATION_LIST_ID,
#include "define.h"
#include "layout.h"
#include "layout/system.h"
-#include "common/datamgr.h"
#include "common/inputmgr.h"
#include "common/layoutmgr.h"
#include "common/listmgr.h"
Evas_Object *_btn2;
struct listmgr *list_mgr;
- struct datamgr *data_mgr;
Elm_Object_Item *selected_country_item;
Elm_Object_Item *configured_country;
char *language;
.key_down = _btn_key_down_cb
};
-static void _data_event_cb(enum event_type type, void *data)
-{
- SETTING_TRACE_BEGIN;
-
- struct _priv *priv = data;
-
- if (!priv) {
- _ERR("Invalid argument.");
- return;
- }
-
- if (type == EVENT_DATA_SELECT_DONE) {
- if (!listmgr_update_grid(priv->list_mgr, LOCATION_LIST_ID))
- _ERR("Listmgr update list failed.");
- } else {
- _ERR("Unhandled data event type.");
- return;
- }
-}
-
static void _country_selected_cb(Elm_Object_Item *it, void *data)
{
SETTING_TRACE_BEGIN;
priv->selected_country_item = it;
- if (!datamgr_select(priv->data_mgr, it, NULL)) {
- _ERR("Unavailable status for selecting country.");
- return;
- }
+ if (!listmgr_update_grid(priv->list_mgr, LOCATION_LIST_ID))
+ _ERR("Listmgr update list failed.");
}
static void _show_country_list(struct _priv *priv)
{
- SETTING_TRACE_BEGIN;
char *lang = NULL;
if (!priv->list_mgr) {
return NULL;
}
- priv->data_mgr = datamgr_create(get_location_data_class(), _data_event_cb, priv);
- if (!priv->data_mgr) {
- _ERR("Create datamgr failed.");
- evas_object_del(priv->base);
- free(priv);
- return NULL;
- }
-
priv->list_mgr = listmgr_create(priv->base);
if (!priv->list_mgr) {
_ERR("Create listmgr failed.");
- datamgr_destroy(priv->data_mgr);
evas_object_del(priv->base);
free(priv);
return NULL;
_country_selected_cb, priv)) {
_ERR("Add location list failed.");
listmgr_destroy(priv->list_mgr);
- datamgr_destroy(priv->data_mgr);
evas_object_del(priv->base);
free(priv);
return NULL;
if (!viewmgr_set_view_data(VIEW_LOCATION, priv)) {
_ERR("Set view data failed.");
listmgr_destroy(priv->list_mgr);
- datamgr_destroy(priv->data_mgr);
evas_object_del(priv->base);
free(priv);
return NULL;
}
- data_location_fill_list_data(priv->list_mgr, &priv->configured_country, NULL);
+// data_location_fill_list_data(priv->list_mgr, &priv->configured_country, NULL);
_draw_menu_area(priv);
return;
}
- datamgr_destroy(priv->data_mgr);
+ data_location_free_list_data();
listmgr_destroy(priv->list_mgr);
layoutmgr_destroy(priv->ly_mgr);