summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-02-25 18:23:49 +0100
committerFlavio Ceolin <flavio.ceolin@gmail.com>2015-03-07 18:51:03 -0300
commit494952e3f9ff511cf515bacb185c5c62f22d64e0 (patch)
tree50148350fc666ae55c51ec4e772292f6ae428fa6
parent86d1a3c3f56862c9b1d318ec45821a727a0a988d (diff)
gadget: ported ui to elm
After this commit you wont be able to build for current e19 anymore. Why porting the ui ? Basically the slider is very buggy for me, clicking a pixel outside of the middle of the circle and you mute it click to high and the click will be in the nothing. With that it should work better.
-rw-r--r--src/module/e_mod_main.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/module/e_mod_main.c b/src/module/e_mod_main.c
index 586dccf..3e475db 100644
--- a/src/module/e_mod_main.c
+++ b/src/module/e_mod_main.c
@@ -122,8 +122,8 @@ _notify(const int val)
122static void 122static void
123_mixer_popup_update(Instance *inst, int mute, int vol) 123_mixer_popup_update(Instance *inst, int mute, int vol)
124{ 124{
125 e_widget_check_checked_set(inst->check, mute); 125 elm_check_state_set(inst->check, !!mute);
126 e_slider_value_set(inst->slider, vol); 126 elm_slider_value_set(inst->slider, vol);
127} 127}
128 128
129static void _popup_del(Instance *inst); 129static void _popup_del(Instance *inst);
@@ -356,7 +356,7 @@ _slider_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
356 unsigned int i; 356 unsigned int i;
357 Emix_Sink *s = (Emix_Sink *)mixer_context->sink_default; 357 Emix_Sink *s = (Emix_Sink *)mixer_context->sink_default;
358 358
359 val = (int)e_slider_value_get(obj); 359 val = (int)elm_slider_value_get(obj);
360 v.volumes = calloc(s->volume.channel_count, sizeof(int)); 360 v.volumes = calloc(s->volume.channel_count, sizeof(int));
361 v.channel_count = s->volume.channel_count; 361 v.channel_count = s->volume.channel_count;
362 for (i = 0; i < s->volume.channel_count; i++) 362 for (i = 0; i < s->volume.channel_count; i++)
@@ -369,7 +369,10 @@ static Evas_Object *
369_popup_add_slider(Instance *inst) 369_popup_add_slider(Instance *inst)
370{ 370{
371 unsigned int volume, i; 371 unsigned int volume, i;
372 Evas_Object *slider = e_slider_add(inst->evas); 372
373 Evas_Object *slider = elm_slider_add(e_comp->elm);
374 evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, EVAS_HINT_FILL);
375 evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0);
373 376
374 for (volume = 0, i = 0; i < 377 for (volume = 0, i = 0; i <
375 mixer_context->sink_default->volume.channel_count; i++) 378 mixer_context->sink_default->volume.channel_count; i++)
@@ -378,13 +381,11 @@ _popup_add_slider(Instance *inst)
378 volume = volume / i; 381 volume = volume / i;
379 382
380 evas_object_show(slider); 383 evas_object_show(slider);
381 e_slider_orientation_set(slider, 1); 384 elm_slider_min_max_set(slider, 0.0, (double) EMIX_VOLUME_MAX);
382 e_slider_value_range_set(slider, 0.0, (double) EMIX_VOLUME_MAX);
383 e_slider_value_format_display_set(slider, NULL);
384 evas_object_smart_callback_add(slider, "changed", _slider_changed_cb, 385 evas_object_smart_callback_add(slider, "changed", _slider_changed_cb,
385 NULL); 386 NULL);
386 387
387 e_slider_value_set(slider, volume); 388 elm_slider_value_set(slider, volume);
388 return slider; 389 return slider;
389} 390}
390 391
@@ -401,51 +402,53 @@ static void
401_popup_new(Instance *inst) 402_popup_new(Instance *inst)
402{ 403{
403 Evas_Object *button, *list; 404 Evas_Object *button, *list;
404 Evas *evas;
405 Evas_Coord mw, mh;
406 Emix_Sink *s; 405 Emix_Sink *s;
407 Eina_List *l; 406 Eina_List *l;
408 int pos = 0;
409 407
410 EINA_SAFETY_ON_NULL_RETURN(mixer_context->sink_default); 408 EINA_SAFETY_ON_NULL_RETURN(mixer_context->sink_default);
411 409
412 inst->popup = e_gadcon_popup_new(inst->gcc, 0); 410 inst->popup = e_gadcon_popup_new(inst->gcc, 0);
413 evas = inst->evas;
414 411
415 list = e_widget_list_add(evas, 0, 0); 412 list = elm_box_add(e_comp->elm);
416 413
417 inst->list = e_widget_ilist_add(evas, 24, 24, NULL); 414 inst->list = elm_list_add(e_comp->elm);
418 e_widget_size_min_set(inst->list, 120, 100); 415 evas_object_size_hint_align_set(inst->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
419 e_widget_list_object_append(list, inst->list, 1, 1, 0.5); 416 evas_object_size_hint_weight_set(inst->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
417 evas_object_show(inst->list);
420 418
421 EINA_LIST_FOREACH((Eina_List *)emix_sinks_get(), l, s) 419 EINA_LIST_FOREACH((Eina_List *)emix_sinks_get(), l, s)
422 { 420 {
423 e_widget_ilist_append_full(inst->list, NULL, NULL, s->name, 421 Elm_Object_Item *it;
424 _sink_selected_cb,
425 s, NULL);
426 if (mixer_context->sink_default == s)
427 e_widget_ilist_selected_set(inst->list, pos);
428 422
429 pos++; 423 it = elm_list_item_append(inst->list, s->name, NULL, NULL, _sink_selected_cb, s);
424 if (mixer_context->sink_default == s)
425 elm_list_item_selected_set(it, EINA_TRUE);
430 } 426 }
427 elm_box_pack_end(list, inst->list);
431 428
432 inst->slider = _popup_add_slider(inst); 429 inst->slider = _popup_add_slider(inst);
433 e_widget_list_object_append(list, inst->slider, 1, 1, 0.5); 430 elm_box_pack_end(list, inst->slider);
431 evas_object_show(inst->slider);
434 432
435 inst->mute = (int) mixer_context->sink_default->mute; 433 inst->mute = (int) mixer_context->sink_default->mute;
436 inst->check = e_widget_check_add(evas, _("Mute"), 434
437 &inst->mute); 435 inst->check = elm_check_add(e_comp->elm);
438 e_widget_list_object_append(list, inst->check, 1, 9, 0.5); 436 elm_object_text_set(inst->check, _("Mute"));
437 elm_check_state_pointer_set(inst->check, &(inst->mute));
439 evas_object_smart_callback_add(inst->check, "changed", _check_changed_cb, 438 evas_object_smart_callback_add(inst->check, "changed", _check_changed_cb,
440 NULL); 439 NULL);
440 elm_box_pack_end(list, inst->check);
441 evas_object_show(inst->check);
442
443 button = elm_button_add(e_comp->elm);
444 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
445 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0.0);
446 evas_object_smart_callback_add(button, "clicked", _emixer_exec_cb, inst);
447 elm_box_pack_end(list, button);
448 evas_object_show(button);
441 449
442 button = e_widget_button_add(evas, NULL, "preferences-system", 450 evas_object_size_hint_min_set(list, 208, 208);
443 _emixer_exec_cb, inst, NULL);
444 e_widget_list_object_append(list, button, 1, 0, 0.5);
445 451
446 e_widget_size_min_get(list, &mw, &mh);
447 if (mh < 208) mh = 208;
448 e_widget_size_min_set(list, 208, mh);
449 452
450 e_gadcon_popup_content_set(inst->popup, list); 453 e_gadcon_popup_content_set(inst->popup, list);
451 e_comp_object_util_autoclose(inst->popup->comp_object, 454 e_comp_object_util_autoclose(inst->popup->comp_object,