forked from enlightenment/enlightenment
e/bluez4: module inactive when bluez is down
Patch by: Lucas Joia <lucasjoia@profusion.mobi> SVN revision: 82189
This commit is contained in:
parent
cef9137bc2
commit
e51a6ea6d5
|
@ -102,6 +102,7 @@ _ebluez4_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||||
|
|
||||||
if (!(inst = data)) return;
|
if (!(inst = data)) return;
|
||||||
if (ev->button != 1) return;
|
if (ev->button != 1) return;
|
||||||
|
if (!ctxt->adap_obj) return;
|
||||||
|
|
||||||
if (!inst->popup)
|
if (!inst->popup)
|
||||||
_ebluez4_popup_new(inst);
|
_ebluez4_popup_new(inst);
|
||||||
|
@ -111,21 +112,32 @@ _ebluez4_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||||
e_gadcon_popup_show(inst->popup);
|
e_gadcon_popup_show(inst->popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ebluez4_set_mod_icon(Evas_Object *base)
|
||||||
|
{
|
||||||
|
char edj_path[4096];
|
||||||
|
char *group;
|
||||||
|
|
||||||
|
snprintf(edj_path, sizeof(edj_path), "%s/e-module-bluez4.edj", mod->dir);
|
||||||
|
if (ctxt->adap_obj)
|
||||||
|
group = "modules/bluez4/main";
|
||||||
|
else
|
||||||
|
group = "modules/bluez4/inactive";
|
||||||
|
|
||||||
|
if (!e_theme_edje_object_set(base, "base/theme/modules/bluez4", group))
|
||||||
|
edje_object_file_set(base, edj_path, group);
|
||||||
|
}
|
||||||
|
|
||||||
/* Gadcon */
|
/* Gadcon */
|
||||||
static E_Gadcon_Client *
|
static E_Gadcon_Client *
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
{
|
{
|
||||||
Instance *inst = NULL;
|
Instance *inst = NULL;
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-bluez4.edj", mod->dir);
|
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
inst = E_NEW(Instance, 1);
|
||||||
|
|
||||||
inst->o_bluez4 = edje_object_add(gc->evas);
|
inst->o_bluez4 = edje_object_add(gc->evas);
|
||||||
if (!e_theme_edje_object_set(inst->o_bluez4, "base/theme/modules/bluez4",
|
_ebluez4_set_mod_icon(inst->o_bluez4);
|
||||||
"modules/bluez4/main"))
|
|
||||||
edje_object_file_set(inst->o_bluez4, buf, "modules/bluez4/main");
|
|
||||||
|
|
||||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_bluez4);
|
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_bluez4);
|
||||||
inst->gcc->data = inst;
|
inst->gcc->data = inst;
|
||||||
|
@ -276,3 +288,20 @@ ebluez4_update_instances(Eina_List *src)
|
||||||
if (inst->found_list)
|
if (inst->found_list)
|
||||||
ebluez4_update_inst(inst->found_list, src);
|
ebluez4_update_inst(inst->found_list, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ebluez4_update_all_gadgets_visibility()
|
||||||
|
{
|
||||||
|
Eina_List *iter;
|
||||||
|
Instance *inst;
|
||||||
|
|
||||||
|
if (ctxt->adap_obj)
|
||||||
|
EINA_LIST_FOREACH(instances, iter, inst)
|
||||||
|
_ebluez4_set_mod_icon(inst->o_bluez4);
|
||||||
|
else
|
||||||
|
EINA_LIST_FOREACH(instances, iter, inst)
|
||||||
|
{
|
||||||
|
_ebluez4_set_mod_icon(inst->o_bluez4);
|
||||||
|
e_gadcon_popup_hide(inst->popup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -20,5 +20,6 @@ void ebluez4_disabled_set_all_search_buttons(Eina_Bool disabled);
|
||||||
void ebluez4_append_to_instances(const char *addr, const char *name);
|
void ebluez4_append_to_instances(const char *addr, const char *name);
|
||||||
void ebluez4_update_inst(Evas_Object *dest, Eina_List *src);
|
void ebluez4_update_inst(Evas_Object *dest, Eina_List *src);
|
||||||
void ebluez4_update_instances(Eina_List *src);
|
void ebluez4_update_instances(Eina_List *src);
|
||||||
|
void ebluez4_update_all_gadgets_visibility();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
#include "ebluez4.h"
|
#include "ebluez4.h"
|
||||||
|
|
||||||
/* Global Module Context */
|
|
||||||
Context *ctxt;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_addr_cmp(const void *d1, const void *d2)
|
_addr_cmp(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
|
@ -52,6 +49,7 @@ _unset_adapter()
|
||||||
ctxt->adap_obj = NULL;
|
ctxt->adap_obj = NULL;
|
||||||
ebluez4_disabled_set_all_search_buttons(EINA_TRUE);
|
ebluez4_disabled_set_all_search_buttons(EINA_TRUE);
|
||||||
ebluez4_update_instances(ctxt->devices);
|
ebluez4_update_instances(ctxt->devices);
|
||||||
|
ebluez4_update_all_gadgets_visibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -261,6 +259,7 @@ _set_adapter(const EDBus_Message *msg)
|
||||||
edbus_proxy_call(ctxt->adap_proxy, "ListDevices", _on_list, NULL, -1, "");
|
edbus_proxy_call(ctxt->adap_proxy, "ListDevices", _on_list, NULL, -1, "");
|
||||||
edbus_proxy_call(ctxt->adap_proxy, "RegisterAgent", NULL, NULL, -1, "os",
|
edbus_proxy_call(ctxt->adap_proxy, "RegisterAgent", NULL, NULL, -1, "os",
|
||||||
REMOTE_AGENT_PATH, "KeyboardDisplay");
|
REMOTE_AGENT_PATH, "KeyboardDisplay");
|
||||||
|
ebluez4_update_all_gadgets_visibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -28,6 +28,8 @@ typedef struct _Context
|
||||||
Eina_List *devices;
|
Eina_List *devices;
|
||||||
} Context;
|
} Context;
|
||||||
|
|
||||||
|
Context *ctxt;
|
||||||
|
|
||||||
void ebluez4_edbus_init();
|
void ebluez4_edbus_init();
|
||||||
void ebluez4_edbus_shutdown();
|
void ebluez4_edbus_shutdown();
|
||||||
void ebluez4_start_discovery();
|
void ebluez4_start_discovery();
|
||||||
|
|
Loading…
Reference in New Issue