Mixer Gadget: Use demo gadget in places where demo gadgets are used.

This commit is contained in:
Stephen 'Okra' Houston 2017-08-22 11:54:52 -05:00
parent 062664d839
commit 0332eca3c7
3 changed files with 29 additions and 18 deletions

View File

@ -284,7 +284,8 @@ backlight_gadget_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orien
evas_object_smart_callback_add(parent, "gadget_created", _backlight_gadget_created_cb, inst);
evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, backlight_del, inst);
ginstances = eina_list_append(ginstances, inst);
if (*id != -1)
ginstances = eina_list_append(ginstances, inst);
return inst->o_main;
}

View File

@ -39,6 +39,7 @@ struct _Context
typedef struct _Instance Instance;
struct _Instance
{
int id;
Evas_Object *o_main;
Evas_Object *o_mixer;
Evas_Object *popup;
@ -626,8 +627,22 @@ _mixer_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNU
_mixer_resize_cb, inst);
elm_box_pack_end(inst->o_main, inst->o_mixer);
evas_object_show(inst->o_mixer);
gmixer_context->instances = eina_list_append(gmixer_context->instances, inst);
_mixer_gadget_update();
if (inst->id != -1)
gmixer_context->instances = eina_list_append(gmixer_context->instances, inst);
if (inst->id == -1)
{
Edje_Message_Int_Set *msg;
msg = alloca(sizeof(Edje_Message_Int_Set) + (2 * sizeof(int)));
msg->count = 3;
msg->val[0] = EINA_FALSE;
msg->val[1] = 60;
msg->val[2] = 60;
edje_object_message_send(elm_layout_edje_get(inst->o_mixer), EDJE_MESSAGE_INT_SET, 0, msg);
elm_layout_signal_emit(inst->o_mixer, "e,action,volume,change", "e");
}
else
_mixer_gadget_update();
}
evas_object_smart_callback_del_full(obj, "gadget_created", _mixer_gadget_created_cb, data);
}
@ -642,13 +657,21 @@ mixer_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
}
EINTERN Evas_Object *
mixer_gadget_create(Evas_Object *parent, int *id EINA_UNUSED, E_Gadget_Site_Orient orient)
mixer_gadget_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient)
{
Instance *inst;
if (*id != -1)
{
EINA_SAFETY_ON_FALSE_RETURN_VAL(emix_init(), NULL);
if (!mixer_init())
return NULL;
}
inst = E_NEW(Instance, 1);
inst->o_main = elm_box_add(parent);
inst->orient = orient;
inst->id = *id;
E_EXPAND(inst->o_main);
E_FILL(inst->o_main);
evas_object_show(inst->o_main);

View File

@ -5,23 +5,11 @@ EINTERN int _e_gemix_log_domain;
EINTERN void *
e_modapi_gadget_init(E_Module *m)
{
Eina_Bool loaded = EINA_FALSE;
_e_gemix_log_domain = eina_log_domain_register("mixer_gadget", EINA_COLOR_RED);
EINA_SAFETY_ON_FALSE_RETURN_VAL(emix_init(), NULL);
loaded = mixer_init();
if (!loaded)
goto err;
e_gadget_type_add("Mixer", mixer_gadget_create, NULL);
return m;
err:
// emix_config_shutdown();
emix_shutdown();
return NULL;
}
EINTERN int
@ -31,9 +19,8 @@ e_modapi_gadget_shutdown(E_Module *m EINA_UNUSED)
e_gadget_type_del("Mixer");
emix_shutdown();
// emix_config_shutdown();
return 1;
}