Migrate technologies to use Technology interface

Instead of parse 2 vectors of Enabled and Disabled technologies, use the
technology interface with its 'state' field. It's much easier to extend
this design than the other, also allowing the UI to be easily updated
upon devices (dis)appearing.

This breaks compatibility with connman version < 0.49.

By: Lucas De Marchi <lucas.demarchi@profusion.mobi>



SVN revision: 46881
This commit is contained in:
Gustavo Sverzut Barbieri 2010-03-04 21:58:23 +00:00
parent fb001180e0
commit efa3ed8435
4 changed files with 203 additions and 166 deletions

View File

@ -35,6 +35,7 @@ struct _E_Config_Dialog_Data
Evas_Object *ilist, *button; Evas_Object *ilist, *button;
Evas_Object *renable, *rdisable; Evas_Object *renable, *rdisable;
Evas_Object *c1, *c2, *c3; Evas_Object *c1, *c2, *c3;
Eina_List *disable_list;
} gui; } gui;
}; };
@ -42,7 +43,7 @@ struct _E_Config_Dialog_Data
* *
* These can/should be changed to "official" key/names * These can/should be changed to "official" key/names
*/ */
const CFColor_Hash _wm_hash[] = static const CFColor_Hash _wm_hash[] =
{ {
{NULL, N_("Window Manager")}, {NULL, N_("Window Manager")},
{"about_title", N_("About Dialog Title")}, {"about_title", N_("About Dialog Title")},
@ -62,7 +63,7 @@ const CFColor_Hash _wm_hash[] =
{NULL, NULL} {NULL, NULL}
}; };
const CFColor_Hash _wid_hash[] = static const CFColor_Hash _wid_hash[] =
{ {
{NULL, N_("Widgets")}, {NULL, N_("Widgets")},
{"button_text", N_("Button Text")}, {"button_text", N_("Button Text")},
@ -81,14 +82,16 @@ const CFColor_Hash _wid_hash[] =
{NULL, NULL} {NULL, NULL}
}; };
const CFColor_Hash _mod_hash[] = xxx todo fix this crap design xxxx
static const CFColor_Hash _mod_hash[] =
{ {
{NULL, N_("Modules")}, {NULL, N_("Modules")},
{"module_label", N_("Module Label")}, {"module_label", N_("Module Label")},
{NULL, NULL} {NULL, NULL}
}; };
Eina_List *color_classes; static Eina_List *color_classes;
static void *_create_data (E_Config_Dialog *cfd); static void *_create_data (E_Config_Dialog *cfd);
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
@ -102,7 +105,6 @@ static void _fill_data_list (E_Config_Dialog_Data *cfdata);
static void _fill_data_basic (E_Config_Dialog_Data *cfdata); static void _fill_data_basic (E_Config_Dialog_Data *cfdata);
static void _load_color_classes (Evas_Object *obj, E_Config_Dialog_Data *cfdata); static void _load_color_classes (Evas_Object *obj, E_Config_Dialog_Data *cfdata);
static void _radio_cb_change (void *data, Evas_Object *obj, void *event_info);
static void _list_cb_change (void *data, Evas_Object *obj); static void _list_cb_change (void *data, Evas_Object *obj);
static void _update_colors (E_Config_Dialog_Data *cfdata, CFColor_Class *cc); static void _update_colors (E_Config_Dialog_Data *cfdata, CFColor_Class *cc);
static void _color1_cb_change (void *data, Evas_Object *obj); static void _color1_cb_change (void *data, Evas_Object *obj);
@ -378,6 +380,7 @@ _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
cfdata->classes = eina_list_remove_list(cfdata->classes, cfdata->classes); cfdata->classes = eina_list_remove_list(cfdata->classes, cfdata->classes);
} }
eina_list_free(cfdata->gui.disable_list);
E_FREE(cfdata->color1); E_FREE(cfdata->color1);
E_FREE(cfdata->color2); E_FREE(cfdata->color2);
E_FREE(cfdata->color3); E_FREE(cfdata->color3);
@ -493,73 +496,87 @@ _adv_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
static Evas_Object * static Evas_Object *
_adv_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) _adv_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{ {
Evas_Object *o, *of, *ob, *ot; Evas_Object *o, *ob, *ot;
E_Radio_Group *rg; Evas_Coord mw, mh;
char buf[1024];
o = e_widget_list_add(evas, 0, 1);
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("Color Classes"), 0);
e_widget_framelist_content_align_set(of, 0.0, 0.0);
ob = e_widget_ilist_add(evas, 16, 16, NULL); ob = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_ilist_selector_set(ob, 1); e_widget_ilist_selector_set(ob, 1);
cfdata->gui.ilist = ob; cfdata->gui.ilist = ob;
e_widget_on_change_hook_set(ob, _list_cb_change, cfdata); e_widget_on_change_hook_set(ob, _list_cb_change, cfdata);
_load_color_classes(ob, cfdata); _load_color_classes(ob, cfdata);
e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, ob, 1, 1, 0.5);
e_widget_list_object_append(o, of, 1, 1, 0.5);
/* Pack the right side frames into a table for resizing*/ snprintf(buf, sizeof(buf), _("Color settings: %s"), "");
ot = e_widget_table_add(evas, 0); ot = e_widget_frametable_add(evas, buf, 0);
of = e_widget_framelist_add(evas, _("State"), 0); cfdata->state = 0;
e_widget_framelist_content_align_set(of, 0.0, 0.0); ob = e_widget_check_add(evas, _("Custom colors"), &(cfdata->state));
rg = e_widget_radio_group_new(&(cfdata->state));
ob = e_widget_radio_add(evas, _("Enabled"), 1, rg);
cfdata->gui.renable = ob; cfdata->gui.renable = ob;
e_widget_disabled_set(ob, 1); e_widget_on_change_hook_set(ob, _custom_color_cb_change, cfdata);
evas_object_smart_callback_add(ob, "changed", _radio_cb_change, cfdata); e_widget_size_min_get(ob, &mw, &mh);
e_widget_framelist_object_append(of, ob); e_widget_frametable_object_append_full
ob = e_widget_radio_add(evas, _("Disabled"), 0, rg); (ot, ob, 0, 0, 2, 1, 1, 0, 1, 0, 0.0, 0.0, mw, mh, 9999, 9999);
cfdata->gui.rdisable = ob;
e_widget_disabled_set(ob, 1); ob = e_widget_label_add(evas, _("Object:"));
evas_object_smart_callback_add(ob, "changed", _radio_cb_change, cfdata); cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob); e_widget_size_min_get(ob, &mw, &mh);
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 0, 1, 0); e_widget_frametable_object_append_full
(ot, ob, 0, 1, 1, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
of = e_widget_framelist_add(evas, _("Object Color"), 0);
e_widget_framelist_content_align_set(of, 0.0, 0.0);
ob = e_widget_color_well_add(evas, cfdata->color1, 1); ob = e_widget_color_well_add(evas, cfdata->color1, 1);
cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
cfdata->gui.c1 = ob; cfdata->gui.c1 = ob;
e_widget_on_change_hook_set(ob, _color1_cb_change, cfdata); e_widget_on_change_hook_set(ob, _color1_cb_change, cfdata);
e_widget_disabled_set(ob, 1); e_widget_size_min_get(ob, &mw, &mh);
e_widget_framelist_object_append(of, ob); if (mw < 16 * e_scale) mw = 16 * e_scale;
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 1, 1); if (mh < 16 * e_scale) mh = 16 * e_scale;
e_widget_frametable_object_append_full
(ot, ob, 0, 1, 1, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
ob = e_widget_label_add(evas, _("Outline:"));
cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_size_min_get(ob, &mw, &mh);
e_widget_frametable_object_append_full
(ot, ob, 0, 2, 1, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
of = e_widget_framelist_add(evas, _("Outline Color"), 0);
e_widget_framelist_content_align_set(of, 0.0, 0.0);
ob = e_widget_color_well_add(evas, cfdata->color2, 1); ob = e_widget_color_well_add(evas, cfdata->color2, 1);
cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
cfdata->gui.c2 = ob; cfdata->gui.c2 = ob;
e_widget_on_change_hook_set(ob, _color2_cb_change, cfdata); e_widget_on_change_hook_set(ob, _color2_cb_change, cfdata);
e_widget_disabled_set(ob, 1); e_widget_size_min_get(ob, &mw, &mh);
e_widget_framelist_object_append(of, ob); if (mw < 16 * e_scale) mw = 16 * e_scale;
e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 1, 1, 1); if (mh < 16 * e_scale) mh = 16 * e_scale;
e_widget_frametable_object_append_full
(ot, ob, 0, 2, 1, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
ob = e_widget_label_add(evas, _("Shadow:"));
cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_size_min_get(ob, &mw, &mh);
e_widget_frametable_object_append_full
(ot, ob, 0, 3, 1, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
of = e_widget_framelist_add(evas, _("Shadow Color"), 0);
e_widget_framelist_content_align_set(of, 0.0, 0.0);
ob = e_widget_color_well_add(evas, cfdata->color3, 1); ob = e_widget_color_well_add(evas, cfdata->color3, 1);
cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
cfdata->gui.c3 = ob; cfdata->gui.c3 = ob;
e_widget_on_change_hook_set(ob, _color3_cb_change, cfdata); e_widget_on_change_hook_set(ob, _color3_cb_change, cfdata);
e_widget_disabled_set(ob, 1); e_widget_size_min_get(ob, &mw, &mh);
e_widget_framelist_object_append(of, ob); if (mw < 16 * e_scale) mw = 16 * e_scale;
e_widget_table_object_append(ot, of, 0, 3, 1, 1, 1, 1, 1, 1); if (mh < 16 * e_scale) mh = 16 * e_scale;
e_widget_frametable_object_append_full
(ot, ob, 0, 3, 1, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
ob = e_widget_button_add(evas, _("Defaults"), NULL, ob = e_widget_button_add
_button_cb, cfdata, NULL); (evas, _("Defaults"), NULL, _button_cb, cfdata, NULL);
cfdata->gui.disable_list = eina_list_append(cfdata->disable_list, ob);
cfdata->gui.button = ob; cfdata->gui.button = ob;
e_widget_disabled_set(ob, 1); e_widget_frametable_object_append_full
e_widget_table_object_append(ot, ob, 0, 4, 1, 1, 0, 0, 0, 0); (ot, ob, 0, 4, 2, 1, 0, 0, 0, 0, 1.0, 0.0, mw, mh, 9999, 9999);
e_widget_list_object_append(o, ot, 1, 1, 0.5); _custom_color_cb_change(cfdata, NULL);
e_dialog_resizable_set(cfd->dia, 1); e_dialog_resizable_set(cfd->dia, 1);
return o; return o;
} }

View File

@ -2,12 +2,17 @@
extern const char _e_connman_Name[]; extern const char _e_connman_Name[];
extern const char *e_str_enabled;
extern const char *e_str_available;
extern const char *e_str_connected;
extern const char *e_str_offline;
struct connman_config_technologies struct connman_config_technologies
{ {
EINA_INLIST; EINA_INLIST;
Evas_Object *obj; Evas_Object *obj;
E_Connman_Technology *technology; E_Connman_Technology *technology;
int val; int enabled;
}; };
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
@ -125,7 +130,7 @@ _connman_service_move(E_Connman_Service *service, const E_Connman_Service *servi
struct _connman_technology_onoff_data struct _connman_technology_onoff_data
{ {
const char *name; const char *type;
E_Connman_Module_Context *ctxt; E_Connman_Module_Context *ctxt;
bool on; bool on;
}; };
@ -140,25 +145,14 @@ _connman_technology_onoff_cb(void *data, DBusMessage *msg __UNUSED__, DBusError
dbus_error_free(error); dbus_error_free(error);
} }
else else
{ DBG("Technology %s has been %s.", d->type, d->on?"enabled":"disabled");
/* TODO: update config dialog */
E_Connman_Technology *t;
t = _connman_technology_find(d->ctxt, d->name);
if (t)
{
t->enabled = d->on;
DBG("Technology %s has been %s.", d->name, d->on?"enabled":"disabled");
}
else
WRN("Technology does not exist anymore: %s.", d->name);
}
eina_stringshare_del(d->name); eina_stringshare_del(d->type);
E_FREE(d); E_FREE(d);
} }
static void static void
_connman_technology_onoff(E_Connman_Module_Context *ctxt, const char *technology, bool on) _connman_technology_onoff(E_Connman_Module_Context *ctxt, const char *type, bool on)
{ {
int ret; int ret;
struct _connman_technology_onoff_data *d; struct _connman_technology_onoff_data *d;
@ -170,23 +164,23 @@ _connman_technology_onoff(E_Connman_Module_Context *ctxt, const char *technology
return; return;
} }
d->name = eina_stringshare_add(technology); d->type = eina_stringshare_add(type);
d->ctxt = ctxt; d->ctxt = ctxt;
d->on = on; d->on = on;
if(on) if(on)
ret = e_connman_manager_technology_enable(technology, _connman_technology_onoff_cb, d); ret = e_connman_manager_technology_enable(type, _connman_technology_onoff_cb, d);
else else
ret = e_connman_manager_technology_disable(technology, _connman_technology_onoff_cb, d); ret = e_connman_manager_technology_disable(type, _connman_technology_onoff_cb, d);
if(!ret) if(!ret)
{ {
eina_stringshare_del(d->name); eina_stringshare_del(type);
E_FREE(d); E_FREE(d);
} }
return; return;
} }
E_Config_Dialog * E_Config_Dialog *
e_connman_config_dialog_new(E_Container *con, E_Connman_Module_Context *ctxt) e_connman_config_dialog_new(E_Container *con, E_Connman_Module_Context *ctxt)
@ -542,8 +536,8 @@ _switches_page_create_technologies(Evas *evas, E_Connman_Module_Context *ctxt, s
{ {
struct connman_config_technologies *t_list = E_NEW(struct connman_config_technologies, 1); struct connman_config_technologies *t_list = E_NEW(struct connman_config_technologies, 1);
t_list->technology = t; t_list->technology = t;
t_list->val = t->enabled; t_list->enabled = ((t->state == e_str_enabled) || (t->state == e_str_connected));
t_list->obj = e_widget_check_add(evas, _(t->name), &t_list->val); t_list->obj = e_widget_check_add(evas, _(t->name), &t_list->enabled);
ui->technologies = eina_inlist_append(ui->technologies, EINA_INLIST_GET(t_list)); ui->technologies = eina_inlist_append(ui->technologies, EINA_INLIST_GET(t_list));
e_widget_framelist_object_append(ui->type_frame, t_list->obj); e_widget_framelist_object_append(ui->type_frame, t_list->obj);
@ -599,8 +593,9 @@ _basic_apply(E_Config_Dialog *dialog __UNUSED__, E_Config_Dialog_Data *cfdata)
EINA_INLIST_FOREACH(sw->technologies, t) EINA_INLIST_FOREACH(sw->technologies, t)
{ {
if (t->val != t->technology->enabled) int was_enabled = ((t->technology->state == e_str_enabled) || (t->technology->state == e_str_connected));
_connman_technology_onoff(ctxt, t->technology->name, t->val); if (t->enabled != was_enabled)
_connman_technology_onoff(ctxt, t->technology->type, t->enabled);
} }
if (ctxt->offline_mode != sw->offline_mode) if (ctxt->offline_mode != sw->offline_mode)
_connman_toggle_offline_mode(ctxt); _connman_toggle_offline_mode(ctxt);

View File

@ -45,14 +45,10 @@ static const char *e_str_online = NULL;
static const char *e_str_disconnect = NULL; static const char *e_str_disconnect = NULL;
static const char *e_str_failure = NULL; static const char *e_str_failure = NULL;
static struct _Connman_Technologies_Names const char *e_str_enabled = NULL;
{ const char *e_str_available = NULL;
const char **names; const char *e_str_connected = NULL;
unsigned int count; const char *e_str_offline = NULL;
} _connman_enabled_technologies = {
NULL,
0
};
static void _connman_service_ask_pass_and_connect(E_Connman_Service *service); static void _connman_service_ask_pass_and_connect(E_Connman_Service *service);
static void _connman_default_service_changed_delayed(E_Connman_Module_Context *ctxt); static void _connman_default_service_changed_delayed(E_Connman_Module_Context *ctxt);
@ -449,6 +445,76 @@ _connman_service_new(E_Connman_Module_Context *ctxt, E_Connman_Element *element)
return service; return service;
} }
#define GSTR(name_, getter) \
str = NULL; \
if (!getter(element, &str)) \
str = NULL; \
eina_stringshare_replace(&t->name_, str)
static void
_connman_technology_free(E_Connman_Technology *t)
{
eina_stringshare_del(t->path);
eina_stringshare_del(t->name);
eina_stringshare_del(t->type);
eina_stringshare_del(t->state);
E_FREE(t);
}
static void
_connman_technology_changed(void *data, const E_Connman_Element *element)
{
E_Connman_Technology *t = data;
const char *str;
GSTR(name, e_connman_technology_name_get);
GSTR(type, e_connman_technology_type_get);
GSTR(state, e_connman_technology_state_get);
}
static void
_connman_technology_freed(void *data)
{
E_Connman_Technology *t = data;
E_Connman_Module_Context *ctxt = t->ctxt;
ctxt->technologies = eina_inlist_remove
(ctxt->technologies, EINA_INLIST_GET(t));
_connman_technology_free(t);
}
static E_Connman_Technology *
_connman_technology_new(E_Connman_Module_Context *ctxt, E_Connman_Element *element)
{
E_Connman_Technology *t;
const char *str;
if (!element)
return NULL;
t = E_NEW(E_Connman_Technology, 1);
if (!t)
return NULL;
t->ctxt = ctxt;
t->element = element;
t->path = eina_stringshare_add(element->path);
GSTR(name, e_connman_technology_name_get);
GSTR(type, e_connman_technology_type_get);
GSTR(state, e_connman_technology_state_get);
e_connman_element_listener_add
(element, _connman_technology_changed, t,
_connman_technology_freed);
return t;
}
#undef GSTR
static void static void
_connman_service_disconnect_cb(void *data, DBusMessage *msg __UNUSED__, DBusError *error) _connman_service_disconnect_cb(void *data, DBusMessage *msg __UNUSED__, DBusError *error)
{ {
@ -634,20 +700,6 @@ _connman_services_free(E_Connman_Module_Context *ctxt)
} }
} }
E_Connman_Technology *
_connman_technology_find(E_Connman_Module_Context *ctxt, const char* name)
{
E_Connman_Technology *t;
EINA_INLIST_FOREACH(ctxt->technologies, t)
{
if (!strcmp(t->name, name))
return t;
}
return NULL;
}
static inline Eina_Bool static inline Eina_Bool
_connman_services_element_exists(const E_Connman_Module_Context *ctxt, const E_Connman_Element *element) _connman_services_element_exists(const E_Connman_Module_Context *ctxt, const E_Connman_Element *element)
{ {
@ -661,70 +713,19 @@ _connman_services_element_exists(const E_Connman_Module_Context *ctxt, const E_C
} }
static inline Eina_Bool static inline Eina_Bool
_connman_technology_exists(const E_Connman_Module_Context *ctxt, const char* name) _connman_technologies_element_exists(const E_Connman_Module_Context *ctxt, const E_Connman_Element *element)
{ {
const E_Connman_Technology *t; const E_Connman_Technology *t;
EINA_INLIST_FOREACH(ctxt->technologies, t) EINA_INLIST_FOREACH(ctxt->technologies, t)
{ {
if (t->name == name) if (t->path == element->path)
return EINA_TRUE; return EINA_TRUE;
} }
return EINA_FALSE; return EINA_FALSE;
} }
static inline int
_connman_technologies_enabled_update()
{
int ret;
if (_connman_enabled_technologies.names)
free(_connman_enabled_technologies.names);
ret = e_connman_manager_technologies_enabled_get
(&_connman_enabled_technologies.count, &_connman_enabled_technologies.names);
if (!ret)
{
WRN("Failed to query enabled technologies.");
return 0;
}
return 1;
}
static inline int
_connman_technology_enabled(const char *type)
{
unsigned int i;
if (!_connman_enabled_technologies.names && !_connman_technologies_enabled_update())
return 0;
DBG("%d technologies enabled.", _connman_enabled_technologies.count);
for (i = 0; i < _connman_enabled_technologies.count; i++)
{
if(!strcmp(type, _connman_enabled_technologies.names[i]))
{
DBG("Technology %s is enabled.", type);
return 1;
}
}
DBG("Technology %s is disabled.", type);
return 0;
}
static void
_connman_technologies_free(E_Connman_Module_Context *ctxt)
{
while (ctxt->technologies)
{
E_Connman_Technology *t = (E_Connman_Technology *) ctxt->technologies;
eina_stringshare_del(t->name);
ctxt->technologies = eina_inlist_remove(ctxt->technologies, EINA_INLIST_GET(t));
E_FREE(t);
}
if (_connman_enabled_technologies.names)
free(_connman_enabled_technologies.names);
}
void void
_connman_request_scan_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__, DBusError *error) _connman_request_scan_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__, DBusError *error)
{ {
@ -740,34 +741,34 @@ _connman_request_scan_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__, DBu
static void static void
_connman_technologies_load(E_Connman_Module_Context *ctxt) _connman_technologies_load(E_Connman_Module_Context *ctxt)
{ {
const char **names;
unsigned int count, i; unsigned int count, i;
E_Connman_Element **elements;
if (!e_connman_manager_technologies_available_get(&count, &names)) if (!e_connman_manager_technologies_get(&count, &elements))
return; return;
DBG("Available Technologies = %d.", count); DBG("Technologies = %d.", count);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
const char *name = eina_stringshare_add(names[i]); E_Connman_Element *e = elements[i];
E_Connman_Technology *t; E_Connman_Technology *t;
if ((name == NULL) || _connman_technology_exists(ctxt, name)) if ((!e) || _connman_technologies_element_exists(ctxt, e))
{ continue;
eina_stringshare_del(name);
continue; t = _connman_technology_new(ctxt, e);
} if (!t)
t = E_NEW(E_Connman_Technology, 1); continue;
t->name = name;
t->enabled = _connman_technology_enabled(name);
ctxt->technologies = eina_inlist_append(ctxt->technologies, EINA_INLIST_GET(t));
DBG("Added technology: %s.", t->name); DBG("Added technology: %s.", t->name);
ctxt->technologies = eina_inlist_append
(ctxt->technologies, EINA_INLIST_GET(t));
} }
if (!e_connman_manager_request_scan("", _connman_request_scan_cb, NULL)) if (!e_connman_manager_request_scan("", _connman_request_scan_cb, NULL))
ERR("Request scan on all technologies failed."); ERR("Request scan on all technologies failed.");
free(names);
free(elements);
} }
static void static void
@ -1777,6 +1778,10 @@ _connman_status_stringshare_init(void)
e_str_online = eina_stringshare_add(N_("online")); e_str_online = eina_stringshare_add(N_("online"));
e_str_disconnect = eina_stringshare_add(N_("disconnect")); e_str_disconnect = eina_stringshare_add(N_("disconnect"));
e_str_failure = eina_stringshare_add(N_("failure")); e_str_failure = eina_stringshare_add(N_("failure"));
e_str_enabled = eina_stringshare_add(N_("enabled"));
e_str_available = eina_stringshare_add(N_("available"));
e_str_connected = eina_stringshare_add(N_("connected"));
e_str_offline = eina_stringshare_add(N_("offline"));
} }
static inline void static inline void
@ -1790,6 +1795,10 @@ _connman_status_stringshare_del(void)
eina_stringshare_replace(&e_str_online, NULL); eina_stringshare_replace(&e_str_online, NULL);
eina_stringshare_replace(&e_str_disconnect, NULL); eina_stringshare_replace(&e_str_disconnect, NULL);
eina_stringshare_replace(&e_str_failure, NULL); eina_stringshare_replace(&e_str_failure, NULL);
eina_stringshare_replace(&e_str_enabled, NULL);
eina_stringshare_replace(&e_str_available, NULL);
eina_stringshare_replace(&e_str_connected, NULL);
eina_stringshare_replace(&e_str_offline, NULL);
} }
EAPI void * EAPI void *

View File

@ -76,8 +76,12 @@ struct E_Connman_Service
struct E_Connman_Technology struct E_Connman_Technology
{ {
EINA_INLIST; EINA_INLIST;
E_Connman_Module_Context *ctxt;
E_Connman_Element *element;
const char *path;
const char *name; const char *name;
bool enabled; const char *type;
const char *state;
}; };
struct E_Connman_Module_Context struct E_Connman_Module_Context
@ -120,7 +124,6 @@ EAPI int e_modapi_save (E_Module *m);
const char *e_connman_theme_path(void); const char *e_connman_theme_path(void);
E_Config_Dialog *e_connman_config_dialog_new(E_Container *con, E_Connman_Module_Context *ctxt); E_Config_Dialog *e_connman_config_dialog_new(E_Container *con, E_Connman_Module_Context *ctxt);
void _connman_toggle_offline_mode(E_Connman_Module_Context *ctxt); void _connman_toggle_offline_mode(E_Connman_Module_Context *ctxt);
E_Connman_Technology *_connman_technology_find(E_Connman_Module_Context *ctxt, const char* name);
Evas_Object *_connman_service_new_list_item(Evas *evas, E_Connman_Service *service); Evas_Object *_connman_service_new_list_item(Evas *evas, E_Connman_Service *service);
static inline void static inline void
@ -162,4 +165,17 @@ _connman_ctxt_find_service_stringshare(const E_Connman_Module_Context *ctxt, con
return NULL; return NULL;
} }
static inline E_Connman_Technology *
_connman_ctxt_technology_find_stringshare(const E_Connman_Module_Context *ctxt, const char *path)
{
E_Connman_Technology *t;
EINA_INLIST_FOREACH(ctxt->technologies, t)
if (t->path == path)
return t;
return NULL;
}
#endif #endif