return;
}
+ if (!inst->adapter)
+ {
+ _bluez_operation_error_show(_("No bluetooth adapter."));
+ return;
+ }
+
if (!e_bluez_adapter_powered_get(inst->adapter, &powered))
{
- _bluez_operation_error_show
- (_("Query adapter's powered."));
+ _bluez_operation_error_show(_("Query adapter's powered."));
return;
}
_bluez_cb_toggle_powered(E_Object *obj __UNUSED__, const char *params __UNUSED__)
{
E_Bluez_Module_Context *ctxt;
+ const Eina_List *l;
+ E_Bluez_Instance *inst;
if (!bluez_mod)
return;
ctxt = bluez_mod->data;
- if (ctxt->default_instance)
- _bluez_toggle_powered(ctxt->default_instance);
+ EINA_LIST_FOREACH(ctxt->instances, l, inst)
+ if (inst->adapter) _bluez_toggle_powered(inst);
}
static void _bluez_popup_del(E_Bluez_Instance *inst);
return;
}
+ if (!inst->adapter)
+ {
+ _bluez_operation_error_show(_("No bluetooth adapter."));
+ return;
+ }
+
if (!e_bluez_adapter_powered_set
(inst->adapter, powered, _bluez_toggle_powered_cb, inst))
{
E_Bluez_Instance *inst = data;
int ret;
- if (inst->discovering)
+ if (!inst->adapter)
+ ret = 0;
+ else if (inst->discovering)
ret = e_bluez_adapter_stop_discovery
(inst->adapter, _bluez_discovery_cb, inst);
else
_bluez_popup_del(inst);
if (inst->conf_dialog)
return;
+ if (!inst->adapter)
+ return;
inst->conf_dialog = e_bluez_config_dialog_new(NULL, inst);
}
return;
}
+ if (!inst->adapter)
+ {
+ _bluez_operation_error_show(_("No bluetooth adapter."));
+ return;
+ }
+
if (!e_bluez_adapter_discovering_get(inst->adapter, &b))
{
_bluez_operation_error_show(_("Can't get Discovering property"));
_bluez_popup_del(inst);
if (inst->conf_dialog)
return;
+ if (!inst->adapter)
+ return;
inst->conf_dialog = e_bluez_config_dialog_new(NULL, inst);
}
E_Bluez_Module_Context *ctxt = inst->ctxt;
const char *name;
- if (!ctxt->has_manager)
+ if ((!ctxt->has_manager) || (!inst->adapter))
{
edje_object_part_text_set(o, "e.text.powered", "");
edje_object_part_text_set(o, "e.text.status", "");
edje_object_signal_emit(o, "e,changed,off", "e");
- edje_object_part_text_set(o, "e.text.name", _("No Bluetooth daemon"));
+ if (!ctxt->has_manager)
+ edje_object_part_text_set(o, "e.text.name", _("No Bluetooth daemon"));
+ else
+ edje_object_part_text_set(o, "e.text.name",
+ _("No Bluetooth adapter"));
edje_object_signal_emit(o, "e,changed,name", "e");
return;
}
else
{
edje_object_signal_emit(o, "e,changed,off", "e");
- edje_object_part_text_set(o, "e.text.status",
- _("Bluetooth is off."));
+ edje_object_part_text_set(o, "e.text.status", _("Bluetooth is off."));
}
}
{
E_Bluez_Module_Context *ctxt = inst->ctxt;
- if (!ctxt->has_manager && inst->popup)
+ if (inst->popup && ((!ctxt->has_manager) || (!inst->adapter)))
_bluez_popup_del(inst);
if (inst->popup)
// TODO: instead of getting the default adapter, get the adapter for
// each instance. See the mixer module.
- inst->adapter = e_bluez_adapter_get(ctxt->default_adapter);
+ if (ctxt->default_adapter)
+ inst->adapter = e_bluez_adapter_get(ctxt->default_adapter);
+ else
+ inst->adapter = NULL;
+
if (inst->adapter)
{
Eina_Bool powered, discoverable, discovering;
inst->discovering = discovering;
}
- if (!ctxt->default_instance)
- ctxt->default_instance = inst;
-
_bluez_gadget_update(inst);
ctxt->instances = eina_list_append(ctxt->instances, inst);
ctxt->instances = eina_list_remove(ctxt->instances, inst);
- if (ctxt->default_instance == inst)
- ctxt->default_instance = NULL;
-
E_FREE(inst);
}