work on some todo items i left for xkbswitch.

gagdte looks nicer now
flags aspect ratio is correct now based on each flag
name of kbd layout only appears on mouseover
fixed buffer overflow possibility in execution.



SVN revision: 70534
devs/princeamd/enlightenment-0.17-elive
Carsten Haitzler 11 years ago
parent caaf8c6ea0
commit c90e3c1517
  1. BIN
      data/flags/ad_flag.png
  2. BIN
      data/flags/af_flag.png
  3. BIN
      data/flags/al_flag.png
  4. BIN
      data/flags/am_flag.png
  5. BIN
      data/flags/ara_flag.png
  6. BIN
      data/flags/at_flag.png
  7. BIN
      data/flags/az_flag.png
  8. BIN
      data/flags/ba_flag.png
  9. BIN
      data/flags/bd_flag.png
  10. BIN
      data/flags/be_flag.png
  11. BIN
      data/flags/bg_flag.png
  12. BIN
      data/flags/br_flag.png
  13. BIN
      data/flags/brai_flag.png
  14. BIN
      data/flags/bt_flag.png
  15. BIN
      data/flags/bw_flag.png
  16. BIN
      data/flags/by_flag.png
  17. BIN
      data/flags/ca_flag.png
  18. BIN
      data/flags/cd_flag.png
  19. BIN
      data/flags/ch_flag.png
  20. BIN
      data/flags/cn_flag.png
  21. BIN
      data/flags/cz_flag.png
  22. BIN
      data/flags/de_flag.png
  23. BIN
      data/flags/dk_flag.png
  24. BIN
      data/flags/ee_flag.png
  25. BIN
      data/flags/epo_flag.png
  26. BIN
      data/flags/es_flag.png
  27. BIN
      data/flags/et_flag.png
  28. BIN
      data/flags/fi_flag.png
  29. BIN
      data/flags/fo_flag.png
  30. BIN
      data/flags/fr_flag.png
  31. BIN
      data/flags/gb_flag.png
  32. BIN
      data/flags/ge_flag.png
  33. BIN
      data/flags/gh_flag.png
  34. BIN
      data/flags/gn_flag.png
  35. BIN
      data/flags/gr_flag.png
  36. BIN
      data/flags/hr_flag.png
  37. BIN
      data/flags/hu_flag.png
  38. BIN
      data/flags/ie_flag.png
  39. BIN
      data/flags/il_flag.png
  40. BIN
      data/flags/in_flag.png
  41. BIN
      data/flags/iq_flag.png
  42. BIN
      data/flags/ir_flag.png
  43. BIN
      data/flags/is_flag.png
  44. BIN
      data/flags/it_flag.png
  45. BIN
      data/flags/jp_flag.png
  46. BIN
      data/flags/ke_flag.png
  47. BIN
      data/flags/kg_flag.png
  48. BIN
      data/flags/kh_flag.png
  49. BIN
      data/flags/kr_flag.png
  50. BIN
      data/flags/kz_flag.png
  51. BIN
      data/flags/la_flag.png
  52. BIN
      data/flags/latam_flag.png
  53. BIN
      data/flags/lk_flag.png
  54. BIN
      data/flags/lt_flag.png
  55. BIN
      data/flags/lv_flag.png
  56. BIN
      data/flags/ma_flag.png
  57. BIN
      data/flags/mao_flag.png
  58. BIN
      data/flags/me_flag.png
  59. BIN
      data/flags/mk_flag.png
  60. BIN
      data/flags/ml_flag.png
  61. BIN
      data/flags/mm_flag.png
  62. BIN
      data/flags/mn_flag.png
  63. BIN
      data/flags/mt_flag.png
  64. BIN
      data/flags/mv_flag.png
  65. BIN
      data/flags/ng_flag.png
  66. BIN
      data/flags/nl_flag.png
  67. BIN
      data/flags/no_flag.png
  68. BIN
      data/flags/np_flag.png
  69. BIN
      data/flags/ph_flag.png
  70. BIN
      data/flags/pk_flag.png
  71. BIN
      data/flags/pl_flag.png
  72. BIN
      data/flags/pt_flag.png
  73. BIN
      data/flags/ro_flag.png
  74. BIN
      data/flags/rs_flag.png
  75. BIN
      data/flags/ru_flag.png
  76. BIN
      data/flags/se_flag.png
  77. BIN
      data/flags/si_flag.png
  78. BIN
      data/flags/sk_flag.png
  79. BIN
      data/flags/sn_flag.png
  80. BIN
      data/flags/sy_flag.png
  81. BIN
      data/flags/th_flag.png
  82. BIN
      data/flags/tj_flag.png
  83. BIN
      data/flags/tm_flag.png
  84. BIN
      data/flags/tr_flag.png
  85. BIN
      data/flags/tw_flag.png
  86. BIN
      data/flags/tz_flag.png
  87. BIN
      data/flags/ua_flag.png
  88. BIN
      data/flags/unknown_flag.png
  89. BIN
      data/flags/us_flag.png
  90. BIN
      data/flags/uz_flag.png
  91. BIN
      data/flags/vn_flag.png
  92. BIN
      data/flags/za_flag.png
  93. 240
      data/themes/default.edc
  94. 3
      data/themes/images/Makefile.am
  95. BIN
      data/themes/images/xkbshad.png
  96. 61
      src/modules/xkbswitch/e_mod_config.c
  97. 114
      src/modules/xkbswitch/e_mod_main.c
  98. 4
      src/modules/xkbswitch/e_mod_main.h

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 B

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 471 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -41315,138 +41315,116 @@ collections {
}
}
group
{
name: "modules/xkbswitch/main";
max: 148 128;
parts
{
part
{
name: "flag";
type: SWALLOW;
mouse_events: 0;
description
{
state: "default" 0.0;
align: 0.5 0.5;
}
}
part
{
name: "event";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 0;
}
}
part
{
name: "label";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
description
{
state: "default" 0.0;
align: 0.5 0.5;
rel1
{
relative: 0.5 0.5;
offset: 0 0;
}
rel2
{
relative: 0.5 0.5;
offset: 0 0;
}
color: 255 255 255 255;
color3: 0 0 0 128;
text
{
text: "";
font: "Sans";
size: 9;
align: 0.5 0.5;
min: 1 1;
text_class: "module_small";
}
}
}
}
}
group
{
name: "modules/xkbswitch/noflag";
max: 148 128;
parts
{
part
{
name: "event";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 0;
}
/////////////////////////////////////////////////////////////////////////////
/*** MOD: XKBSWITCH ***/
group { name: "modules/xkbswitch/main";
images {
image: "xkbshad.png" COMP;
}
max: 128 128;
parts {
part { name: "shadow";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "e.swallow.flag";
rel1.offset: -2 -1;
rel2.to: "e.swallow.flag";
rel2.offset: 1 2;
image {
normal: "xkbshad.png";
border: 5 5 5 5;
}
}
}
part { name: "e.swallow.flag";
type: SWALLOW;
mouse_events: 0;
description { state: "default" 0.0;
rel1.offset: 2 3;
rel2.offset: -3 -4;
}
}
part { name: "e.text.label"; type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
description { state: "default" 0.0;
rel1 {
to: "e.swallow.flag";
relative: 0.0 0.5;
}
rel2 {
to: "e.swallow.flag";
relative: 1.0 0.5;
}
color: 255 255 255 0;
color3: 0 0 0 0;
text {
font: "Sans";
size: 9;
min: 0 1;
text_class: "module_small";
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
color3: 0 0 0 24;
}
}
part { name: "event"; type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program { name: "fade1";
signal: "mouse,in";
source: "event";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 1.0;
target: "e.text.label";
}
program { name: "fade2";
signal: "mouse,out";
source: "event";
action: STATE_SET "default" 0.0;
transition: DECELERATE 1.0;
target: "e.text.label";
}
}
}
part
{
name: "label";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
description
{
state: "default" 0.0;
align: 0.5 0.5;
rel1
{
relative: 0.5 0.5;
offset: 0 0;
}
rel2
{
relative: 0.5 0.5;
offset: 0 0;
}
color: 255 255 255 255;
color3: 0 0 0 128;
text
{
text: "";
font: "Sans";
size: 9;
align: 0.5 0.5;
min: 1 1;
text_class: "module_small";
}
}
group { name: "modules/xkbswitch/noflag";
max: 128 128;
parts {
part { name: "e.text.label"; type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
description { state: "default" 0.0;
rel1 {
relative: 0.0 0.5;
}
rel2 {
relative: 1.0 0.5;
}
color: 255 255 255 255;
color3: 0 0 0 24;
text {
font: "Sans";
size: 9;
min: 0 1;
text_class: "module_small";
}
}
}
}
}
part { name: "event"; type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
}
}
}

@ -446,4 +446,5 @@ batt_over.png \
batt_power.png \
bg_shadow.png \
bg_over.png \
bg_base.png
bg_base.png \
xkbshad.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

@ -521,22 +521,13 @@ _dlg_add_cb_ok(void *data __UNUSED__, E_Dialog *dlg)
{
Evas_Object *ic = e_icon_add(cfdata->evas);
{
const char *name = cl->name;
if (strchr(name, '/')) name = strchr(name, '/') + 1;
snprintf(buf, sizeof(buf), "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name);
if (!ecore_file_exists(buf))
snprintf(buf, sizeof(buf), "%s/data/flags/unknown_flag.png",
e_prefix_data_get());
e_icon_file_set(ic, buf);
}
snprintf(buf, sizeof(buf), "%s (%s, %s)", cl->name, cl->model, cl->variant);
const char *name = cl->name;
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf, _cb_used_select, cfdata, NULL);
e_xkb_e_icon_flag_setup(ic, name);
snprintf(buf, sizeof(buf), "%s (%s, %s)",
cl->name, cl->model, cl->variant);
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf,
_cb_used_select, cfdata, NULL);
}
e_widget_ilist_go (cfdata->used_list);
@ -585,21 +576,13 @@ _cb_dlg_fill_delay(void *data)
EINA_LIST_FOREACH(layouts, l, layout)
{
Evas_Object *ic = e_icon_add(cfdata->dlg_evas);
{
const char *name = layout->name;
if (strchr(name, '/')) name = strchr(name, '/') + 1;
snprintf(buf, sizeof(buf), "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name);
if (!ecore_file_exists(buf))
snprintf(buf, sizeof(buf), "%s/data/flags/unknown_flag.png",
e_prefix_data_get());
e_icon_file_set(ic, buf);
}
snprintf(buf, sizeof(buf), "%s (%s)", layout->description, layout->name);
const char *name = layout->name;
e_widget_ilist_append_full(cfdata->layout_list, ic, NULL, buf, _cb_layout_select, cfdata, layout->name);
e_xkb_e_icon_flag_setup(ic, name);
snprintf(buf, sizeof(buf), "%s (%s)",
layout->description, layout->name);
e_widget_ilist_append_full(cfdata->layout_list, ic, NULL, buf,
_cb_layout_select, cfdata, layout->name);
}
e_widget_ilist_go (cfdata->layout_list);
@ -700,17 +683,12 @@ _cb_fill_delay(void *data)
{
Evas_Object *ic = e_icon_add(cfdata->evas);
const char *name = cl->name;
if (strchr(name, '/')) name = strchr(name, '/') + 1;
snprintf(buf, sizeof(buf), "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name);
if (!ecore_file_exists(buf))
snprintf(buf, sizeof(buf), "%s/flags/unknown_flag.png",
e_prefix_data_get());
e_icon_file_set(ic, buf);
snprintf(buf, sizeof(buf), "%s (%s, %s)", cl->name, cl->model, cl->variant);
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf, _cb_used_select, cfdata, NULL);
e_xkb_e_icon_flag_setup(ic, name);
snprintf(buf, sizeof(buf), "%s (%s, %s)",
cl->name, cl->model, cl->variant);
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf,
_cb_used_select, cfdata, NULL);
}
e_widget_ilist_go(cfdata->used_list);
@ -723,7 +701,8 @@ _cb_fill_delay(void *data)
EINA_LIST_FOREACH(models, l, model)
{
snprintf(buf, sizeof(buf), "%s (%s)", model->description, model->name);
e_widget_ilist_append(cfdata->dmodel_list, NULL, buf, NULL, cfdata, model->name);
e_widget_ilist_append(cfdata->dmodel_list, NULL, buf, NULL,
cfdata, model->name);
if (model->name == e_xkb_cfg->default_model)
e_widget_ilist_selected_set(cfdata->dmodel_list, n);
n++;

@ -284,28 +284,20 @@ e_xkb_update_icon(void)
e_theme_edje_object_set(inst->o_xkbswitch,
"base/theme/modules/xkbswitch",
"modules/xkbswitch/noflag");
edje_object_part_text_set(inst->o_xkbswitch, "label", name);
edje_object_part_text_set(inst->o_xkbswitch, "e.text.label", name);
}
}
else
{
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name);
EINA_LIST_FOREACH(instances, l, inst)
{
if (!inst->o_xkbflag)
{
inst->o_xkbflag = e_icon_add(inst->gcc->gadcon->evas);
e_icon_file_set(inst->o_xkbflag, buf);
edje_object_part_swallow(inst->o_xkbswitch, "flag",
inst->o_xkbflag);
}
else
e_icon_file_set(inst->o_xkbflag, buf);
edje_object_part_text_set(inst->o_xkbswitch, "label", name);
inst->o_xkbflag = e_icon_add(inst->gcc->gadcon->evas);
e_xkb_e_icon_flag_setup(inst->o_xkbflag, name);
edje_object_part_swallow(inst->o_xkbswitch, "e.swallow.flag",
inst->o_xkbflag);
edje_object_part_text_set(inst->o_xkbswitch, "e.text.label",
e_xkb_layout_name_reduce(name));
}
}
}
@ -316,7 +308,7 @@ e_xkb_update_layout(void)
E_XKB_Config_Layout *cl;
E_XKB_Config_Option *op;
Eina_List *l;
char buf[PATH_MAX];
Eina_Strbuf *buf;
if (!e_xkb_cfg->used_layouts) return;
@ -324,41 +316,45 @@ e_xkb_update_layout(void)
* set options.
*/
// XXX: this is unsafe. doesn't keep into account size of buf
snprintf(buf, sizeof(buf), "setxkbmap ");
buf = eina_strbuf_new();
eina_strbuf_append(buf, "setxkbmap '");
EINA_LIST_FOREACH(e_xkb_cfg->used_layouts, l, cl)
{
strcat(buf, cl->name);
eina_strbuf_append(buf, cl->name);
break;
if (l->next) strcat(buf, ",");
//if (l->next) eina_strbuf_append(buf, ",");
}
strcat(buf, " -variant ");
eina_strbuf_append(buf, "'");
eina_strbuf_append(buf, " -variant '");
EINA_LIST_FOREACH(e_xkb_cfg->used_layouts, l, cl)
{
strcat(buf, cl->variant);
strcat(buf, ",");
eina_strbuf_append(buf, cl->variant);
eina_strbuf_append(buf, ",");
break;
}
eina_strbuf_append(buf, "'");
strcat(buf, " -model ");
eina_strbuf_append(buf, " -model '");
cl = eina_list_data_get(e_xkb_cfg->used_layouts);
if (strcmp(cl->model, "default"))
strcat(buf, cl->model);
eina_strbuf_append(buf, cl->model);
else if (strcmp(e_xkb_cfg->default_model, "default"))
strcat(buf, e_xkb_cfg->default_model);
eina_strbuf_append(buf, e_xkb_cfg->default_model);
else
strcat(buf, "default");
eina_strbuf_append(buf, "default");
eina_strbuf_append(buf, "'");
EINA_LIST_FOREACH(e_xkb_cfg->used_options, l, op)
{
strcat(buf, " -option ");
strcat(buf, op->name);
eina_strbuf_append(buf, " -option '");
eina_strbuf_append(buf, op->name);
eina_strbuf_append(buf, "'");
break;
}
printf("RUN: '%s'\n", buf);
ecore_exe_run(buf, NULL);
printf("RUN: '%s'\n", eina_strbuf_string_get(buf));
ecore_exe_run(eina_strbuf_string_get(buf), NULL);
eina_strbuf_free(buf);
}
void
@ -399,6 +395,36 @@ e_xkb_layout_prev(void)
e_xkb_update_layout();
}
const char *
e_xkb_layout_name_reduce(const char *name)
{
if ((name) && (strchr(name, '/'))) name = strchr(name, '/') + 1;
return name;
}
void
e_xkb_e_icon_flag_setup(Evas_Object *eicon, const char *name)
{
int w, h;
char buf[PATH_MAX];
e_xkb_flag_file_get(buf, sizeof(buf), name);
e_icon_file_set(eicon, buf);
e_icon_size_get(eicon, &w, &h);
edje_extern_object_aspect_set(eicon, EDJE_ASPECT_CONTROL_BOTH, w, h);
}
void
e_xkb_flag_file_get(char *buf, size_t bufsize, const char *name)
{
name = e_xkb_layout_name_reduce(name);
snprintf(buf, bufsize, "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name ? name : "unknown");
if (!ecore_file_exists(buf))
snprintf(buf, bufsize, "%s/data/flags/unknown_flag.png",
e_prefix_data_get());
}
/* LOCAL STATIC FUNCTIONS */
static E_Gadcon_Client *
@ -407,23 +433,19 @@ _gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
Instance *inst;
const char *name;
char buf[PATH_MAX];
if (e_xkb_cfg->used_layouts)
name = ((E_XKB_Config_Layout*)eina_list_data_get(e_xkb_cfg->used_layouts))->name;
else name = NULL;
if ((name) && (strchr(name, '/'))) name = strchr(name, '/') + 1;
/* The instance */
inst = E_NEW(Instance, 1);
/* The gadget */
inst->o_xkbswitch = edje_object_add(gc->evas);
//XXX add to theme
e_theme_edje_object_set(inst->o_xkbswitch,
"base/theme/modules/xkbswitch",
"modules/xkbswitch/main");
if (name) edje_object_part_text_set(inst->o_xkbswitch, "label", name);
edje_object_part_text_set(inst->o_xkbswitch, "e.text.label",
e_xkb_layout_name_reduce(name));
/* The gadcon client */
inst->gcc = e_gadcon_client_new(gc, gcname, id, style, inst->o_xkbswitch);
inst->gcc->data = inst;
@ -431,11 +453,10 @@ _gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
if (!e_xkb_cfg->only_label)
{
inst->o_xkbflag = e_icon_add(gc->evas);
snprintf(buf, sizeof(buf), "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name ? name : "unknown");
e_icon_file_set(inst->o_xkbflag, buf);
e_xkb_e_icon_flag_setup(inst->o_xkbflag, name);
/* The icon is part of the gadget. */
edje_object_part_swallow(inst->o_xkbswitch, "flag", inst->o_xkbflag);
edje_object_part_swallow(inst->o_xkbswitch, "e.swallow.flag",
inst->o_xkbflag);
}
else inst->o_xkbflag = NULL;
@ -648,12 +669,7 @@ _e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
e_menu_item_radio_group_set(mi, 1);
e_menu_item_toggle_set(mi,
(l == e_xkb_cfg->used_layouts) ? 1 : 0);
if (strchr(name, '/')) name = strchr(name, '/') + 1;
snprintf(buf, sizeof(buf), "%s/data/flags/%s_flag.png",
e_prefix_data_get(), name);
if (!ecore_file_exists(buf))
snprintf(buf, sizeof(buf), "%s/data/flags/unknown_flag.png",
e_prefix_data_get());
e_xkb_flag_file_get(buf, sizeof(buf), name);
e_menu_item_icon_file_set(mi, buf);
snprintf(buf, sizeof(buf), "%s (%s, %s)", cl->name,
cl->model, cl->variant);

@ -90,6 +90,10 @@ void e_xkb_update_layout(void);
void e_xkb_layout_next(void);
void e_xkb_layout_prev(void);
const char *e_xkb_layout_name_reduce(const char *name);
void e_xkb_e_icon_flag_setup(Evas_Object *eicon, const char *name);
void e_xkb_flag_file_get(char *buf, size_t bufsize, const char *name);
E_Config_Dialog *e_xkb_cfg_dialog(E_Container *con, const char *params);
extern E_XKB_Config *e_xkb_cfg;

Loading…
Cancel
Save