history chart of cpu usage. the module config file should be deleted.
SVN revision: 31514
This commit is contained in:
parent
da8eb387f0
commit
96a9bc2ccf
|
@ -13,6 +13,7 @@ cpu.edj
|
|||
EXTRA_DIST = $(files_DATA) \
|
||||
cpu.edc \
|
||||
VeraMono.ttf \
|
||||
VeraBd.ttf \
|
||||
cpu.png \
|
||||
e_modules-cpu.spec
|
||||
|
||||
|
@ -28,7 +29,8 @@ INCLUDES = -I. \
|
|||
pkgdir = $(datadir)/$(MODULE_ARCH)
|
||||
pkg_LTLIBRARIES = module.la
|
||||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h
|
||||
e_mod_main.h \
|
||||
e_mod_config.c
|
||||
|
||||
module_la_LIBADD = @e_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
|
|
Binary file not shown.
805
cpu.edc
805
cpu.edc
|
@ -6,6 +6,7 @@ images
|
|||
fonts
|
||||
{
|
||||
font: "VeraMono.ttf" "VeraMono";
|
||||
font: "VeraBd.ttf" "VeraBold";
|
||||
}
|
||||
|
||||
styles
|
||||
|
@ -17,74 +18,738 @@ styles
|
|||
}
|
||||
}
|
||||
|
||||
collections
|
||||
{
|
||||
group
|
||||
{
|
||||
name: "modules/cpu/main";
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "fade_clip";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "cpu";
|
||||
clip_to: "fade_clip";
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
align: 0.5 0.5;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
image
|
||||
{
|
||||
normal: "cpu.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "load";
|
||||
type: TEXTBLOCK;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
clip_to: "fade_clip";
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
to: "cpu";
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
to: "cpu";
|
||||
}
|
||||
text {
|
||||
style: "cpu_style";
|
||||
min: 0 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
collections {
|
||||
group {
|
||||
name: "modules/cpu/main";
|
||||
parts {
|
||||
part {
|
||||
name: "fade_clip";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "cpu";
|
||||
clip_to: "fade_clip";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
align: 0.5 0.5;
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel2.relative: 1.0 1.0;
|
||||
image.normal: "cpu.png";
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "load";
|
||||
type: TEXTBLOCK;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
clip_to: "fade_clip";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
to: "cpu";
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
to: "cpu";
|
||||
}
|
||||
text {
|
||||
style: "cpu_style";
|
||||
min: 0 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group {
|
||||
name: "modules/cpu/popup";
|
||||
data {
|
||||
item: "chart_color1" "0 59 179 170";
|
||||
item: "chart_color2" "4 179 0 170";
|
||||
item: "chart_color3" "180 0 0 170";
|
||||
item: "chart_color4" "179 55 0 170";
|
||||
}
|
||||
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 100 100;
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
min: 200 100;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
min: 150 100;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
min: 150 150;
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "chart1";
|
||||
type: SWALLOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.04 0.04;
|
||||
offset: 0 0;
|
||||
}
|
||||
rel2 {
|
||||
relative: 0.96 0.96;
|
||||
offset: -1 -1;
|
||||
}
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.04;
|
||||
rel2.relative: 0.48 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.04;
|
||||
rel2.relative: 0.6 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.04;
|
||||
rel2.relative: 0.48 0.48;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "chart2";
|
||||
type: SWALLOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.04;
|
||||
rel2.relative: 0.96 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.62 0.04;
|
||||
rel2.relative: 0.96 0.48;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.04;
|
||||
rel2.relative: 0.96 0.48;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "chart3";
|
||||
type: SWALLOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.62 0.52;
|
||||
rel2.relative: 0.96 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.04 0.52;
|
||||
rel2.relative: 0.48 0.96;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "chart4";
|
||||
type: SWALLOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.52;
|
||||
rel2.relative: 0.96 0.96;
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "num1";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel1.relative: 0.5 0.5;
|
||||
rel2.relative: 0.5 0.5;
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 42;
|
||||
text {
|
||||
text: "1";
|
||||
min: 1 1;
|
||||
size: 30;
|
||||
font: "VeraBold";
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.25 0.5;
|
||||
rel2.relative: 0.25 0.5;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.33333 0.5;
|
||||
rel2.relative: 0.33333 0.5;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.25 0.25;
|
||||
rel2.relative: 0.25 0.25;
|
||||
text.size: 20;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "num2";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 42;
|
||||
text {
|
||||
text: "2";
|
||||
min: 1 1;
|
||||
size: 30;
|
||||
font: "VeraBold";
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.75 0.5;
|
||||
rel2.relative: 0.75 0.5;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.833333 0.25;
|
||||
rel2.relative: 0.833333 0.25;
|
||||
text.size: 20;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.75 0.25;
|
||||
rel2.relative: 0.75 0.25;
|
||||
text.size: 20;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "num3";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 42;
|
||||
visible: 0;
|
||||
text {
|
||||
text: "3";
|
||||
min: 1 1;
|
||||
size: 30;
|
||||
font: "VeraBold";
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.833333 0.75;
|
||||
rel2.relative: 0.833333 0.75;
|
||||
text.size: 20;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.25 0.75;
|
||||
rel2.relative: 0.25 0.75;
|
||||
text.size: 20;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "num4";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 42;
|
||||
visible: 0;
|
||||
text {
|
||||
text: "4";
|
||||
min: 1 1;
|
||||
size: 30;
|
||||
font: "VeraBold";
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.75 0.75;
|
||||
rel2.relative: 0.75 0.75;
|
||||
text.size: 20;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "y1";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 1 9999;
|
||||
fixed: 1 1;
|
||||
rel1 {
|
||||
relative: 0.04 0.04;
|
||||
offset: -1 -4;
|
||||
}
|
||||
rel2 {
|
||||
relative: 0.04 0.96;
|
||||
offset: -1 2;
|
||||
}
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.04;
|
||||
rel2.relative: 0.04 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.04;
|
||||
rel2.relative: 0.04 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.04;
|
||||
rel2.relative: 0.04 0.48;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "y2";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 1 9999;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
rel1.offset: -1 -4;
|
||||
rel2.offset: -1 2;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.04;
|
||||
rel2.relative: 0.52 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.62 0.04;
|
||||
rel2.relative: 0.62 0.48;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.04;
|
||||
rel2.relative: 0.52 0.48;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "y3";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 1 9999;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
rel1.offset: -1 -4;
|
||||
rel2.offset: -1 2;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.62 0.52;
|
||||
rel2.relative: 0.62 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.04 0.52;
|
||||
rel2.relative: 0.04 0.96;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "y4";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 1 9999;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
rel1.offset: -1 -4;
|
||||
rel2.offset: -1 2;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.52;
|
||||
rel2.relative: 0.52 0.96;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "x1";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 9999 1;
|
||||
fixed: 1 1;
|
||||
rel1 {
|
||||
relative: 0.04 0.96;
|
||||
offset: -4 0;
|
||||
}
|
||||
rel2 {
|
||||
relative: 0.96 0.96;
|
||||
offset: 2 0;
|
||||
}
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel2.relative: 0.48 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel2.relative: 0.6 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 0.04 0.48;
|
||||
rel2.relative: 0.48 0.48;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "x2";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 9999 1;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
rel1.offset: -4 0;
|
||||
rel2.offset: 2 0;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.96;
|
||||
rel2.relative: 0.96 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.62 0.48;
|
||||
rel2.relative: 0.96 0.48;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.48;
|
||||
rel2.relative: 0.96 0.48;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "x3";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 9999 1;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
rel1.offset: -4 0;
|
||||
rel2.offset: 2 0;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.62 0.96;
|
||||
rel2.relative: 0.96 0.96;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.04 0.96;
|
||||
rel2.relative: 0.48 0.96;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "x4";
|
||||
type: RECT;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 1 1;
|
||||
max: 9999 1;
|
||||
fixed: 1 1;
|
||||
visible: 0;
|
||||
rel1.offset: -4 0;
|
||||
rel2.offset: 2 0;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_2" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_3" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "cpu_count_4" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1.relative: 0.52 0.96;
|
||||
rel2.relative: 0.96 0.96;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program {
|
||||
name: "1_cpu";
|
||||
signal: "e,state,orientation,1";
|
||||
source: "e";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "bg";
|
||||
target: "chart1";
|
||||
target: "chart2";
|
||||
target: "chart3";
|
||||
target: "chart4";
|
||||
target: "num1";
|
||||
target: "num2";
|
||||
target: "num3";
|
||||
target: "num4";
|
||||
target: "x1";
|
||||
target: "x2";
|
||||
target: "x3";
|
||||
target: "x4";
|
||||
target: "y1";
|
||||
target: "y2";
|
||||
target: "y3";
|
||||
target: "y4";
|
||||
}
|
||||
program {
|
||||
name: "2_cpu";
|
||||
signal: "e,state,orientation,2";
|
||||
source: "e";
|
||||
action: STATE_SET "cpu_count_2" 0.0;
|
||||
target: "bg";
|
||||
target: "chart1";
|
||||
target: "chart2";
|
||||
target: "chart3";
|
||||
target: "chart4";
|
||||
target: "num1";
|
||||
target: "num2";
|
||||
target: "num3";
|
||||
target: "num4";
|
||||
target: "x1";
|
||||
target: "x2";
|
||||
target: "x3";
|
||||
target: "x4";
|
||||
target: "y1";
|
||||
target: "y2";
|
||||
target: "y3";
|
||||
target: "y4";
|
||||
}
|
||||
program {
|
||||
name: "3_cpu";
|
||||
signal: "e,state,orientation,3";
|
||||
source: "e";
|
||||
action: STATE_SET "cpu_count_3" 0.0;
|
||||
target: "bg";
|
||||
target: "chart1";
|
||||
target: "chart2";
|
||||
target: "chart3";
|
||||
target: "chart4";
|
||||
target: "num1";
|
||||
target: "num2";
|
||||
target: "num3";
|
||||
target: "num4";
|
||||
target: "x1";
|
||||
target: "x2";
|
||||
target: "x3";
|
||||
target: "x4";
|
||||
target: "y1";
|
||||
target: "y2";
|
||||
target: "y3";
|
||||
target: "y4";
|
||||
}
|
||||
program {
|
||||
name: "4_cpu";
|
||||
signal: "e,state,orientation,4";
|
||||
source: "e";
|
||||
action: STATE_SET "cpu_count_4" 0.0;
|
||||
target: "bg";
|
||||
target: "chart1";
|
||||
target: "chart2";
|
||||
target: "chart3";
|
||||
target: "chart4";
|
||||
target: "num1";
|
||||
target: "num2";
|
||||
target: "num3";
|
||||
target: "num4";
|
||||
target: "x1";
|
||||
target: "x2";
|
||||
target: "x3";
|
||||
target: "x4";
|
||||
target: "y1";
|
||||
target: "y2";
|
||||
target: "y3";
|
||||
target: "y4";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2(0
|
||||
*/
|
||||
#include <e.h>
|
||||
#include "e_mod_main.h"
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
double poll_time;
|
||||
int show_popup;
|
||||
double max_points;
|
||||
};
|
||||
|
||||
/* Protos */
|
||||
static void *_create_data(E_Config_Dialog * cfd);
|
||||
static void _free_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
||||
E_Config_Dialog_Data * cfdata);
|
||||
static int _basic_apply_data(E_Config_Dialog * cfd,
|
||||
E_Config_Dialog_Data * cfdata);
|
||||
static void _fill_data(Config_Item * ci, E_Config_Dialog_Data * cfdata);
|
||||
|
||||
static int max_points;
|
||||
|
||||
/* Config Calls */
|
||||
void
|
||||
_config_cpu_module(Config_Item * ci, int max)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
E_Container *con;
|
||||
char buf[4096];
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
|
||||
max_points = max;
|
||||
snprintf(buf, sizeof(buf), "%s/module.edj",
|
||||
e_module_dir_get(cpu_conf->module));
|
||||
con = e_container_current_get(e_manager_current_get());
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("CPU Configuration"),
|
||||
"Cpu",
|
||||
"_e_modules_cpu_config_dialog",
|
||||
buf, 0, v, ci);
|
||||
cpu_conf->config_dialog = cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(Config_Item * ci, E_Config_Dialog_Data * cfdata)
|
||||
{
|
||||
cfdata->poll_time = ci->poll_time;
|
||||
cfdata->show_popup = ci->show_popup;
|
||||
cfdata->max_points = (double) ci->max_points;
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog * cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Config_Item *ci;
|
||||
|
||||
ci = cfd->data;
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
|
||||
_fill_data(ci, cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
||||
{
|
||||
if (!cpu_conf)
|
||||
return;
|
||||
cpu_conf->config_dialog = NULL;
|
||||
free(cfdata);
|
||||
cfdata = NULL;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
||||
E_Config_Dialog_Data * cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob;
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
of = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||
ob = e_widget_check_add(evas, _("Show Popup On Mouse Over"),
|
||||
&(cfdata->show_popup));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_label_add(evas, _("Check Interval:"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1.0, 60.0, 1.0, 0,
|
||||
&(cfdata->poll_time), NULL, 150);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_label_add(evas, _("Maximum chart points:"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f points"), 1.0, (double) max_points, 1.0, 0,
|
||||
&(cfdata->max_points), NULL, 150);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
||||
{
|
||||
Config_Item *ci;
|
||||
|
||||
ci = cfd->data;
|
||||
ci->poll_time = cfdata->poll_time;
|
||||
ci->show_popup = cfdata->show_popup;
|
||||
ci->max_points = (int) cfdata->max_points;
|
||||
e_config_save_queue();
|
||||
_cpu_config_updated(ci->id);
|
||||
|
||||
return 1;
|
||||
}
|
379
e_mod_main.c
379
e_mod_main.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2(0
|
||||
*/
|
||||
#include <e.h>
|
||||
#include "e_mod_main.h"
|
||||
|
@ -18,6 +18,11 @@ struct _Instance
|
|||
E_Gadcon_Client *gcc;
|
||||
Cpu *cpu;
|
||||
Ecore_Timer *timer;
|
||||
|
||||
E_Gadcon_Popup *popup;
|
||||
Evas_Object *o_bg, *o_chart[4], *o_poly[4];
|
||||
Evas_List *points[4];
|
||||
int chart_colors[4][4];
|
||||
};
|
||||
|
||||
struct _Cpu
|
||||
|
@ -35,13 +40,12 @@ static Config_Item *_config_item_get(const char *id);
|
|||
static int _set_cpu_load(void *data);
|
||||
static int _get_cpu_count(void);
|
||||
static int _get_cpu_load(void);
|
||||
static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _graph_values(Instance *inst);
|
||||
static void _menu_cb_post(void *data, E_Menu *m);
|
||||
static void _cpu_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cpu_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cpu_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cpu_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cpu_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _cpu_menu_cb_configure (void *data, E_Menu * m, E_Menu_Item * mi);
|
||||
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
static E_Config_DD *conf_item_edd = NULL;
|
||||
|
@ -50,7 +54,7 @@ Config *cpu_conf = NULL;
|
|||
|
||||
static int cpu_count;
|
||||
static int cpu_stats[4];
|
||||
static float update_interval;
|
||||
static float update_poll_time;
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
|
@ -65,7 +69,10 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
E_Gadcon_Client *gcc;
|
||||
const char *color_string;
|
||||
char buf[4096];
|
||||
int i;
|
||||
|
||||
|
||||
cpu_count = _get_cpu_count();
|
||||
|
||||
|
@ -83,21 +90,66 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|||
|
||||
cpu->o_icon = edje_object_add(gc->evas);
|
||||
if (!e_theme_edje_object_set(cpu->o_icon,
|
||||
"base/theme/modules/cpu", "modules/cpu/main"))
|
||||
"base/theme/modules", "modules/cpu/main"))
|
||||
edje_object_file_set(cpu->o_icon, buf, "modules/cpu/main");
|
||||
evas_object_show(cpu->o_icon);
|
||||
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, cpu->o_icon);
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->cpu = cpu;
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->cpu = cpu;
|
||||
|
||||
inst->popup = e_gadcon_popup_new(gcc, NULL);
|
||||
inst->o_bg = edje_object_add(inst->popup->win->evas);
|
||||
if (!e_theme_edje_object_set(inst->o_bg,
|
||||
"base/theme/modules", "modules/cpu/popup"))
|
||||
edje_object_file_set(inst->o_bg, buf, "modules/cpu/popup");
|
||||
|
||||
for (i = 0; i < cpu_count && i < 4; i++)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "chart%d", i + 1);
|
||||
inst->o_chart[i] = edje_object_add(inst->popup->win->evas);
|
||||
evas_object_layer_set(inst->o_chart[i], 1);
|
||||
edje_object_part_swallow(inst->o_bg, buf, inst->o_chart[i]);
|
||||
|
||||
inst->o_poly[i] = evas_object_polygon_add(inst->popup->win->evas);
|
||||
evas_object_layer_set(inst->o_poly[i], 1);
|
||||
evas_object_anti_alias_set(inst->o_poly[i], 1);
|
||||
|
||||
evas_object_show(inst->o_chart[i]);
|
||||
evas_object_show(inst->o_poly[i]);
|
||||
|
||||
snprintf(buf, sizeof(buf), "chart_color%d", i + 1);
|
||||
color_string = edje_object_data_get(inst->o_bg, buf);
|
||||
if (!color_string || sscanf(color_string, "%d %d %d %d",
|
||||
&inst->chart_colors[i][0],
|
||||
&inst->chart_colors[i][1],
|
||||
&inst->chart_colors[i][2],
|
||||
&inst->chart_colors[i][3]) != 4)
|
||||
{
|
||||
inst->chart_colors[i][0] = 55;
|
||||
inst->chart_colors[i][1] = 110;
|
||||
inst->chart_colors[i][2] = 250;
|
||||
inst->chart_colors[i][3] = 155;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "e,state,orientation,%d",
|
||||
cpu_count > 4 ? 4 : cpu_count);
|
||||
edje_object_signal_emit(inst->o_bg, buf, "e");
|
||||
|
||||
e_gadcon_popup_content_set(inst->popup, inst->o_bg);
|
||||
|
||||
cpu_conf->instances = evas_list_append(cpu_conf->instances, inst);
|
||||
|
||||
evas_object_event_callback_add(cpu->o_icon, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_button_cb_mouse_down, inst);
|
||||
_cb_mouse_down, inst);
|
||||
evas_object_event_callback_add(cpu->o_icon, EVAS_CALLBACK_MOUSE_IN,
|
||||
_cb_mouse_in, inst);
|
||||
evas_object_event_callback_add(cpu->o_icon, EVAS_CALLBACK_MOUSE_OUT,
|
||||
_cb_mouse_out, inst);
|
||||
|
||||
inst->timer = ecore_timer_add(ci->interval, _set_cpu_load, inst);
|
||||
inst->timer = ecore_timer_add(ci->poll_time, _set_cpu_load, inst);
|
||||
return gcc;
|
||||
}
|
||||
|
||||
|
@ -110,6 +162,8 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
|||
inst = gcc->data;
|
||||
cpu = inst->cpu;
|
||||
|
||||
if (inst->popup)
|
||||
e_object_del(E_OBJECT(inst->popup));
|
||||
if (inst->timer)
|
||||
ecore_timer_del(inst->timer);
|
||||
if (cpu->o_icon)
|
||||
|
@ -161,15 +215,17 @@ _config_item_get(const char *id)
|
|||
if (!ci->id) continue;
|
||||
if (!strcmp(ci->id, id))
|
||||
{
|
||||
update_interval = ci->interval;
|
||||
update_poll_time = ci->poll_time;
|
||||
return ci;
|
||||
}
|
||||
}
|
||||
|
||||
ci = E_NEW(Config_Item, 1);
|
||||
ci->id = evas_stringshare_add(id);
|
||||
ci->interval = 1;
|
||||
update_interval = ci->interval;
|
||||
ci->poll_time = 1;
|
||||
ci->show_popup = 1;
|
||||
ci->max_points = 20;
|
||||
update_poll_time = ci->poll_time;
|
||||
|
||||
cpu_conf->items = evas_list_append(cpu_conf->items, ci);
|
||||
return ci;
|
||||
|
@ -178,10 +234,12 @@ _config_item_get(const char *id)
|
|||
static int
|
||||
_set_cpu_load(void *data)
|
||||
{
|
||||
Instance *inst;
|
||||
Cpu *cpu;
|
||||
int i = 0;
|
||||
char str[100], str_tmp[100];
|
||||
Instance *inst;
|
||||
Cpu *cpu;
|
||||
Config_Item *ci;
|
||||
Evas_List *l;
|
||||
int i = 0, *p;
|
||||
char str[100], str_tmp[100];
|
||||
|
||||
if (cpu_count == -1) return 0;
|
||||
|
||||
|
@ -192,6 +250,30 @@ _set_cpu_load(void *data)
|
|||
|
||||
_get_cpu_load();
|
||||
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
|
||||
for (i = 0; i < cpu_count; i++)
|
||||
{
|
||||
p = (int *) malloc(sizeof(int));
|
||||
*p = cpu_stats[i];
|
||||
|
||||
if (evas_list_count(inst->points[i]) < ci->max_points)
|
||||
{
|
||||
inst->points[i] = evas_list_prepend(inst->points[i], p);
|
||||
l = evas_list_last(inst->points[i]);
|
||||
l->next = inst->points[i];
|
||||
inst->points[i]->prev = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
inst->points[i] = inst->points[i]->prev;
|
||||
if (inst->points[i]->data) free(inst->points[i]->data);
|
||||
inst->points[i]->data = p;
|
||||
}
|
||||
}
|
||||
|
||||
_graph_values(inst);
|
||||
|
||||
if (cpu_count == 1)
|
||||
snprintf(str, sizeof(str), "<br>%d%%", cpu_stats[0]);
|
||||
else
|
||||
|
@ -258,7 +340,7 @@ _get_cpu_load(void)
|
|||
new_used = cp_time[CP_USER] + cp_time[CP_NICE] + cp_time[CP_SYS];
|
||||
new_tot = new_used + cp_time[CP_IDLE];
|
||||
|
||||
cpu_stats[0] = (100 * (float)(new_used - old_used) / (float)(new_tot - old_tot)) / update_interval;
|
||||
cpu_stats[0] = (100 * (float)(new_used - old_used) / (float)(new_tot - old_tot)) / update_poll_time;
|
||||
|
||||
old_tot = new_tot;
|
||||
old_used = new_used;
|
||||
|
@ -300,7 +382,7 @@ _get_cpu_load(void)
|
|||
tmp_s = ((new_s - old_s[i]));
|
||||
}
|
||||
|
||||
cpu_stats[i] = (tmp_u + tmp_n + tmp_s) / update_interval;
|
||||
cpu_stats[i] = (tmp_u + tmp_n + tmp_s) / update_poll_time;
|
||||
|
||||
old_u[i] = new_u;
|
||||
old_n[i] = new_n;
|
||||
|
@ -319,70 +401,113 @@ _get_cpu_load(void)
|
|||
}
|
||||
|
||||
static void
|
||||
_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
_graph_values(Instance *inst)
|
||||
{
|
||||
Config_Item *ci;
|
||||
Evas_List *l;
|
||||
int i, m, p, v, step = 3;
|
||||
float coeff;
|
||||
|
||||
if (!inst->popup->win->visible) return;
|
||||
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
for (i = 0; i < cpu_count; i++)
|
||||
{
|
||||
Evas_Coord w = 0, h = 0, x = 0, y = 0;
|
||||
|
||||
evas_object_polygon_points_clear(inst->o_poly[i]);
|
||||
evas_object_geometry_get(inst->o_chart[i], &x, &y, &w, &h);
|
||||
|
||||
coeff = (float) -h / 100;
|
||||
step = ((int) ((float) w / (float) ci->max_points + 0.5));
|
||||
if (step < 1) step = 1;
|
||||
if (step * ci->max_points < w) step++;
|
||||
|
||||
/* Lower right */
|
||||
evas_object_polygon_point_add(inst->o_poly[i], p = (x + w), m = (y + h));
|
||||
for (l = inst->points[i]; l && p >= x; l = l->next, p = p - step)
|
||||
{
|
||||
v = m + (*(int *) l->data) * coeff;
|
||||
evas_object_polygon_point_add(inst->o_poly[i], p, v);
|
||||
if (l->next == inst->points[i]) break;
|
||||
}
|
||||
if (p > x)
|
||||
evas_object_polygon_point_add(inst->o_poly[i], p, m);
|
||||
/* Lower left */
|
||||
evas_object_polygon_point_add(inst->o_poly[i], x, m);
|
||||
evas_object_color_set(inst->o_poly[i],
|
||||
inst->chart_colors[i][0],
|
||||
inst->chart_colors[i][1],
|
||||
inst->chart_colors[i][2],
|
||||
inst->chart_colors[i][3]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_cpu_config_updated(const char *id)
|
||||
{
|
||||
Evas_List *l;
|
||||
Config_Item *ci;
|
||||
|
||||
if (!cpu_conf)
|
||||
return;
|
||||
ci = _config_item_get(id);
|
||||
for (l = cpu_conf->instances; l; l = l->next)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
inst = l->data;
|
||||
if (!inst->gcc->id)
|
||||
continue;
|
||||
|
||||
if (!strcmp(inst->gcc->id, ci->id))
|
||||
{
|
||||
if (inst->timer)
|
||||
ecore_timer_del(inst->timer);
|
||||
inst->timer =
|
||||
ecore_timer_add(ci->poll_time, _set_cpu_load, inst);
|
||||
|
||||
if (!ci->show_popup)
|
||||
{
|
||||
if (inst->popup->pinned)
|
||||
e_gadcon_popup_toggle_pinned(inst->popup);
|
||||
e_gadcon_popup_hide(inst->popup);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
|
||||
inst = data;
|
||||
ev = event_info;
|
||||
if (ev->button == 1)
|
||||
e_gadcon_popup_toggle_pinned(inst->popup);
|
||||
if ((ev->button == 3) && (!cpu_conf->menu))
|
||||
{
|
||||
E_Menu *mn;
|
||||
E_Menu_Item *mi;
|
||||
int cx, cy, cw, ch;
|
||||
Config_Item *ci;
|
||||
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
|
||||
mn = e_menu_new();
|
||||
cpu_conf->menu_interval = mn;
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Fast (0.5 sec)"));
|
||||
e_menu_item_radio_set(mi, 1);
|
||||
e_menu_item_radio_group_set(mi, 1);
|
||||
if (ci->interval <= 0.5) e_menu_item_toggle_set(mi, 1);
|
||||
e_menu_item_callback_set(mi, _cpu_menu_fast, inst);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Medium (1 sec)"));
|
||||
e_menu_item_radio_set(mi, 1);
|
||||
e_menu_item_radio_group_set(mi, 1);
|
||||
if (ci->interval > 0.5) e_menu_item_toggle_set(mi, 1);
|
||||
e_menu_item_callback_set(mi, _cpu_menu_medium, inst);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Normal (2 sec)"));
|
||||
e_menu_item_radio_set(mi, 1);
|
||||
e_menu_item_radio_group_set(mi, 1);
|
||||
if (ci->interval >= 2.0) e_menu_item_toggle_set(mi, 1);
|
||||
e_menu_item_callback_set(mi, _cpu_menu_normal, inst);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Slow (5 sec)"));
|
||||
e_menu_item_radio_set(mi, 1);
|
||||
e_menu_item_radio_group_set(mi, 1);
|
||||
if (ci->interval >= 5.0) e_menu_item_toggle_set(mi, 1);
|
||||
e_menu_item_callback_set(mi, _cpu_menu_slow, inst);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Very Slow (30 sec)"));
|
||||
e_menu_item_radio_set(mi, 1);
|
||||
e_menu_item_radio_group_set(mi, 1);
|
||||
if (ci->interval >= 30.0) e_menu_item_toggle_set(mi, 1);
|
||||
e_menu_item_callback_set(mi, _cpu_menu_very_slow, inst);
|
||||
|
||||
mn = e_menu_new();
|
||||
cpu_conf->menu = mn;
|
||||
e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Time Between Updates"));
|
||||
e_menu_item_submenu_set(mi, cpu_conf->menu_interval);
|
||||
e_menu_item_label_set(mi, _("Configuration"));
|
||||
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
|
||||
e_menu_item_callback_set(mi, _cpu_menu_cb_configure, inst);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_separator_set(mi, 1);
|
||||
|
||||
e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
|
||||
|
||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch);
|
||||
e_menu_activate_mouse(mn,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
|
@ -393,90 +518,62 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
if (!(inst = data)) return;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
if (!ci->show_popup) return;
|
||||
|
||||
e_gadcon_popup_show(inst->popup);
|
||||
_graph_values(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
if (!(inst = data)) return;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
if (!ci->show_popup) return;
|
||||
|
||||
e_gadcon_popup_hide(inst->popup);
|
||||
}
|
||||
|
||||
static void
|
||||
_menu_cb_post(void *data, E_Menu *m)
|
||||
{
|
||||
if (!cpu_conf->menu) return;
|
||||
e_object_del(E_OBJECT(cpu_conf->menu));
|
||||
cpu_conf->menu = NULL;
|
||||
if (cpu_conf->menu_interval)
|
||||
e_object_del(E_OBJECT(cpu_conf->menu_interval));
|
||||
cpu_conf->menu_interval = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_cpu_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
_cpu_menu_cb_configure (void *data, E_Menu * m, E_Menu_Item * mi)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
int i, max = 0, w = 0;
|
||||
|
||||
inst = data;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
ci = _config_item_get (inst->gcc->id);
|
||||
|
||||
ci->interval = 0.5;
|
||||
ecore_timer_del(inst->timer);
|
||||
inst->timer = ecore_timer_add(ci->interval, _set_cpu_load, inst);
|
||||
e_config_save_queue();
|
||||
}
|
||||
for (i = 0; i < cpu_count && i < 4; i++)
|
||||
{
|
||||
evas_object_geometry_get(inst->o_chart[i],
|
||||
NULL, NULL,
|
||||
&w, NULL);
|
||||
|
||||
static void
|
||||
_cpu_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
inst = data;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
if (w > max)
|
||||
max = w;
|
||||
}
|
||||
|
||||
ci->interval = 1.0;
|
||||
ecore_timer_del(inst->timer);
|
||||
inst->timer = ecore_timer_add(ci->interval, _set_cpu_load, inst);
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static void
|
||||
_cpu_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
inst = data;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
|
||||
ci->interval = 2.0;
|
||||
ecore_timer_del(inst->timer);
|
||||
inst->timer = ecore_timer_add(ci->interval, _set_cpu_load, inst);
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static void
|
||||
_cpu_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
inst = data;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
|
||||
ci->interval = 5.0;
|
||||
ecore_timer_del(inst->timer);
|
||||
inst->timer = ecore_timer_add(ci->interval, _set_cpu_load, inst);
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static void
|
||||
_cpu_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
|
||||
inst = data;
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
|
||||
ci->interval = 30.0;
|
||||
ecore_timer_del(inst->timer);
|
||||
inst->timer = ecore_timer_add(ci->interval, _set_cpu_load, inst);
|
||||
e_config_save_queue();
|
||||
_config_cpu_module(ci, max);
|
||||
}
|
||||
|
||||
EAPI E_Module_Api e_modapi =
|
||||
|
@ -495,7 +592,9 @@ e_modapi_init(E_Module *m)
|
|||
#undef D
|
||||
#define D conf_item_edd
|
||||
E_CONFIG_VAL(D, T, id, STR);
|
||||
E_CONFIG_VAL(D, T, interval, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, poll_time, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, show_popup, INT);
|
||||
E_CONFIG_VAL(D, T, max_points, INT);
|
||||
|
||||
#undef T
|
||||
#define T Config
|
||||
|
@ -511,7 +610,9 @@ e_modapi_init(E_Module *m)
|
|||
cpu_conf = E_NEW(Config, 1);
|
||||
ci = E_NEW(Config_Item, 1);
|
||||
ci->id = evas_stringshare_add("0");
|
||||
ci->interval = 1;
|
||||
ci->poll_time = 1;
|
||||
ci->show_popup = 1;
|
||||
ci->max_points = 20;
|
||||
|
||||
cpu_conf->items = evas_list_append(cpu_conf->items, ci);
|
||||
}
|
||||
|
@ -535,7 +636,7 @@ e_modapi_shutdown(E_Module *m)
|
|||
cpu_conf->menu = NULL;
|
||||
}
|
||||
|
||||
while(cpu_conf->items)
|
||||
while (cpu_conf->items)
|
||||
{
|
||||
Config_Item *ci;
|
||||
|
||||
|
|
|
@ -16,7 +16,9 @@ struct _Config
|
|||
struct _Config_Item
|
||||
{
|
||||
const char *id;
|
||||
double interval;
|
||||
double poll_time;
|
||||
int show_popup;
|
||||
int max_points;
|
||||
};
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
@ -26,7 +28,8 @@ EAPI int e_modapi_shutdown (E_Module *m);
|
|||
EAPI int e_modapi_save (E_Module *m);
|
||||
EAPI int e_modapi_about (E_Module *m);
|
||||
|
||||
//void _config_cpu_module (Config_Item *ci);
|
||||
void _cpu_config_updated (const char *id);
|
||||
void _config_cpu_module (Config_Item *ci, int max);
|
||||
|
||||
extern Config *cpu_conf;
|
||||
|
||||
|
|
Loading…
Reference in New Issue