e packages build again - also not much point having an enlightenment-data as

it's built as an arch specific package and it is intrinsically required by e
and cannot work without it nor is the data shared betwene e and other apps
unless e itself is installed too


SVN revision: 22260
This commit is contained in:
Carsten Haitzler 2006-04-20 11:30:25 +00:00
parent c9cda2cb39
commit fbd972cdb9
53 changed files with 5725 additions and 7648 deletions

View File

@ -11,7 +11,7 @@ bin_SCRIPTS = enlightenment-config
EXTRA_DIST = README AUTHORS COPYING COPYING-PLAIN enlightenment.spec \ EXTRA_DIST = README AUTHORS COPYING COPYING-PLAIN enlightenment.spec \
debian/changelog debian/changelog.in debian/copyright \ debian/changelog debian/changelog.in debian/copyright \
debian/rules debian/enlightenment.install \ debian/rules debian/enlightenment.install \
debian/enlightenment.docs debian/enlightenment-data.install \ debian/enlightenment.docs \
debian/libe.install debian/libe-dev.install debian/control \ debian/libe.install debian/libe-dev.install debian/control \
enlightenment.spec.in enlightenment.spec.in

View File

@ -114,6 +114,31 @@ group {
} }
} }
} }
part {
name: "ac";
clip_to: "fade_clip";
description {
state: "default" 0.0;
aspect: 0.975609756 0.975609756;
align: 1.0 1.0;
max: 40 41;
visible: 0;
rel1 {
relative: 0.5 0.5;
}
rel2 {
relative: 1.0 1.0;
}
image {
normal: "e17_battery_ac.png";
}
}
description {
state: "active" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { part {
name: "reading"; name: "reading";
type: TEXT; type: TEXT;
@ -170,31 +195,6 @@ group {
} }
} }
} }
part {
name: "ac";
clip_to: "fade_clip";
description {
state: "default" 0.0;
aspect: 0.975609756 0.975609756;
align: 1.0 1.0;
max: 40 41;
visible: 0;
rel1 {
relative: 0.5 0.5;
}
rel2 {
relative: 1.0 1.0;
}
image {
normal: "e17_battery_ac.png";
}
}
description {
state: "active" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { part {
name: "fade_clip"; name: "fade_clip";
type: RECT; type: RECT;

View File

@ -1,8 +1,6 @@
images { images {
image: "e17_clock_bg.png" COMP; image: "e17_clock_bg.png" COMP;
image: "e17_clock_fg.png" COMP; image: "e17_clock_fg.png" COMP;
image: "e17_ibar_over_h.png" COMP;
image: "e17_ibar_bg_h.png" COMP;
image: "e17_clock_seconds_00.png" COMP; image: "e17_clock_seconds_00.png" COMP;
image: "e17_clock_seconds_01.png" COMP; image: "e17_clock_seconds_01.png" COMP;
image: "e17_clock_seconds_02.png" COMP; image: "e17_clock_seconds_02.png" COMP;
@ -189,24 +187,10 @@ group {
script { script {
public clock_cb(val) { public clock_cb(val) {
new buf[11]; new buf[11];
new digitalVal[15];
new hourStr[4], minuteStr[4], secondStr[4];
new year, month, day, yearday, weekday, hour, minute; new year, month, day, yearday, weekday, hour, minute;
new Float:second; new Float:second;
new v; new v;
new isAfternoon;
new digiBuf[2];
new digitalStyle;
new DIGITAL_STYLE_NONE, DIGITAL_STYLE_NORMAL, DIGITAL_STYLE_24HOUR;
DIGITAL_STYLE_NONE = 0;
DIGITAL_STYLE_NORMAL = 1;
DIGITAL_STYLE_24HOUR = 2;
get_text(PART:"digitalStyle", digiBuf, 2);
digitalStyle = atoi(digiBuf);
date(year, month, day, yearday, weekday, hour, minute, second); date(year, month, day, yearday, weekday, hour, minute, second);
v = round(second); v = round(second);
#if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA #if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA
@ -216,7 +200,6 @@ group {
#endif #endif
#if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA #if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA
buf[0] = 0; buf[0] = 0;
digitalVal[0] = 0;
if (v < 10) {snprintf(buf, 10, "0%i", v);} if (v < 10) {snprintf(buf, 10, "0%i", v);}
else {snprintf(buf, 10, "%i", v);} else {snprintf(buf, 10, "%i", v);}
set_state(PART:"seconds", buf, 0.0); set_state(PART:"seconds", buf, 0.0);
@ -232,59 +215,6 @@ group {
if (v < 10) {snprintf(buf, 10, "0%i", v);} if (v < 10) {snprintf(buf, 10, "0%i", v);}
else {snprintf(buf, 10, "%i", v);} else {snprintf(buf, 10, "%i", v);}
set_state(PART:"hour", buf, 0.0); set_state(PART:"hour", buf, 0.0);
buf[0] = 0;
v = round(second);
if (v < 10) {snprintf(buf, 10, "0%i", v);}
else {snprintf(buf, 10, "%i", v);}
snprintf(secondStr, 3, "%s", buf);
buf[0] = 0;
if (minute < 10) {snprintf(buf, 10, "0%i", minute);}
else {snprintf(buf, 10, "%i", minute);}
snprintf(minuteStr, 3, "%s", buf);
buf[0] = 0;
isAfternoon = 0;
v = hour;
if (hour >= 12 && hour < 24) { isAfternoon = 1; }
if (digitalStyle == DIGITAL_STYLE_NORMAL) {
v = (v % 12);
if (v == 0) { v = 12; }
}
if (digitalStyle == DIGITAL_STYLE_24HOUR && v < 10) {
snprintf(buf, 10, "0%i", v);
} else {
snprintf(buf, 10, "%i", v);
}
snprintf(hourStr, 3, "%s", buf);
buf[0] = 0;
if (isAfternoon == 1) {
snprintf(buf, 10, "PM");
} else {
snprintf(buf, 10, "AM");
}
if (digitalStyle != DIGITAL_STYLE_NONE) {
if (digitalStyle == DIGITAL_STYLE_NORMAL) {
snprintf(digitalVal, 14, "%s:%s:%s %s", hourStr, minuteStr, secondStr, buf);
} else if (digitalStyle == DIGITAL_STYLE_24HOUR) {
snprintf(digitalVal, 14, " %s:%s:%s ", hourStr, minuteStr, secondStr);
}
set_text(PART:"digital", digitalVal);
set_state(PART:"digital", "digital", 0.0);
set_state(PART:"digital_bg", "digital", 0.0);
set_state(PART:"digital_bg_overlay", "digital", 0.0);
} else {
set_text(PART:"digital", "");
set_state(PART:"digital", "hidden", 0.0);
set_state(PART:"digital_bg", "hidden", 0.0);
set_state(PART:"digital_bg_overlay", "hidden", 0.0);
}
} }
} }
parts { parts {
@ -310,10 +240,10 @@ group {
state: "default" 0.0; state: "default" 0.0;
aspect: 1.0 1.0; aspect: 1.0 1.0;
rel1 { rel1 {
relative: 0.1 0.1; relative: 0.05 0.05;
} }
rel2 { rel2 {
relative: 0.9 0.9; relative: 0.95 0.95;
} }
image { image {
normal: "e17_clock_"IND"_00.png"; normal: "e17_clock_"IND"_00.png";
@ -403,10 +333,10 @@ group {
state: "default" 0.0; state: "default" 0.0;
aspect: 1.0 1.0; aspect: 1.0 1.0;
rel1 { rel1 {
relative: 0.1 0.1; relative: 0.05 0.05;
} }
rel2 { rel2 {
relative: 0.9 0.9; relative: 0.95 0.95;
} }
image { image {
normal: "e17_clock_"IND"_00.png"; normal: "e17_clock_"IND"_00.png";
@ -495,10 +425,10 @@ group {
state: "default" 0.0; state: "default" 0.0;
aspect: 1.0 1.0; aspect: 1.0 1.0;
rel1 { rel1 {
relative: 0.2 0.2; relative: 0.1 0.1;
} }
rel2 { rel2 {
relative: 0.8 0.8; relative: 0.9 0.9;
} }
image { image {
normal: "e17_clock_"IND"_00.png"; normal: "e17_clock_"IND"_00.png";
@ -592,124 +522,6 @@ group {
} }
} }
} }
part {
name: "digital_bg_area";
type: "RECT";
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
rel1 {
relative: 0.0 0.8;
}
rel2 {
relative: 1.0 1.0;
}
visible: 0;
}
}
part {
name: "digital_bg_overlay";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "digital_bg_area";
relative: 0.0 0.0;
}
rel2 {
to: "digital_bg_area";
relative: 1.0 1.0;
}
image {
normal: "e17_ibar_over_h.png";
border: 13 13 13 13;
}
fill {
smooth: 0;
}
color: 255 255 255 192;
}
description {
state: "hidden" 0.0;
visible: 0;
image {
normal: "e17_ibar_over_h.png";
border: 13 13 13 13;
middle: 0;
}
}
}
part {
name: "digital_bg";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "digital_bg_area";
relative: 0.0 0.0;
}
rel2 {
to: "digital_bg_area";
relative: 1.0 1.0;
}
image {
normal: "e17_ibar_bg_h.png";
border: 6 6 6 6;
}
fill {
smooth: 0;
}
color: 255 255 255 128;
}
description {
state: "hidden" 0.0;
visible: 0;
image {
normal: "e17_ibar_bg_h.png";
border: 6 6 6 6;
middle: 0;
}
}
}
part {
name: "digital";
type: TEXT;
effect: SOFT_SHADOW;
description {
state: "default" 0.0;
rel1 {
to: "digital_bg_area";
offset: 3 4;
}
rel2 {
to: "digital_bg_area";
offset: -2 -2;
}
color: 255 255 255 255;
color3: 0 0 0 32;
text {
text: "00:00:00 AM";
font: "Edje-Vera";
size: 15;
fit: 0 1;
align: 0.5 0.5;
text_class: "clock";
}
}
description {
state: "hidden" 0.0;
visible: 0;
}
}
part {
name: "digitalStyle";
type: TEXT;
description {
state: "hidden" 0.0;
visible: 0;
}
}
} }
programs { programs {
program { program {

View File

@ -621,17 +621,54 @@ group {
state: "default" 0.0; state: "default" 0.0;
rel1 { rel1 {
relative: 0.0 0.0; relative: 0.0 0.0;
offset: 4 4; offset: 2 2;
} }
rel2 { rel2 {
relative: 1.0 1.0; relative: 1.0 1.0;
offset: -5 -5; offset: -3 -3;
} }
color: 0 0 0 0; color: 0 0 0 0;
} }
description {
state: "bigger" 0.0;
inherit: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
part {
name: "over";
type: RECT;
repeat_events: 0;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
} }
} }
programs { programs {
program {
name: "hover_in";
signal: "mouse,in";
source: "over";
action: STATE_SET "bigger" 0.0;
transition: LINEAR 0.1;
target: "item";
}
program {
name: "hover_out";
signal: "mouse,out";
source: "over";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.2;
target: "item";
}
program { program {
name: "exec_start"; name: "exec_start";
signal: "start"; signal: "start";
@ -671,12 +708,6 @@ group {
mouse_events: 0; mouse_events: 0;
description { description {
state: "default" 0.0; state: "default" 0.0;
rel1 {
offset: 4 4;
}
rel2 {
offset: -5 -5;
}
color: 255 255 255 0; color: 255 255 255 0;
} }
} }

View File

@ -151,10 +151,64 @@ group {
} }
} }
part { part {
name: "pager"; name: "background";
mouse_events: 0; mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "overlay";
}
rel2 {
to: "overlay";
}
image {
normal: "e17_ibar_bg_h.png";
border: 6 6 6 6;
}
fill {
smooth: 0;
}
}
}
part {
name: "items_clip";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "background";
offset: 4 4;
}
rel2 {
to: "background";
offset: -5 -5;
}
color: 255 255 255 255;
}
}
part {
name: "pager";
type: SWALLOW; type: SWALLOW;
description { mouse_events: 0;
clip_to: "items_clip";
description {
state: "default" 0.0;
rel1 {
to: "overlay";
offset: 4 4;
}
rel2 {
to: "overlay";
offset: -5 -5;
}
color: 0 0 0 0;
}
}
part {
name: "overlay";
mouse_events: 0;
description {
state: "default" 0.0; state: "default" 0.0;
rel1 { rel1 {
to_y: "title_overlay"; to_y: "title_overlay";
@ -165,7 +219,14 @@ group {
relative: 1.0 1.0; relative: 1.0 1.0;
offset: -17 -17; offset: -17 -17;
} }
color: 0 0 0 0; image {
normal: "e17_ibar_over_h.png";
border: 13 13 13 13;
middle: 0;
}
fill {
smooth: 0;
}
} }
} }
} }
@ -377,7 +438,8 @@ group {
} }
part { part {
name: "overlay"; name: "overlay";
mouse_events: 0; repeat_events: 1;
// mouse_events: 0;
description { description {
state: "default" 0.0; state: "default" 0.0;
rel1 { rel1 {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 17 KiB

15
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: enlightenment
Section: x11 Section: x11
Priority: optional Priority: optional
Maintainer: E17 Debian Team <debian@edevelop.org> Maintainer: E17 Debian Team <debian@edevelop.org>
Build-Depends: libevas-dev, libecore-dev, libeet-dev, libedje-dev, edje-bin, libembryo-dev, xlibs-dev, automake1.7 | automaken, libtool, debhelper (>= 4.0) Build-Depends: libevas-dev, libecore-dev, libeet-dev, libedje-dev, edje-bin, libembryo-dev, libx11-dev, x-dev, libxext-dev, automake1.7 | automaken, libtool, debhelper (>= 4.0)
Standards-Version: 3.6.2.2 Standards-Version: 3.6.2.2
Package: enlightenment Package: enlightenment
@ -10,24 +10,13 @@ Architecture: any
Section: x11 Section: x11
Recommends: libevas-engine-xrender Recommends: libevas-engine-xrender
Suggests: entrance Suggests: entrance
Depends: ${shlibs:Depends}, libe, enlightenment-data (>= 0.16.999), libevas, libecore, libecore-con, libecore-evas, libecore-file, libecore-ipc, libecore-job, libecore-txt, libecore-x, libeet, libembryo, embryo-bin, edje-bin, libedje, libevas-loader-eet, libevas-loader-jpeg, libevas-loader-png, libevas-saver-eet, libevas-saver-jpeg, libevas-saver-png, libevas-engine-buffer, libevas-engine-software-x11 Depends: ${shlibs:Depends}, libe, libevas, libecore, libecore-con, libecore-evas, libecore-file, libecore-ipc, libecore-job, libecore-txt, libecore-x, libeet, libembryo, embryo-bin, edje-bin, libedje, libevas-loader-eet, libevas-loader-jpeg, libevas-loader-png, libevas-saver-eet, libevas-saver-jpeg, libevas-saver-png, libevas-engine-buffer, libevas-engine-software-x11
Description: Enlightenment themes, etc. Description: Enlightenment themes, etc.
Enlightenment is an advanced window manager for X11. Unique Enlightenment is an advanced window manager for X11. Unique
features include: a fully animated background, nice drop shadows features include: a fully animated background, nice drop shadows
around windows, backed by an extremely clean and optimized around windows, backed by an extremely clean and optimized
foundation of APIs. foundation of APIs.
Package: enlightenment-data
Architecture: any
Section: x11
Depends: enlightenment (= ${Source-Version})
Conflicts: enlightenment-data (< 0.16.999)
Description: Enlightenment themes, etc.
Enlightenment is an advanced window manager for X11. Unique
features include: a fully animated background, nice drop shadows
around windows, a unique application launcher module (ibar). All
backed by an extremely clean and optimized foundation of APIs.
Package: libe Package: libe
Section: libs Section: libs
Architecture: any Architecture: any

View File

@ -1,2 +0,0 @@
debian/tmp/usr/share/enlightenment/data/themes/*.edj
debian/tmp/usr/share/enlightenment/data/init/*.edj

View File

@ -21,9 +21,5 @@ debian/tmp/usr/lib/enlightenment/modules/start/*.png
debian/tmp/usr/lib/enlightenment/modules/temperature/*/*.so debian/tmp/usr/lib/enlightenment/modules/temperature/*/*.so
debian/tmp/usr/lib/enlightenment/modules/temperature/*.png debian/tmp/usr/lib/enlightenment/modules/temperature/*.png
debian/tmp/usr/share/enlightenment debian/tmp/usr/share/enlightenment
debian/tmp/usr/share/enlightenment
debian/tmp/usr/share/enlightenment
debian/tmp/usr/share/enlightenment
debian/tmp/usr/share/enlightenment
debian/tmp/usr/share/locale debian/tmp/usr/share/locale
debian/tmp/usr/share/xsessions debian/tmp/usr/share/xsessions

View File

@ -5727,6 +5727,21 @@ _e_border_eval(E_Border *bd)
changed = 0; changed = 0;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
if (rects[i].x < 0)
{
rects[i].width -= rects[i].x;
rects[i].x = 0;
}
if ((rects[i].x + rects[i].width) > bd->w)
rects[i].width = rects[i].width - rects[i].x;
if (rects[i].y < 0)
{
rects[i].height -= rects[i].y;
rects[i].y = 0;
}
if ((rects[i].y + rects[i].height) > bd->h)
rects[i].height = rects[i].height - rects[i].y;
if ((orects[i].x != rects[i].x) || if ((orects[i].x != rects[i].x) ||
(orects[i].y != rects[i].y) || (orects[i].y != rects[i].y) ||
(orects[i].width != rects[i].width) || (orects[i].width != rects[i].width) ||

View File

@ -91,6 +91,7 @@ e_config_init(void)
E_CONFIG_VAL(D, T, geom.res, INT); E_CONFIG_VAL(D, T, geom.res, INT);
E_CONFIG_VAL(D, T, style, STR); E_CONFIG_VAL(D, T, style, STR);
E_CONFIG_VAL(D, T, autoscroll, UCHAR); E_CONFIG_VAL(D, T, autoscroll, UCHAR);
E_CONFIG_VAL(D, T, resizable, UCHAR);
_e_config_gadcon_edd = E_CONFIG_DD_NEW("E_Config_Gadcon", E_Config_Gadcon); _e_config_gadcon_edd = E_CONFIG_DD_NEW("E_Config_Gadcon", E_Config_Gadcon);
#undef T #undef T
@ -1016,71 +1017,111 @@ e_config_init(void)
"desk_linear_flip_by", "1"); "desk_linear_flip_by", "1");
} }
IFCFGEND; IFCFGEND;
/* yes - this causes a small leak - i know. it is for testing temporarily x*/ IFCFG(0x0093); /* the version # where this value(s) was introduced */
/* FIXME: wipe previous shelves and gadcons - remove this eventually */
e_config->shelves = NULL; e_config->shelves = NULL;
e_config->gadcons = NULL; e_config->gadcons = NULL;
// IFCFG(0x008e); /* the version # where this value(s) was introduced */
#if 1 // this is liable to change
{ {
E_Config_Shelf *cf_es; E_Config_Shelf *cf_es;
cf_es = E_NEW(E_Config_Shelf, 1); #define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size) \
cf_es->name = evas_stringshare_add("shelf"); cf_es = E_NEW(E_Config_Shelf, 1); \
cf_es->container = 0; cf_es->name = evas_stringshare_add(_name); \
cf_es->zone = 0; cf_es->container = _con; \
cf_es->popup = 1; cf_es->zone = _zone; \
cf_es->layer = 200; cf_es->popup = _pop; \
cf_es->orient = E_GADCON_ORIENT_TOP; cf_es->layer = _lay; \
cf_es->fit_along = 1; cf_es->orient = _orient; \
cf_es->fit_size = 0; cf_es->fit_along = _fita; \
cf_es->style = evas_stringshare_add("default"); cf_es->fit_size = _fits; \
cf_es->size = 40; cf_es->style = evas_stringshare_add(_style); \
e_config->shelves = evas_list_append(e_config->shelves, cf_es); cf_es->size = _size; \
e_config->shelves = evas_list_append(e_config->shelves, cf_es)
/* shelves for 4 zones on head 0 by default */
CFG_SHELF("shelf", 0, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
CFG_SHELF("shelf", 0, 1,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
CFG_SHELF("shelf", 0, 2,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
CFG_SHELF("shelf", 0, 3,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
/* shelves for heada 1, 2, and 3 by default */
CFG_SHELF("shelf", 1, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
CFG_SHELF("shelf", 2, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
CFG_SHELF("shelf", 3, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40);
} }
{ {
E_Config_Gadcon *cf_gc; E_Config_Gadcon *cf_gc;
E_Config_Gadcon_Client *cf_gcc; E_Config_Gadcon_Client *cf_gcc;
#define CFG_GADCON(_name, _id) \
cf_gc = E_NEW(E_Config_Gadcon, 1);\
cf_gc->name = evas_stringshare_add(_name); \
cf_gc->id = evas_stringshare_add(_id); \
e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc)
#define CFG_GADCON_CLIENT(_name, _id, _res, _size, _pos, _style, _autoscr, _resizable) \
cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); \
cf_gcc->name = evas_stringshare_add(_name); \
cf_gcc->id = evas_stringshare_add(_id); \
cf_gcc->geom.res = _res; \
cf_gcc->geom.size = _size; \
cf_gcc->geom.pos = _pos; \
if (_style) cf_gcc->style = evas_stringshare_add(_style); \
else cf_gcc->style = NULL; \
cf_gcc->autoscroll = _autoscr; \
cf_gcc->resizable = _resizable; \
cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc)
/* the default shelf on the default head/zone */
CFG_GADCON("shelf", "0");
CFG_GADCON_CLIENT("start", "default", 800, 32,
0, NULL, 0, 0);
CFG_GADCON_CLIENT("pager", "default", 800, 120,
32, "inset", 0, 0);
CFG_GADCON_CLIENT("ibar", "default", 800, 200,
400 - (16 / 2), "inset", 1, 0);
CFG_GADCON_CLIENT("temperature", "default", 800, 32,
800 - (4 * 32), NULL, 0, 0);
CFG_GADCON_CLIENT("cpufreq", "default", 800, 32,
800 - (3 * 32), NULL, 0, 0);
CFG_GADCON_CLIENT("battery", "default", 800, 32,
800 - (2 * 32), NULL, 0, 0);
CFG_GADCON_CLIENT("clock", "default", 800, 32,
800 - (1 * 32), NULL, 0, 0);
/* additional shelves for up to 3 more heads by default */
CFG_GADCON("shelf", "1");
CFG_GADCON_CLIENT("pager", "default2", 800, 120,
0, "inset", 0, 0);
CFG_GADCON_CLIENT("ibar", "default2", 800, 16,
400 - (16 / 2), "inset", 1, 0);
cf_gc = E_NEW(E_Config_Gadcon, 1); CFG_GADCON("shelf", "2");
cf_gc->name = evas_stringshare_add("shelf"); CFG_GADCON_CLIENT("pager", "default3", 800, 120,
cf_gc->id = evas_stringshare_add("0"); 0, "inset", 0, 0);
e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc); CFG_GADCON_CLIENT("ibar", "default2", 800, 16,
400 - (16 / 2), "inset", 1, 0);
cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); CFG_GADCON("shelf", "3");
cf_gcc->name = evas_stringshare_add("ibar"); CFG_GADCON_CLIENT("pager", "default4", 800, 120,
cf_gcc->id = evas_stringshare_add("default"); 0, "inset", 0, 0);
cf_gcc->geom.res = 800; CFG_GADCON_CLIENT("ibar", "default2", 800, 16,
cf_gcc->geom.size = 200; 400 - (16 / 2), "inset", 1, 0);
cf_gcc->geom.pos = 400 - (cf_gcc->geom.size / 2);
cf_gcc->style = evas_stringshare_add("inset");
cf_gcc->autoscroll = 0;
cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
cf_gcc = E_NEW(E_Config_Gadcon_Client, 1);
cf_gcc->name = evas_stringshare_add("clock");
cf_gcc->id = evas_stringshare_add("default");
cf_gcc->geom.res = 800;
cf_gcc->geom.size = 32;
cf_gcc->geom.pos = 800 - (cf_gcc->geom.size);
cf_gcc->style = NULL;
cf_gcc->autoscroll = 0;
cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
cf_gcc = E_NEW(E_Config_Gadcon_Client, 1);
cf_gcc->name = evas_stringshare_add("start");
cf_gcc->id = evas_stringshare_add("default");
cf_gcc->geom.res = 800;
cf_gcc->geom.size = 32;
cf_gcc->geom.pos = 0;
cf_gcc->style = NULL;
cf_gcc->autoscroll = 0;
cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
} }
#endif IFCFGEND;
// IFCFGEND;
#if 0 /* example of new config */ #if 0 /* example of new config */
IFCFG(0x008e); /* the version # where this value(s) was introduced */ IFCFG(0x0090); /* the version # where this value(s) was introduced */
e_config->new_value = 10; /* set the value(s) */ e_config->new_value = 10; /* set the value(s) */
IFCFGEND; IFCFGEND;
#endif #endif

View File

@ -50,7 +50,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
/* increment this whenever a new set of configvalues are added but the users /* increment this whenever a new set of configvalues are added but the users
* config doesn't need top be wiped - simply new values need to be put in * config doesn't need top be wiped - simply new values need to be put in
*/ */
#define E_CONFIG_FILE_GENERATION 0x008e #define E_CONFIG_FILE_GENERATION 0x0093
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
#define E_EVAS_ENGINE_DEFAULT 0 #define E_EVAS_ENGINE_DEFAULT 0
@ -317,6 +317,7 @@ struct _E_Config_Gadcon_Client
} geom; } geom;
const char *style; const char *style;
unsigned char autoscroll; unsigned char autoscroll;
unsigned char resizable;
}; };
struct _E_Config_Shelf struct _E_Config_Shelf

View File

@ -3,6 +3,11 @@
*/ */
#include "e.h" #include "e.h"
/* FIXME: broken when drop areas intersect
* (sub window has drop area on top of lower window or desktop -
* also shutdown is broken (walking list and deleting from the list as u go
* in this code is broken)
*/
/* /*
* TODO: * TODO:
* - Let an internal drag work with several types. * - Let an internal drag work with several types.

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ struct _E_Gadcon
struct { struct {
void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
void *data; void *data;
} resize_request; } resize_request, min_size_request;
struct { struct {
Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style); Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style);
void *data; void *data;
@ -91,20 +91,30 @@ struct _E_Gadcon_Client
char *name; char *name;
char *id; char *id;
Evas_Object *o_base; Evas_Object *o_base;
Evas_Object *o_box;
Evas_Object *o_frame; Evas_Object *o_frame;
Evas_Object *o_control; Evas_Object *o_control;
Evas_Object *o_event; Evas_Object *o_event;
E_Gadcon_Client_Class client_class; E_Gadcon_Client_Class *client_class;
void *data; void *data;
struct { struct {
int pos, size, res; int pos, size, res;
} config; } config;
struct { struct {
Evas_Coord w, h; Evas_Coord w, h;
} pad; } pad, min, aspect;
unsigned char inset : 1;
unsigned char autoscroll : 1;
unsigned char resizable : 1;
Ecore_Timer *scroll_timer;
Ecore_Animator *scroll_animator;
double scroll_pos;
double scroll_wanted;
E_Menu *menu;
unsigned char moving : 1; unsigned char moving : 1;
Evas_Coord dx, dy, sx, sy; unsigned char resizing : 1;
Evas_Coord dx, dy, sx, sy, sw, sh;
}; };
EAPI int e_gadcon_init(void); EAPI int e_gadcon_init(void);
@ -113,10 +123,13 @@ EAPI void e_gadcon_provider_register(E_Gadcon_Client_Class *cc);
EAPI void e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc); EAPI void e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc);
EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swallow_name); EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swallow_name);
EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
EAPI void e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data); EAPI void e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
EAPI void e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data); EAPI void e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data);
EAPI void e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy); EAPI void e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy);
EAPI void e_gadcon_populate(E_Gadcon *gc); EAPI void e_gadcon_populate(E_Gadcon *gc);
EAPI void e_gadcon_unpopulate(E_Gadcon *gc);
EAPI void e_gadcon_populate_class(E_Gadcon *gc, E_Gadcon_Client_Class *cc);
EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient); EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient);
EAPI void e_gadcon_edit_begin(E_Gadcon *gc); EAPI void e_gadcon_edit_begin(E_Gadcon *gc);
EAPI void e_gadcon_edit_end(E_Gadcon *gc); EAPI void e_gadcon_edit_end(E_Gadcon *gc);
@ -128,11 +141,16 @@ EAPI void e_gadcon_ecore_evas_set(E_Gadcon *gc, Ecore_Evas *ee);
EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h); EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h);
EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object *base_obj); EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object *base_obj);
EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc);
EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc);
EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h); EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc); EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc); EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags);
EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc);
#endif #endif
#endif #endif

View File

@ -129,5 +129,6 @@
#include "e_gadcon.h" #include "e_gadcon.h"
#include "e_shelf.h" #include "e_shelf.h"
#include "e_tlist.h" #include "e_tlist.h"
#include "e_widget_tlist.h"
#include "e_widget_preview.h" #include "e_widget_preview.h"
#include "e_int_config_paths.h" #include "e_int_config_paths.h"

View File

@ -676,7 +676,8 @@ main(int argc, char **argv)
e_test(); e_test();
/* FIXME: for testing only */ /* FIXME: for testing only */
// e_shelf_config_init(); //
e_shelf_config_init();
/* no longer starting up */ /* no longer starting up */
starting = 0; starting = 0;

View File

@ -64,6 +64,83 @@ _e_place_cb_sort_cmp(const void *v1, const void *v2)
return (*((int *)v1)) - (*((int *)v2)); return (*((int *)v1)) - (*((int *)v2));
} }
static int
_e_place_coverage_border_add(E_Zone *zone, Evas_List *skiplist, int ar, int x, int y, int w, int h)
{
Evas_List *ll;
E_Border_List *bl;
E_Border *bd;
int x2, y2, w2, h2;
int ok;
int iw, ih;
int x0, x00, y0, y00;
bl = e_container_border_list_first(zone->container);
while ((bd = e_container_border_list_next(bl)))
{
ok = 1;
x2 = (bd->x - zone->x); y2 = (bd->y - zone->y); w2 = bd->w; h2 = bd->h;
for (ll = skiplist; ll; ll = ll->next)
{
if (ll->data == bd)
{
ok = 0;
break;
}
}
if ((ok) && (bd->visible) && E_INTERSECTS(x, y, w, h, x2, y2, w2, h2))
{
x0 = x;
if (x < x2) x0 = x2;
x00 = (x + w);
if ((x2 + w2) < (x + w)) x00 = (x2 + w2);
y0 = y;
if (y < y2) y0 = y2;
y00 = (y + h);
if ((y2 + h2) < (y + h)) y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
ar += (iw * ih);
}
}
e_container_border_list_free(bl);
return ar;
}
static int
_e_place_coverage_shelf_add(E_Zone *zone, int ar, int x, int y, int w, int h)
{
Evas_List *l;
E_Shelf *es;
int x2, y2, w2, h2;
int ok;
int iw, ih;
int x0, x00, y0, y00;
for (l = e_shelf_list(); l; l = l->next)
{
es = l->data;
if (es->zone != zone) continue;
x2 = es->x; y2 = es->y; w2 = es->w; h2 = es->h;
if (E_INTERSECTS(x, y, w, h, x2, y2, w2, h2))
{
x0 = x;
if (x < x2) x0 = x2;
x00 = (x + w);
if ((x2 + w2) < (x + w)) x00 = (x2 + w2);
y0 = y;
if (y < y2) y0 = y2;
y00 = (y + h);
if ((y2 + h2) < (y + h)) y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
ar += (iw * ih) * 100; /* 100 == 100 times more unlikely for overlap than a normal window */
}
}
return ar;
}
EAPI int EAPI int
e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry) e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry)
{ {
@ -90,59 +167,9 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
x -= zone->x; x -= zone->x;
y -= zone->y; y -= zone->y;
zw = zone->w;
zh = zone->h;
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET)
{
Evas_List *l;
int cx1, cx2, cy1, cy2;
cx1 = zone->x;
cy1 = zone->y;
cx2 = zone->x + zone->w;
cy2 = zone->y + zone->h;
/* Find the smallest box */
for (l = zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
double ax, ay;
gmc = l->data;
if ((gmc->zone != zone)) continue;
ax = gmc->ax;
ay = gmc->ay;
if (((ax == 0.0) || (ax == 1.0)) &&
((ay == 0.0) || (ay == 1.0)))
{
/* corner gadget */
/* Fake removal from one alignment :) */
if (gmc->w > gmc->h)
ax = 0.5;
else
ay = 0.5;
}
if ((ax == 0.0) && (gmc->x + gmc->w) > cx1)
cx1 = (gmc->x + gmc->w);
else if ((ax == 1.0) && (gmc->x < cx2))
cx2 = gmc->x;
else if ((ay == 0.0) && ((gmc->y + gmc->h) > cy1))
cy1 = (gmc->y + gmc->h);
else if ((ay == 1.0) && (gmc->y < cy2))
cy2 = gmc->y;
}
zw = cx2 - cx1;
zh = cy2 - cy1;
}
else
{
zw = zone->w;
zh = zone->h;
}
u_x = calloc(zw + 1, sizeof(char)); u_x = calloc(zw + 1, sizeof(char));
u_y = calloc(zh + 1, sizeof(char)); u_y = calloc(zh + 1, sizeof(char));
@ -150,7 +177,135 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
a_x[1] = zw; a_x[1] = zw;
a_y[0] = 0; a_y[0] = 0;
a_y[1] = zh; a_y[1] = zh;
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET)
{
Evas_List *l;
for (l = zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
int bx, by, bw, bh;
gmc = l->data;
if ((gmc->zone != zone)) continue;
bx = gmc->x;
by = gmc->y;
bw = gmc->w;
bh = gmc->h;
if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh))
{
if ((bx > 0) && (bx <= zw) && (!u_x[bx]))
{
a_w++;
if (a_w > a_alloc_w)
{
a_alloc_w += 32;
E_REALLOC(a_x, int, a_alloc_w);
}
a_x[a_w - 1] = bx;
u_x[bx] = 1;
}
if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw]))
{
a_w++;
if (a_w > a_alloc_w)
{
a_alloc_w += 32;
E_REALLOC(a_x, int, a_alloc_w);
}
a_x[a_w - 1] = bx + bw;
u_x[bx + bw] = 1;
}
if ((by > 0) && (by <= zh) && (!u_y[by]))
{
a_h++;
if (a_h > a_alloc_h)
{
a_alloc_h += 32;
E_REALLOC(a_y, int, a_alloc_h);
}
a_y[a_h - 1] = by;
u_y[by] = 1;
}
if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh]))
{
a_h++;
if (a_h > a_alloc_h)
{
a_alloc_h += 32;
E_REALLOC(a_y, int, a_alloc_h);
}
a_y[a_h - 1] = by + bh;
u_y[by + bh] = 1;
}
}
}
for (l = e_shelf_list(); l; l = l->next)
{
E_Shelf *es;
es = l->data;
if (es->zone == zone)
{
int bx, by, bw, bh;
bx = es->x;
by = es->y;
bw = es->w;
bh = es->h;
if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh))
{
if ((bx > 0) && (bx <= zw) && (!u_x[bx]))
{
a_w++;
if (a_w > a_alloc_w)
{
a_alloc_w += 32;
E_REALLOC(a_x, int, a_alloc_w);
}
a_x[a_w - 1] = bx;
u_x[bx] = 1;
}
if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw]))
{
a_w++;
if (a_w > a_alloc_w)
{
a_alloc_w += 32;
E_REALLOC(a_x, int, a_alloc_w);
}
a_x[a_w - 1] = bx + bw;
u_x[bx + bw] = 1;
}
if ((by > 0) && (by <= zh) && (!u_y[by]))
{
a_h++;
if (a_h > a_alloc_h)
{
a_alloc_h += 32;
E_REALLOC(a_y, int, a_alloc_h);
}
a_y[a_h - 1] = by;
u_y[by] = 1;
}
if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh]))
{
a_h++;
if (a_h > a_alloc_h)
{
a_alloc_h += 32;
E_REALLOC(a_y, int, a_alloc_h);
}
a_y[a_h - 1] = by + bh;
u_y[by + bh] = 1;
}
}
}
}
}
bl = e_container_border_list_first(zone->container); bl = e_container_border_list_first(zone->container);
while ((bd = e_container_border_list_next(bl))) while ((bd = e_container_border_list_next(bl)))
{ {
@ -240,252 +395,72 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
{ {
int ar = 0; int ar = 0;
bl = e_container_border_list_first(zone->container); ar = _e_place_coverage_border_add(zone, skiplist, ar,
while ((bd = e_container_border_list_next(bl))) a_x[i], a_y[j],
{ w, h);
int x1, y1, w1, h1, x2, y2, w2, h2; ar = _e_place_coverage_shelf_add(zone, ar,
int ok; a_x[i], a_y[j],
w, h);
ok = 1;
x1 = a_x[i];
y1 = a_y[j];
w1 = w;
h1 = h;
x2 = (bd->x - zone->x);
y2 = (bd->y - zone->y);
w2 = bd->w;
h2 = bd->h;
for (ll = skiplist; ll; ll = ll->next)
{
if (ll->data == bd)
{
ok = 0;
break;
}
}
if ((ok) && (bd->visible) &&
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
{
int iw, ih;
int x0, x00, y0, y00;
x0 = x1;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
ar += (iw * ih);
}
}
e_container_border_list_free(bl);
if (ar < area) if (ar < area)
{ {
area = ar; area = ar;
*rx = a_x[i]; *rx = a_x[i];
*ry = a_y[j]; *ry = a_y[j];
if (ar == 0) if (ar == 0) goto done;
goto done;
} }
} }
if ((a_x[i + 1] - w > 0) && (a_y[j] < (zh - h))) if ((a_x[i + 1] - w > 0) && (a_y[j] < (zh - h)))
{ {
int ar = 0; int ar = 0;
bl = e_container_border_list_first(zone->container); ar = _e_place_coverage_border_add(zone, skiplist, ar,
while ((bd = e_container_border_list_next(bl))) a_x[i + 1] - w, a_y[j],
{ w, h);
int x1, y1, w1, h1, x2, y2, w2, h2; ar = _e_place_coverage_shelf_add(zone, ar,
int ok; a_x[i + 1] - w, a_y[j],
w, h);
ok = 1;
x1 = a_x[i + 1] - w;
y1 = a_y[j];
w1 = w;
h1 = h;
x2 = (bd->x - zone->x);
y2 = (bd->y - zone->y);
w2 = bd->w;
h2 = bd->h;
for (ll = skiplist; ll; ll = ll->next)
{
if (ll->data == bd)
{
ok = 0;
break;
}
}
if ((ok) && (bd->visible) &&
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
{
int iw, ih;
int x0, x00, y0, y00;
x0 = x1;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
ar += (iw * ih);
}
}
e_container_border_list_free(bl);
if (ar < area) if (ar < area)
{ {
area = ar; area = ar;
*rx = a_x[i + 1] - w; *rx = a_x[i + 1] - w;
*ry = a_y[j]; *ry = a_y[j];
if (ar == 0) if (ar == 0) goto done;
goto done;
} }
} }
if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0)) if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0))
{ {
int ar = 0; int ar = 0;
bl = e_container_border_list_first(zone->container); ar = _e_place_coverage_border_add(zone, skiplist, ar,
while ((bd = e_container_border_list_next(bl))) a_x[i + 1] - w, a_y[j + 1] - h,
{ w, h);
int x1, y1, w1, h1, x2, y2, w2, h2; ar = _e_place_coverage_shelf_add(zone, ar,
int ok; a_x[i + 1] - w, a_y[j + 1] - h,
w, h);
ok = 1;
x1 = a_x[i + 1] - w;
y1 = a_y[j + 1] - h;
w1 = w;
h1 = h;
x2 = (bd->x - zone->x);
y2 = (bd->y - zone->y);
w2 = bd->w;
h2 = bd->h;
for (ll = skiplist; ll; ll = ll->next)
{
if (ll->data == bd)
{
ok = 0;
break;
}
}
if ((ok) && (bd->visible) &&
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
{
int iw, ih;
int x0, x00, y0, y00;
x0 = x1;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
ar += (iw * ih);
}
}
e_container_border_list_free(bl);
if (ar < area) if (ar < area)
{ {
area = ar; area = ar;
*rx = a_x[i + 1] - w; *rx = a_x[i + 1] - w;
*ry = a_y[j + 1] - h; *ry = a_y[j + 1] - h;
if (ar == 0) if (ar == 0) goto done;
goto done;
} }
} }
if ((a_x[i] < (zw - w)) && (a_y[j + 1] - h > 0)) if ((a_x[i] < (zw - w)) && (a_y[j + 1] - h > 0))
{ {
int ar = 0; int ar = 0;
bl = e_container_border_list_first(zone->container); ar = _e_place_coverage_border_add(zone, skiplist, ar,
while ((bd = e_container_border_list_next(bl))) a_x[i], a_y[j + 1] - h,
{ w, h);
int x1, y1, w1, h1, x2, y2, w2, h2; ar = _e_place_coverage_shelf_add(zone, ar,
int ok; a_x[i], a_y[j + 1] - h,
w, h);
ok = 1;
x1 = a_x[i];
y1 = a_y[j + 1] - h;
w1 = w;
h1 = h;
x2 = (bd->x - zone->x);
y2 = (bd->y - zone->y);
w2 = bd->w;
h2 = bd->h;
for (ll = skiplist; ll; ll = ll->next)
{
if (ll->data == bd)
{
ok = 0;
break;
}
}
if ((ok) && (bd->visible) &&
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
{
int iw, ih;
int x0, x00, y0, y00;
x0 = x1;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
ar += (iw * ih);
}
}
e_container_border_list_free(bl);
if (ar < area) if (ar < area)
{ {
area = ar; area = ar;
*rx = a_x[i]; *rx = a_x[i];
*ry = a_y[j + 1] - h; *ry = a_y[j + 1] - h;
if (ar == 0) if (ar == 0) goto done;
goto done;
} }
} }
} }

View File

@ -207,6 +207,21 @@ e_popup_idler_before(void)
orects = pop->shape_rects; orects = pop->shape_rects;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
if (rects[i].x < 0)
{
rects[i].width -= rects[i].x;
rects[i].x = 0;
}
if ((rects[i].x + rects[i].width) > pop->w)
rects[i].width = rects[i].width - rects[i].x;
if (rects[i].y < 0)
{
rects[i].height -= rects[i].y;
rects[i].y = 0;
}
if ((rects[i].y + rects[i].height) > pop->h)
rects[i].height = rects[i].height - rects[i].y;
if ((orects[i].x != rects[i].x) || if ((orects[i].x != rects[i].x) ||
(orects[i].y != rects[i].y) || (orects[i].y != rects[i].y) ||
(orects[i].width != rects[i].width) || (orects[i].width != rects[i].width) ||
@ -216,7 +231,7 @@ e_popup_idler_before(void)
break; break;
} }
} }
changed = 0; // changed = 0;
} }
if (changed) if (changed)
{ {

View File

@ -92,6 +92,17 @@ e_resist_container_border_position(E_Container *con, Evas_List *skiplist,
gmc = l->data; gmc = l->data;
OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist); OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist);
} }
for (l = e_shelf_list(); l; l = l->next)
{
E_Shelf *es;
es = l->data;
if (es->zone->container == con)
{
OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h,
e_config->gadget_resist);
}
}
if (rects) if (rects)
{ {
_e_resist_rects(rects, _e_resist_rects(rects,
@ -141,17 +152,22 @@ e_resist_container_gadman_position(E_Container *con, Evas_List *skiplist,
} }
if (ok) if (ok)
{ {
r = E_NEW(E_Resist_Rect, 1); OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist);
r->x = gmc->x;
r->y = gmc->y;
r->w = gmc->w;
r->h = gmc->h;
r->v1 = e_config->gadget_resist;
rects = evas_list_append(rects, r);
} }
} }
for (l = e_shelf_list(); l; l = l->next)
{
E_Shelf *es;
es = l->data;
if (es->zone->container == con)
{
OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h,
e_config->gadget_resist);
}
}
if (rects) if (rects)
{ {
_e_resist_rects(rects, _e_resist_rects(rects,

View File

@ -6,6 +6,7 @@
static void _e_shelf_free(E_Shelf *es); static void _e_shelf_free(E_Shelf *es);
static const char *_e_shelf_orient_string_get(E_Shelf *es); static const char *_e_shelf_orient_string_get(E_Shelf *es);
static void _e_shelf_position_calc(E_Shelf *es); static void _e_shelf_position_calc(E_Shelf *es);
static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style); static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
@ -47,6 +48,8 @@ e_shelf_config_init(void)
if (es) if (es)
{ {
es->cfg = cf_es; es->cfg = cf_es;
es->fit_along = cf_es->fit_along;
es->fit_size = cf_es->fit_size;
e_shelf_orient(es, cf_es->orient); e_shelf_orient(es, cf_es->orient);
_e_shelf_position_calc(es); _e_shelf_position_calc(es);
e_shelf_populate(es); e_shelf_populate(es);
@ -56,6 +59,12 @@ e_shelf_config_init(void)
} }
} }
EAPI Evas_List *
e_shelf_list(void)
{
return shelves;
}
EAPI E_Shelf * EAPI E_Shelf *
e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer) e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer)
{ {
@ -114,6 +123,9 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
snprintf(buf, sizeof(buf), "%i", shelf_id); snprintf(buf, sizeof(buf), "%i", shelf_id);
shelf_id++; shelf_id++;
es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items"); es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items");
e_gadcon_min_size_request_callback_set(es->gadcon,
_e_shelf_gadcon_min_size_request,
es);
e_gadcon_size_request_callback_set(es->gadcon, e_gadcon_size_request_callback_set(es->gadcon,
_e_shelf_gadcon_size_request, _e_shelf_gadcon_size_request,
es); es);
@ -465,6 +477,12 @@ _e_shelf_position_calc(E_Shelf *es)
e_shelf_move_resize(es, es->x, es->y, es->w, es->h); e_shelf_move_resize(es, es->x, es->y, es->w, es->h);
} }
static void
_e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
{
return;
}
static void static void
_e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h) _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
{ {
@ -477,7 +495,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
nw = es->w; nw = es->w;
nh = es->h; nh = es->h;
ww = hh = 0; ww = hh = 0;
printf("req min = %i %i\n", w, h); printf("req = %i %i\n", w, h);
evas_object_geometry_get(gc->o_container, NULL, NULL, &ww, &hh); evas_object_geometry_get(gc->o_container, NULL, NULL, &ww, &hh);
switch (gc->orient) switch (gc->orient)
{ {
@ -537,7 +555,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
if (!es->fit_size) nw = es->w; if (!es->fit_size) nw = es->w;
if (nw > es->zone->w) nw = es->zone->w; if (nw > es->zone->w) nw = es->zone->w;
if (nh > es->zone->h) nh = es->zone->h; if (nh > es->zone->h) nh = es->zone->h;
if (nh != es->h) ny = es->y + ((es->h - nh) / 2); if (nh != es->h) ny = (es->zone->h - nh) / 2;
nx = 0; nx = 0;
break; break;
case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_RIGHT:
@ -545,7 +563,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
if (!es->fit_size) nw = es->w; if (!es->fit_size) nw = es->w;
if (nw > es->zone->w) nw = es->zone->w; if (nw > es->zone->w) nw = es->zone->w;
if (nh > es->zone->h) nh = es->zone->h; if (nh > es->zone->h) nh = es->zone->h;
if (nh != es->h) ny = es->y + ((es->h - nh) / 2); if (nh != es->h) ny = (es->zone->h - nh) / 2;
nx = es->zone->w - nw; nx = es->zone->w - nw;
break; break;
case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_TOP:
@ -553,7 +571,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
if (!es->fit_size) nh = es->h; if (!es->fit_size) nh = es->h;
if (nw > es->zone->w) nw = es->zone->w; if (nw > es->zone->w) nw = es->zone->w;
if (nh > es->zone->h) nh = es->zone->h; if (nh > es->zone->h) nh = es->zone->h;
if (nw != es->w) nx = es->x + ((es->w - nw) / 2); if (nw != es->w) nx = (es->zone->w - nw) / 2;
ny = 0; ny = 0;
break; break;
case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_BOTTOM:
@ -561,7 +579,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
if (!es->fit_size) nh = es->h; if (!es->fit_size) nh = es->h;
if (nw > es->zone->w) nw = es->zone->w; if (nw > es->zone->w) nw = es->zone->w;
if (nh > es->zone->h) nh = es->zone->h; if (nh > es->zone->h) nh = es->zone->h;
if (nw != es->w) nx = es->x + ((es->w - nw) / 2); if (nw != es->w) nx = (es->zone->w - nw) / 2;
ny = es->zone->h - nh; ny = es->zone->h - nh;
break; break;
case E_GADCON_ORIENT_CORNER_TL: case E_GADCON_ORIENT_CORNER_TL:

View File

@ -34,6 +34,7 @@ struct _E_Shelf
EAPI int e_shelf_init(void); EAPI int e_shelf_init(void);
EAPI int e_shelf_shutdown(void); EAPI int e_shelf_shutdown(void);
EAPI void e_shelf_config_init(void); EAPI void e_shelf_config_init(void);
EAPI Evas_List *e_shelf_list(void);
EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer); EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer);
EAPI void e_shelf_populate(E_Shelf *es); EAPI void e_shelf_populate(E_Shelf *es);
EAPI void e_shelf_show(E_Shelf *es); EAPI void e_shelf_show(E_Shelf *es);

View File

@ -21,8 +21,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h \
e_mod_config.c \ e_mod_config.c
e_mod_config.h
module_la_LIBADD = @e_libs@ @cf_libs@ @dlopen_libs@ module_la_LIBADD = @e_libs@ @cf_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,7 +1,5 @@
#include "e.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
@ -19,7 +17,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas,
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
void void
_config_battery_module(E_Container *con, Battery *bat) _config_battery_module(void)
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Config_Dialog_View *v; E_Config_Dialog_View *v;
@ -33,15 +31,18 @@ _config_battery_module(E_Container *con, Battery *bat)
v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.apply_cfdata = _advanced_apply_data;
v->advanced.create_widgets = _advanced_create_widgets; v->advanced.create_widgets = _advanced_create_widgets;
cfd = e_config_dialog_new(con, _("Battery Configuration"), NULL, 0, v, bat); cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
bat->config_dialog = cfd; _("Battery Monitor Configuration"),
NULL, 0, v, NULL);
battery_config->config_dialog = cfd;
} }
static void static void
_fill_data(Battery *b, E_Config_Dialog_Data *cfdata) _fill_data(E_Config_Dialog_Data *cfdata)
{ {
cfdata->alarm_time = b->conf->alarm; if (!battery_config) return;
cfdata->poll_time = b->conf->poll_time; cfdata->alarm_time = battery_config->alarm;
cfdata->poll_time = battery_config->poll_time;
if (cfdata->alarm_time > 0) if (cfdata->alarm_time > 0)
cfdata->show_alert = 1; cfdata->show_alert = 1;
else else
@ -52,21 +53,17 @@ static void *
_create_data(E_Config_Dialog *cfd) _create_data(E_Config_Dialog *cfd)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
Battery *b;
b = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(b, cfdata); _fill_data(cfdata);
return cfdata; return cfdata;
} }
static void static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Battery *b; if (!battery_config) return;
battery_config->config_dialog = NULL;
b = cfd->data;
b->config_dialog = NULL;
free(cfdata); free(cfdata);
} }
@ -86,16 +83,13 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
static int static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Battery *b; if (!battery_config) return;
if (cfdata->show_alert)
b = cfd->data; battery_config->alarm = cfdata->alarm_time;
e_border_button_bindings_ungrab_all(); else
b->conf->poll_time = 10.0; battery_config->alarm = 0;
_battery_config_updated();
e_border_button_bindings_grab_all();
e_config_save_queue(); e_config_save_queue();
_battery_face_cb_config_updated(b);
return 1; return 1;
} }
@ -130,20 +124,14 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
static int static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Battery *b; if (!battery_config) return;
battery_config->poll_time = cfdata->poll_time;
b = cfd->data;
e_border_button_bindings_ungrab_all();
b->conf->poll_time = cfdata->poll_time;
if (cfdata->show_alert) if (cfdata->show_alert)
b->conf->alarm = cfdata->alarm_time; battery_config->alarm = cfdata->alarm_time;
else else
b->conf->alarm = 0; battery_config->alarm = 0;
_battery_config_updated();
e_border_button_bindings_grab_all();
e_config_save_queue(); e_config_save_queue();
_battery_face_cb_config_updated(b);
return 1; return 1;
} }

View File

@ -1,8 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
#include "e_mod_main.h"
void _config_battery_module(E_Container *con, Battery *b);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,6 @@
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
typedef struct _Config Config; typedef struct _Config Config;
typedef struct _Config_Face Config_Face;
typedef struct _Battery Battery;
typedef struct _Battery_Face Battery_Face;
typedef struct _Status Status; typedef struct _Status Status;
#define CHECK_NONE 0 #define CHECK_NONE 0
@ -18,44 +14,19 @@ typedef struct _Status Status;
struct _Config struct _Config
{ {
double poll_time; /* saved * loaded config values */
int alarm; double poll_time;
Evas_List *faces; int alarm;
}; /* just config state */
struct _Config_Face
{
unsigned char enabled;
};
struct _Battery
{
E_Menu *config_menu;
Evas_List *faces;
Config *conf;
int alarm_triggered;
int battery_check_mode;
Ecore_Timer *battery_check_timer;
int battery_prev_drain;
int battery_prev_ac;
int battery_prev_battery;
E_Config_Dialog *config_dialog; E_Config_Dialog *config_dialog;
}; Evas_List *instances;
E_Menu *menu;
struct _Battery_Face int alarm_triggered;
{ int battery_check_mode;
Battery *battery; Ecore_Timer *battery_check_timer;
E_Container *con; int battery_prev_drain;
int battery_prev_ac;
E_Menu *menu; int battery_prev_battery;
Config_Face *conf;
Evas_Object *bat_object;
Evas_Object *event_object;
E_Gadman_Client *gmc;
}; };
#ifdef __FreeBSD__ #ifdef __FreeBSD__
@ -95,6 +66,8 @@ EAPI int e_modapi_info (E_Module *m);
EAPI int e_modapi_about (E_Module *m); EAPI int e_modapi_about (E_Module *m);
EAPI int e_modapi_config (E_Module *m); EAPI int e_modapi_config (E_Module *m);
void _battery_face_cb_config_updated(Battery *bat); void _config_battery_module(void);
void _battery_config_updated(void);
extern Config *battery_config;
#endif #endif

View File

@ -19,9 +19,7 @@ INCLUDES = -I. \
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h
e_mod_config.c \
e_mod_config.h
module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,99 +0,0 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
struct _E_Config_Dialog_Data
{
int digital_style;
};
/* 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);
void
_config_clock_module(E_Container *con, Clock_Face *c)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
v = E_NEW(E_Config_Dialog_View, 1);
/* Dialog Methods */
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
/* Create The Dialog */
cfd = e_config_dialog_new(con, _("Clock Configuration"), NULL, 0, v, c);
c->config_dialog = cfd;
}
static void
_fill_data(Clock_Face *clk, E_Config_Dialog_Data *cfdata)
{
cfdata->digital_style = clk->conf->digitalStyle;
}
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
Clock_Face *cf;
cf = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cf, cfdata);
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
Clock_Face *c;
c = cfd->data;
c->config_dialog = NULL;
free(cfdata);
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *of, *ob;
E_Radio_Group *rg;
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("General Settings"), 0);
rg = e_widget_radio_group_new(&(cfdata->digital_style));
ob = e_widget_radio_add(evas, _("No Digital Display"), 0, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("12 Hour Display"), 1, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("24 Hour Display"), 2, rg);
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)
{
Clock_Face *clk;
clk = cfd->data;
e_border_button_bindings_ungrab_all();
clk->conf->digitalStyle = cfdata->digital_style;
e_border_button_bindings_grab_all();
e_config_save_queue();
_clock_face_cb_config_updated(clk);
return 1;
}

View File

@ -1,8 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
#include "e_mod_main.h"
void _config_clock_module(E_Container *con, Clock_Face *c);
#endif
#endif

View File

@ -3,39 +3,93 @@
*/ */
#include "e.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
/* TODO List: /***************************************************************************/
* /**/
*/ /* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc);
/* and actually define the gadcon class that this module provides (just 1) */
static const E_Gadcon_Client_Class _gadcon_class =
{
GADCON_CLIENT_CLASS_VERSION,
"clock",
{
_gc_init, _gc_shutdown, _gc_orient
}
};
/**/
/***************************************************************************/
/* module private routines */ /***************************************************************************/
static Clock *_clock_new(); /**/
static void _clock_shutdown(Clock *clock); /* actual module specifics */
static void _clock_config_menu_new(Clock *clock);
static Clock_Face *_clock_face_new(Clock *clock, E_Container *con); typedef struct _Instance Instance;
static void _clock_face_free(Clock_Face *face);
/* static void _clock_face_enable(Clock_Face *face); */
static void _clock_face_disable(Clock_Face *face);
static void _clock_face_menu_new(Clock_Face *face);
static void _clock_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change);
static void _clock_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _clock_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
static void _clock_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
static int _clock_count; struct _Instance
{
E_Gadcon_Client *gcc;
Evas_Object *o_clock;
};
static E_Config_DD *conf_edd; static E_Gadcon_Client *
static E_Config_DD *conf_face_edd; _gc_init(E_Gadcon *gc, char *name, char *id, char *style)
{
Evas_Object *o;
E_Gadcon_Client *gcc;
Instance *inst;
inst = E_NEW(Instance, 1);
o = edje_object_add(gc->evas);
e_theme_edje_object_set(o, "base/theme/modules/clock",
"modules/clock/main");
evas_object_show(o);
gcc = e_gadcon_client_new(gc, name, id, style, o);
gcc->data = inst;
inst->gcc = gcc;
inst->o_clock = o;
e_gadcon_client_util_menu_attach(gcc);
return gcc;
}
const int static void
DIGITAL_STYLE_NONE = 0, _gc_shutdown(E_Gadcon_Client *gcc)
DIGITAL_STYLE_12HOUR = 1, {
DIGITAL_STYLE_24HOUR = 2 Instance *inst;
;
inst = gcc->data;
evas_object_del(inst->o_clock);
free(inst);
}
/* public module routines. all modules must have these */ static void
_gc_orient(E_Gadcon_Client *gcc)
{
Instance *inst;
inst = gcc->data;
e_gadcon_client_aspect_set(gcc, 16, 16);
e_gadcon_client_min_size_set(gcc, 16, 16);
}
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/* module setup */
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, E_MODULE_API_VERSION,
@ -45,37 +99,20 @@ EAPI E_Module_Api e_modapi =
EAPI void * EAPI void *
e_modapi_init(E_Module *module) e_modapi_init(E_Module *module)
{ {
Clock *clock; e_gadcon_provider_register(&_gadcon_class);
return 1;
/* actually init clock */
clock = _clock_new();
module->config_menu = clock->config_menu;
return clock;
} }
EAPI int EAPI int
e_modapi_shutdown(E_Module *module) e_modapi_shutdown(E_Module *module)
{ {
Clock *clock; e_gadcon_provider_unregister(&_gadcon_class);
if (module->config_menu)
module->config_menu = NULL;
clock = module->data;
if (clock)
{
_clock_shutdown(clock);
}
return 1; return 1;
} }
EAPI int EAPI int
e_modapi_save(E_Module *module) e_modapi_save(E_Module *module)
{ {
Clock *clock;
clock = module->data;
e_config_domain_save("module.clock", conf_edd, clock->conf);
return 1; return 1;
} }
@ -96,354 +133,3 @@ e_modapi_about(E_Module *module)
_("A simple module to give E17 a clock.")); _("A simple module to give E17 a clock."));
return 1; return 1;
} }
EAPI int
e_modapi_config(E_Module *m)
{
Clock *e;
Clock_Face *face;
e = m->data;
if (!e) return 0;
if (!e->faces) return 0;
face = e->faces->data;
if (!face) return 0;
_config_clock_module(face->con, face);
return 1;
}
/* module private routines */
static Clock *
_clock_new()
{
Clock *clock;
Evas_List *managers, *l, *l2, *cl;
E_Menu_Item *mi;
_clock_count = 0;
clock = E_NEW(Clock, 1);
if (!clock) return NULL;
conf_face_edd = E_CONFIG_DD_NEW("Clock_Config_Face", Config_Face);
#undef T
#undef D
#define T Config_Face
#define D conf_face_edd
E_CONFIG_VAL(D, T, enabled, UCHAR);
E_CONFIG_VAL(D, T, digitalStyle, INT);
conf_edd = E_CONFIG_DD_NEW("Clock_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
E_CONFIG_LIST(D, T, faces, conf_face_edd);
clock->conf = e_config_domain_load("module.clock", conf_edd);
if (!clock->conf)
{
clock->conf = E_NEW(Config, 1);
}
_clock_config_menu_new(clock);
managers = e_manager_list();
cl = clock->conf->faces;
for (l = managers; l; l = l->next)
{
E_Manager *man;
man = l->data;
for (l2 = man->containers; l2; l2 = l2->next)
{
E_Container *con;
Clock_Face *face;
con = l2->data;
face = _clock_face_new(clock, con);
if (face)
{
face->clock = clock;
clock->faces = evas_list_append(clock->faces, face);
/* Config */
if (!cl)
{
face->conf = E_NEW(Config_Face, 1);
face->conf->enabled = 1;
face->conf->digitalStyle = DIGITAL_STYLE_NONE;
clock->conf->faces = evas_list_append(clock->conf->faces, face->conf);
}
else
{
face->conf = cl->data;
cl = cl->next;
}
_clock_face_cb_config_updated(face);
/* Menu */
/* This menu must be initialized after conf */
_clock_face_menu_new(face);
mi = e_menu_item_new(clock->config_menu);
e_menu_item_label_set(mi, _("Configuration"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
e_menu_item_callback_set(mi, _clock_face_cb_menu_configure, face);
mi = e_menu_item_new(clock->config_menu);
e_menu_item_label_set(mi, con->name);
e_menu_item_submenu_set(mi, face->menu);
/* Setup */
if (!face->conf->enabled)
_clock_face_disable(face);
}
}
}
return clock;
}
static void
_clock_shutdown(Clock *clock)
{
Evas_List *list;
E_CONFIG_DD_FREE(conf_edd);
E_CONFIG_DD_FREE(conf_face_edd);
for (list = clock->faces; list; list = list->next)
_clock_face_free(list->data);
evas_list_free(clock->faces);
e_object_del(E_OBJECT(clock->config_menu));
evas_list_free(clock->conf->faces);
free(clock->conf);
free(clock);
}
static void
_clock_config_menu_new(Clock *clock)
{
clock->config_menu = e_menu_new();
}
static Clock_Face *
_clock_face_new(Clock *clock, E_Container *con)
{
Clock_Face *face;
Evas_Object *o;
Evas_Coord x, y, w, h;
E_Gadman_Policy policy;
face = E_NEW(Clock_Face, 1);
if (!face) return NULL;
face->con = con;
e_object_ref(E_OBJECT(con));
evas_event_freeze(con->bg_evas);
o = edje_object_add(con->bg_evas);
face->clock_object = o;
e_theme_edje_object_set(o, "base/theme/modules/clock",
"modules/clock/main");
evas_object_show(o);
o = evas_object_rectangle_add(con->bg_evas);
face->event_object = o;
evas_object_layer_set(o, 2);
evas_object_repeat_events_set(o, 1);
evas_object_color_set(o, 0, 0, 0, 0);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _clock_face_cb_mouse_down, face);
evas_object_show(o);
evas_object_resize(face->clock_object, 200, 200);
edje_object_calc_force(face->clock_object);
edje_object_part_geometry_get(face->clock_object, "main", &x, &y, &w, &h);
face->inset.l = x;
face->inset.r = 200 - (x + w);
face->inset.t = y;
face->inset.b = 200 - (y + h);
face->gmc = e_gadman_client_new(con->gadman);
e_gadman_client_domain_set(face->gmc, "module.clock", _clock_count++);
policy = E_GADMAN_POLICY_ANYWHERE |
E_GADMAN_POLICY_HMOVE |
E_GADMAN_POLICY_VMOVE |
E_GADMAN_POLICY_HSIZE |
E_GADMAN_POLICY_VSIZE;
e_gadman_client_policy_set(face->gmc, policy);
e_gadman_client_min_size_set(face->gmc, 4, 4);
e_gadman_client_max_size_set(face->gmc, 512, 512);
e_gadman_client_auto_size_set(face->gmc,
40 + (face->inset.l + face->inset.r),
40 + (face->inset.t + face->inset.b));
e_gadman_client_align_set(face->gmc, 1.0, 1.0);
e_gadman_client_aspect_set(face->gmc, 1.0, 1.0);
e_gadman_client_padding_set(face->gmc,
face->inset.l, face->inset.r,
face->inset.t, face->inset.b);
e_gadman_client_resize(face->gmc,
40 + (face->inset.l + face->inset.r),
40 + (face->inset.t + face->inset.b));
e_gadman_client_change_func_set(face->gmc, _clock_face_cb_gmc_change, face);
e_gadman_client_load(face->gmc);
evas_event_thaw(con->bg_evas);
return face;
}
static void
_clock_face_free(Clock_Face *face)
{
if (face->config_dialog)
{
e_object_del(E_OBJECT(face->config_dialog));
face->config_dialog = NULL;
}
e_object_unref(E_OBJECT(face->con));
e_object_del(E_OBJECT(face->gmc));
evas_object_del(face->clock_object);
evas_object_del(face->event_object);
e_object_del(E_OBJECT(face->menu));
free(face->conf);
free(face);
_clock_count--;
}
/*
static void
_clock_face_enable(Clock_Face *face)
{
face->conf->enabled = 1;
evas_object_show(face->clock_object);
evas_object_show(face->event_object);
e_config_save_queue();
}
*/
static void
_clock_face_disable(Clock_Face *face)
{
face->conf->enabled = 0;
evas_object_hide(face->clock_object);
evas_object_hide(face->event_object);
e_config_save_queue();
}
static void
_clock_face_menu_new(Clock_Face *face)
{
E_Menu *mn;
E_Menu_Item *mi;
mn = e_menu_new();
face->menu = mn;
/* Enabled */
/*
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Enabled"));
e_menu_item_check_set(mi, 1);
if (face->conf->enabled) e_menu_item_toggle_set(mi, 1);
e_menu_item_callback_set(mi, _clock_face_cb_menu_enabled, face);
*/
/* Config */
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Configuration"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
e_menu_item_callback_set(mi, _clock_face_cb_menu_configure, face);
/* Edit */
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Edit Mode"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets");
e_menu_item_callback_set(mi, _clock_face_cb_menu_edit, face);
}
static void
_clock_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change)
{
Clock_Face *face;
Evas_Coord x, y, w, h;
face = data;
switch (change)
{
case E_GADMAN_CHANGE_MOVE_RESIZE:
e_gadman_client_geometry_get(face->gmc, &x, &y, &w, &h);
evas_object_move(face->clock_object, x, y);
evas_object_move(face->event_object, x, y);
evas_object_resize(face->clock_object, w, h);
evas_object_resize(face->event_object, w, h);
break;
case E_GADMAN_CHANGE_RAISE:
evas_object_raise(face->clock_object);
evas_object_raise(face->event_object);
break;
case E_GADMAN_CHANGE_EDGE:
case E_GADMAN_CHANGE_ZONE:
/* FIXME
* Must we do something here?
*/
break;
}
}
static void
_clock_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Clock_Face *face;
Evas_Event_Mouse_Down *ev;
face = data;
ev = event_info;
if (ev->button == 3)
{
e_menu_activate_mouse(face->menu, e_zone_current_get(face->con),
ev->output.x, ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
e_util_container_fake_mouse_up_all_later(face->con);
}
}
static void
_clock_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi)
{
Clock_Face *face;
face = data;
e_gadman_mode_set(face->gmc->gadman, E_GADMAN_MODE_EDIT);
}
static void
_clock_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
{
Clock_Face *face;
face = data;
if (!face) return;
_config_clock_module(face->con, face);
}
void
_clock_face_cb_config_updated(void *data)
{
Clock_Face *face;
char buf[2];
face = data;
memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), "%i", face->conf->digitalStyle);
edje_object_part_text_set(face->clock_object, "digitalStyle", buf);
}

View File

@ -4,48 +4,6 @@
#ifndef E_MOD_MAIN_H #ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
typedef struct _Config Config;
typedef struct _Config_Face Config_Face;
typedef struct _Clock Clock;
typedef struct _Clock_Face Clock_Face;
struct _Config
{
Evas_List *faces;
};
struct _Config_Face
{
unsigned char enabled;
int digitalStyle;
};
struct _Clock
{
Evas_List *faces;
E_Menu *config_menu;
Config *conf;
};
struct _Clock_Face
{
E_Container *con;
E_Menu *menu;
Config_Face *conf;
Clock *clock;
struct {
Evas_Coord l, r, t, b;
} inset;
Evas_Object *clock_object;
Evas_Object *event_object;
E_Gadman_Client *gmc;
E_Config_Dialog *config_dialog;
};
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
EAPI void *e_modapi_init (E_Module *module); EAPI void *e_modapi_init (E_Module *module);
@ -55,6 +13,4 @@ EAPI int e_modapi_info (E_Module *module);
EAPI int e_modapi_about (E_Module *module); EAPI int e_modapi_about (E_Module *module);
EAPI int e_modapi_config (E_Module *module); EAPI int e_modapi_config (E_Module *module);
void _clock_face_cb_config_updated(void *data);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +1,34 @@
#ifndef E_MOD_MAIN_H #ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
#include <e.h>
#include <Evas.h>
typedef struct _Status Status; typedef struct _Status Status;
typedef struct _Config Config; typedef struct _Config Config;
typedef struct _Config_Face Config_Face;
typedef struct _Cpufreq Cpufreq;
typedef struct _Cpufreq_Face Cpufreq_Face;
struct _Status struct _Status
{ {
Evas_List *frequencies; Evas_List *frequencies;
Evas_List *governors; Evas_List *governors;
int cur_frequency; int cur_frequency;
int can_set_frequency; int can_set_frequency;
char *cur_governor; char *cur_governor;
unsigned char active; unsigned char active;
}; };
struct _Config struct _Config
{ {
double poll_time; /* saved * loaded config values */
Evas_List *faces; double poll_time;
int restore_governor;
int restore_governor; char *governor;
char *governor; /* just config state */
}; Evas_List *instances;
struct _Config_Face
{
unsigned char enabled;
};
struct _Cpufreq
{
E_Menu *config_menu;
E_Menu *config_menu_poll;
E_Menu *menu_governor;
E_Menu *menu_frequency;
Evas_List *faces;
Config *conf;
Status *status;
char *set_exe_path;
Ecore_Timer *frequency_check_timer;
};
struct _Cpufreq_Face
{
E_Container *con;
E_Menu *menu; E_Menu *menu;
Config_Face *conf; E_Menu *menu_poll;
Cpufreq *owner; E_Menu *menu_governor;
E_Menu *menu_frequency;
Evas_Object *freq_object; Status *status;
Evas_Object *event_object; char *set_exe_path;
Ecore_Timer *frequency_check_timer;
E_Gadman_Client *gmc;
}; };
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;

View File

@ -694,7 +694,7 @@ static void
_ds_shadow_resize(Shadow *sh, int w, int h) _ds_shadow_resize(Shadow *sh, int w, int h)
{ {
unsigned char toosmall = 0; unsigned char toosmall = 0;
_ds_shadow_obj_init(sh); _ds_shadow_obj_init(sh);
if ((w < ((sh->ds->conf->blur_size * 2) + 2)) || if ((w < ((sh->ds->conf->blur_size * 2) + 2)) ||
(h < ((sh->ds->conf->blur_size * 2) + 2))) (h < ((sh->ds->conf->blur_size * 2) + 2)))

View File

@ -20,8 +20,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h \
e_mod_config.c \ e_mod_config.c
e_mod_config.h
module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,15 +1,12 @@
#include <e.h> /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
int autofit; char *dir;
int follower;
int iconsize;
double follow_speed;
double autoscroll_speed;
}; };
/* Protos */ /* Protos */
@ -21,156 +18,110 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
void void
_config_ibar_module(E_Container *con, IBar *ibar) _config_ibar_module(Config_Item *ci)
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Config_Dialog_View *v; E_Config_Dialog_View *v;
v = E_NEW(E_Config_Dialog_View, 1); v = E_NEW(E_Config_Dialog_View, 1);
/* Dialog Methods */ /* Dialog Methods */
v->create_cfdata = _create_data; v->create_cfdata = _create_data;
v->free_cfdata = _free_data; v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data; v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets; v->basic.create_widgets = _basic_create_widgets;
v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.apply_cfdata = NULL;
v->advanced.create_widgets = _advanced_create_widgets; v->advanced.create_widgets = NULL;
/* Create The Dialog */ /* Create The Dialog */
cfd = e_config_dialog_new(con, _("IBar Configuration"), NULL, 0, v, ibar); cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
ibar->config_dialog = cfd; _("IBar Configuration"), NULL, 0, v, ci);
ibar_config->config_dialog = cfd;
} }
static void static void
_fill_data(IBar *ib, E_Config_Dialog_Data *cfdata) _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
{ {
cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO); if (ci->dir)
cfdata->follower = ib->conf->follower; cfdata->dir = strdup(ci->dir);
cfdata->iconsize = ib->conf->iconsize; else
cfdata->follow_speed = ib->conf->follow_speed; cfdata->dir = strdup("");
cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
} }
static void * static void *
_create_data(E_Config_Dialog *cfd) _create_data(E_Config_Dialog *cfd)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
IBar *ib; Config_Item *ci;
ib = cfd->data; ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(ib, cfdata); _fill_data(ci, cfdata);
return cfdata; return cfdata;
} }
static void static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
IBar *ib; if (cfdata->dir) free(cfdata->dir);
ibar_config->config_dialog = NULL;
ib = cfd->data;
ib->config_dialog = NULL;
free(cfdata); free(cfdata);
} }
static Evas_Object * static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{ {
Evas_Object *o, *ob; Evas_Object *o, *of, *ol;
Ecore_List *dirs;
char *home, buf[4096], *file;
int selnum = -1;
o = e_widget_framelist_add(evas, _("Selected Bar Source"), 0);
ol = e_widget_tlist_add(evas, &(cfdata->dir));
e_widget_min_size_set(ol, 160, 200);
e_widget_framelist_object_append(o, ol);
o = e_widget_list_add(evas, 0, 0); home = e_user_homedir_get();
ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower)); snprintf(buf, sizeof(buf), "%s/.e/e/applications", home);
e_widget_list_object_append(o, ob, 1, 1, 0.5); dirs = ecore_file_ls(buf);
ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit));
e_widget_list_object_append(o, ob, 1, 1, 0.5); if (dirs)
{
int i;
i = 0;
while ((file = ecore_list_next(dirs)))
{
if (file[0] == '.') continue;
snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", home, file);
if (ecore_file_is_dir(buf))
{
e_widget_tlist_append(ol, file, NULL, NULL, file);
if ((cfdata->dir) && (!strcmp(cfdata->dir, file)))
selnum = i;
i++;
}
}
ecore_list_destroy(dirs);
}
free(home);
e_widget_tlist_go(ol);
if (selnum >= 0)
e_widget_tlist_selected_set(ol, selnum);
return o; return o;
} }
static int static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
IBar *ib; Config_Item *ci;
ib = cfd->data; ci = cfd->data;
e_border_button_bindings_ungrab_all(); if (ci->dir) evas_stringshare_del(ci->dir);
if ((cfdata->follower) && (!ib->conf->follower)) ci->dir = NULL;
ib->conf->follower = 1; if (cfdata->dir) ci->dir = evas_stringshare_add(cfdata->dir);
else if (!(cfdata->follower) && (ib->conf->follower)) _ibar_config_update();
ib->conf->follower = 0;
if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED))
ib->conf->width = IBAR_WIDTH_AUTO;
else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO))
ib->conf->width = IBAR_WIDTH_FIXED;
e_border_button_bindings_grab_all();
e_config_save_queue(); e_config_save_queue();
_ibar_bar_cb_config_updated(ib);
return 1; return 1;
} }
static Evas_Object *
_advanced_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, _("Follower"), 0);
ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Follow Speed"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->follow_speed), NULL,200);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Icon Size"), 0);
ob = e_widget_slider_add(evas, 1, 0, _("%3.0f pixels"), 8.0, 128.0, 1.0, 0, NULL, &(cfdata->iconsize), 200);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Width"), 0);
ob = e_widget_check_add(evas, _("Auto Fit"), &(cfdata->autofit));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Autoscroll Speed:"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->autoscroll_speed), NULL,200);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
}
static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
IBar *ib;
ib = cfd->data;
e_border_button_bindings_ungrab_all();
if ((cfdata->follower) && (!ib->conf->follower))
ib->conf->follower = 1;
else if (!(cfdata->follower) && (ib->conf->follower))
ib->conf->follower = 0;
if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED))
ib->conf->width = IBAR_WIDTH_AUTO;
else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO))
ib->conf->width = IBAR_WIDTH_FIXED;
if (cfdata->iconsize != ib->conf->iconsize)
ib->conf->iconsize = cfdata->iconsize;
if (cfdata->follow_speed != ib->conf->follow_speed)
ib->conf->follow_speed = cfdata->follow_speed;
if (cfdata->autoscroll_speed != ib->conf->autoscroll_speed)
ib->conf->autoscroll_speed = cfdata->autoscroll_speed;
e_border_button_bindings_grab_all();
e_config_save_queue();
_ibar_bar_cb_config_updated(ib);
return 1;
}

View File

@ -1,8 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
#include "e_mod_main.h"
void _config_ibar_module(E_Container *con, IBar *ibar);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -5,87 +5,23 @@
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
typedef struct _Config Config; typedef struct _Config Config;
typedef struct _Config_Bar Config_Bar; typedef struct _Config_Item Config_Item;
typedef struct _IBar IBar;
typedef struct _IBar_Bar IBar_Bar;
typedef struct _IBar_Icon IBar_Icon;
#define IBAR_WIDTH_AUTO -1
#define IBAR_WIDTH_FIXED -2
struct _Config struct _Config
{ {
const char *appdir; /* saved * loaded config values */
int follower; Evas_List *items;
double follow_speed; /* just config state */
double autoscroll_speed; E_Config_Dialog *config_dialog;
int iconsize; Evas_List *instances;
int width; E_Menu *menu;
Evas_List *bars; Evas_List *handlers;
}; };
struct _Config_Bar struct _Config_Item
{ {
unsigned char enabled; char *id;
}; char *dir;
struct _IBar
{
E_App *apps;
Evas_List *bars;
E_Menu *config_menu;
Config *conf;
E_Config_Dialog *config_dialog;
};
struct _IBar_Bar
{
IBar *ibar;
E_Container *con;
Evas *evas;
E_Menu *menu;
Evas_Object *bar_object;
Evas_Object *overlay_object;
Evas_Object *box_object;
Evas_Object *event_object;
Evas_Object *drag_object;
Evas_Object *drag_object_overlay;
Evas_List *icons;
double align, align_req;
double follow, follow_req;
Ecore_Timer *timer;
Ecore_Animator *animator;
Evas_Coord x, y, w, h;
struct {
Evas_Coord l, r, t, b;
} bar_inset;
struct {
Evas_Coord l, r, t, b;
} icon_inset;
E_Gadman_Client *gmc;
Config_Bar *conf;
E_Drop_Handler *drop_handler;
};
struct _IBar_Icon
{
IBar_Bar *ibb;
E_App *app;
Evas_Object *bg_object;
Evas_Object *overlay_object;
Evas_Object *icon_object;
Evas_Object *event_object;
Evas_List *extra_icons;
unsigned char raise_on_hilight : 1;
}; };
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
@ -95,8 +31,9 @@ EAPI int e_modapi_shutdown (E_Module *m);
EAPI int e_modapi_save (E_Module *m); EAPI int e_modapi_save (E_Module *m);
EAPI int e_modapi_info (E_Module *m); EAPI int e_modapi_info (E_Module *m);
EAPI int e_modapi_about (E_Module *m); EAPI int e_modapi_about (E_Module *m);
/* EAPI int e_modapi_config (E_Module *m); */
void _ibar_bar_cb_config_updated(void *data); void _ibar_config_update(void);
void _config_ibar_module(Config_Item *ci);
extern Config *ibar_config;
#endif #endif

View File

@ -20,8 +20,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h \
e_mod_config.c \ e_mod_config.c
e_mod_config.h
module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,12 +1,8 @@
#include "e.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
int show_name;
int name_pos;
int show_popup; int show_popup;
double popup_speed; double popup_speed;
int drag_resist; int drag_resist;
@ -21,7 +17,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
void void
_config_pager_module(E_Container *con, Pager *pager) _config_pager_module(Config_Item *ci)
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Config_Dialog_View *v; E_Config_Dialog_View *v;
@ -35,49 +31,36 @@ _config_pager_module(E_Container *con, Pager *pager)
v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.apply_cfdata = _advanced_apply_data;
v->advanced.create_widgets = _advanced_create_widgets; v->advanced.create_widgets = _advanced_create_widgets;
cfd = e_config_dialog_new(con, _("Pager Configuration"), NULL, 0, v, pager); cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
pager->config_dialog = cfd; _("Pager Configuration"), NULL, 0, v, ci);
pager_config->config_dialog = cfd;
} }
static void static void
_fill_data(Pager *p, E_Config_Dialog_Data *cfdata) _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
{ {
/* Name Pos, Show Popup, popup_speed */ /* FIXME: configure zone config item */
cfdata->name_pos = p->conf->deskname_pos; cfdata->show_popup = pager_config->popup;
if (cfdata->name_pos == PAGER_DESKNAME_NONE) cfdata->popup_speed = pager_config->popup_speed;
{ cfdata->drag_resist = pager_config->drag_resist;
cfdata->show_name = 0;
cfdata->name_pos = PAGER_DESKNAME_TOP;
}
else
{
cfdata->show_name = 1;
}
cfdata->show_popup = p->conf->popup;
cfdata->popup_speed = p->conf->popup_speed;
cfdata->drag_resist = p->conf->drag_resist;
} }
static void * static void *
_create_data(E_Config_Dialog *cfd) _create_data(E_Config_Dialog *cfd)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
Pager *p; Config_Item *ci;
p = cfd->data; ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(p, cfdata); _fill_data(ci, cfdata);
return cfdata; return cfdata;
} }
static void static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Pager *p; pager_config->config_dialog = NULL;
p = cfd->data;
p->config_dialog = NULL;
free(cfdata); free(cfdata);
} }
@ -91,43 +74,17 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
of = e_widget_framelist_add(evas, _("General Settings"), 0); of = e_widget_framelist_add(evas, _("General Settings"), 0);
ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup)); ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Show Desktop Name"), &(cfdata->show_name));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Desktop Name Position"), 0);
rg = e_widget_radio_group_new(&(cfdata->name_pos));
ob = e_widget_radio_add(evas, _("Top"), PAGER_DESKNAME_TOP, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Bottom"), PAGER_DESKNAME_BOTTOM, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
/* Not Supported Yet ??
ob = e_widget_radio_add(evas, _("Left"), PAGER_DESKNAME_LEFT, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Right"), PAGER_DESKNAME_RIGHT, rg);
e_widget_framelist_object_append(of, ob);
*/
return o; return o;
} }
static int static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Pager *p; pager_config->popup = cfdata->show_popup;
_pager_cb_config_updated();
p = cfd->data;
p->conf->popup = cfdata->show_popup;
p->conf->deskname_pos = cfdata->name_pos;
if (!cfdata->show_name)
p->conf->deskname_pos = PAGER_DESKNAME_NONE;
e_config_save_queue(); e_config_save_queue();
_pager_cb_config_updated(p);
return 1; return 1;
} }
@ -138,33 +95,14 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
E_Radio_Group *rg; E_Radio_Group *rg;
o = e_widget_list_add(evas, 0, 0); o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("General Settings"), 0); of = e_widget_framelist_add(evas, _("Resistance to Dragging Windows:"), 0);
ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Show Desktop Name"), &(cfdata->show_name));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Resistance to Dragging Windows:"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%.0f px"), 0.0, 10.0, 1.0, 0, NULL, &(cfdata->drag_resist), 200); ob = e_widget_slider_add(evas, 1, 0, _("%.0f px"), 0.0, 10.0, 1.0, 0, NULL, &(cfdata->drag_resist), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Desktop Name Position"), 0);
rg = e_widget_radio_group_new(&(cfdata->name_pos));
ob = e_widget_radio_add(evas, _("Top"), PAGER_DESKNAME_TOP, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Bottom"), PAGER_DESKNAME_BOTTOM, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
/* Not Supported Yet ??
ob = e_widget_radio_add(evas, _("Left"), PAGER_DESKNAME_LEFT, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Right"), PAGER_DESKNAME_RIGHT, rg);
e_widget_framelist_object_append(of, ob);
*/
of = e_widget_framelist_add(evas, _("Popup Settings"), 0); of = e_widget_framelist_add(evas, _("Popup Settings"), 0);
ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Popup Speed")); ob = e_widget_label_add(evas, _("Popup Speed"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.1, 10.0, 0.1, 0, &(cfdata->popup_speed), NULL, 200); ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.1, 10.0, 0.1, 0, &(cfdata->popup_speed), NULL, 200);
@ -177,21 +115,10 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
static int static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Pager *p; pager_config->popup = cfdata->show_popup;
pager_config->popup_speed = cfdata->popup_speed;
p = cfd->data; pager_config->drag_resist = cfdata->drag_resist;
e_border_button_bindings_ungrab_all(); _pager_cb_config_updated();
p->conf->popup = cfdata->show_popup;
p->conf->deskname_pos = cfdata->name_pos;
if (!cfdata->show_name)
p->conf->deskname_pos = PAGER_DESKNAME_NONE;
p->conf->popup_speed = cfdata->popup_speed;
p->conf->drag_resist = cfdata->drag_resist;
e_border_button_bindings_grab_all();
e_config_save_queue(); e_config_save_queue();
_pager_cb_config_updated(p);
return 1; return 1;
} }

View File

@ -1,8 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
#include "e_mod_main.h"
void _config_pager_module(E_Container *con, Pager *pager);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -5,12 +5,7 @@
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
typedef struct _Config Config; typedef struct _Config Config;
typedef struct _Config_Face Config_Face; typedef struct _Config_Item Config_Item;
typedef struct _Pager Pager;
typedef struct _Pager_Face Pager_Face;
typedef struct _Pager_Desk Pager_Desk;
typedef struct _Pager_Win Pager_Win;
typedef struct _Pager_Popup Pager_Popup;
#define PAGER_RESIZE_NONE 0 #define PAGER_RESIZE_NONE 0
#define PAGER_RESIZE_HORZ 1 #define PAGER_RESIZE_HORZ 1
@ -25,125 +20,24 @@ typedef struct _Pager_Popup Pager_Popup;
struct _Config struct _Config
{ {
Evas_List *faces; /* saved * loaded config values */
/* Position of desktop name */ double popup_speed;
unsigned int deskname_pos; unsigned int popup;
/* How the popup is shown on desk change */ unsigned int drag_resist;
double popup_speed; unsigned char scale;
/* Show popup? */ unsigned char resize;
unsigned int popup; Evas_List *items; /* FIXME: save/load this */
/* just config state */
unsigned int drag_resist;
};
struct _Config_Face
{
/* Show face */
unsigned char enabled;
/* Keep scale of desktops */
unsigned char scale;
/* Resize pager when adding/removing desktops */
unsigned char resize;
};
struct _Pager
{
Evas_List *faces;
E_Menu *config_menu;
E_Menu *config_menu_deskname;
E_Menu *config_menu_speed;
Evas_List *menus;
Config *conf;
Ecore_Event_Handler *ev_handler_border_resize;
Ecore_Event_Handler *ev_handler_border_move;
Ecore_Event_Handler *ev_handler_border_add;
Ecore_Event_Handler *ev_handler_border_remove;
Ecore_Event_Handler *ev_handler_border_iconify;
Ecore_Event_Handler *ev_handler_border_uniconify;
Ecore_Event_Handler *ev_handler_border_stick;
Ecore_Event_Handler *ev_handler_border_unstick;
Ecore_Event_Handler *ev_handler_border_desk_set;
Ecore_Event_Handler *ev_handler_border_stack;
Ecore_Event_Handler *ev_handler_border_icon_change;
Ecore_Event_Handler *ev_handler_zone_desk_count_set;
Ecore_Event_Handler *ev_handler_desk_show;
Ecore_Event_Handler *ev_handler_desk_name_change;
E_Config_Dialog *config_dialog; E_Config_Dialog *config_dialog;
}; Evas_List *instances;
struct _Pager_Face
{
Pager *pager;
E_Gadman_Client *gmc;
E_Menu *menu; E_Menu *menu;
Evas *evas; Evas_List *handlers;
E_Zone *zone;
Evas_List *desks;
Evas_Object *pager_object;
Evas_Object *table_object;
Evas_Coord fx, fy, fw, fh;
struct {
Evas_Coord l, r, t, b;
} inset;
/* Current nr. of desktops */
int xnum, ynum;
Config_Face *conf;
E_Drop_Handler *drop_handler;
Pager_Popup *current_popup;
unsigned char dragging:1;
}; };
struct _Pager_Desk struct _Config_Item
{ {
E_Desk *desk; char *id;
Pager_Face *face; int zone_num;
Evas_List *wins;
Evas_Object *desk_object;
Evas_Object *layout_object;
Evas_Object *event_object;
int xpos, ypos;
int current : 1;
};
struct _Pager_Win
{
E_Border *border;
Pager_Desk *desk;
Evas_Object *window_object;
Evas_Object *icon_object;
Evas_Object *event_object;
struct {
Pager_Face *from_face;
unsigned char start : 1;
unsigned char in_pager : 1;
unsigned char dnd : 1;
int x, y;
int dx, dy;
} drag;
};
struct _Pager_Popup
{
E_Popup *popup;
Pager_Face *src_face, *face;
Evas_Object *bg_object;
Ecore_Timer *timer;
}; };
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
@ -153,8 +47,9 @@ EAPI int e_modapi_shutdown (E_Module *module);
EAPI int e_modapi_save (E_Module *module); EAPI int e_modapi_save (E_Module *module);
EAPI int e_modapi_info (E_Module *module); EAPI int e_modapi_info (E_Module *module);
EAPI int e_modapi_about (E_Module *module); EAPI int e_modapi_about (E_Module *module);
EAPI int e_modapi_config (E_Module *module);
void _pager_cb_config_updated(void *data); void _pager_cb_config_updated(void);
void _config_pager_module(Config_Item *ci);
extern Config *pager_config;
#endif #endif

View File

@ -45,7 +45,6 @@ _gc_init(E_Gadcon *gc, char *name, char *id, char *style)
E_Gadcon_Client *gcc; E_Gadcon_Client *gcc;
Instance *inst; Instance *inst;
printf("CREATE START GADCON %s %s\n", name, id);
inst = E_NEW(Instance, 1); inst = E_NEW(Instance, 1);
o = edje_object_add(gc->evas); o = edje_object_add(gc->evas);
@ -59,13 +58,10 @@ _gc_init(E_Gadcon *gc, char *name, char *id, char *style)
inst->o_button = o; inst->o_button = o;
inst->main_menu = NULL; inst->main_menu = NULL;
e_gadcon_client_util_menu_attach(gcc);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_button_cb_mouse_down, inst); _button_cb_mouse_down, inst);
/* FIXME: add callback to resize - and based off one dimension, request
* another to be the same */
e_gadcon_client_size_request(gcc, 32, 32);
e_gadcon_client_min_size_set(gcc, 16, 16);
e_gadcon_client_aspect_set(gcc, 1, 1);
return gcc; return gcc;
} }
@ -75,6 +71,7 @@ _gc_shutdown(E_Gadcon_Client *gcc)
Instance *inst; Instance *inst;
inst = gcc->data; inst = gcc->data;
evas_object_del(inst->o_button);
free(inst); free(inst);
} }
@ -84,9 +81,8 @@ _gc_orient(E_Gadcon_Client *gcc)
Instance *inst; Instance *inst;
inst = gcc->data; inst = gcc->data;
printf("OREINT to %i\n", gcc->gadcon->orient); e_gadcon_client_aspect_set(gcc, 16, 16);
e_gadcon_client_aspect_set(gcc, 20, 20); e_gadcon_client_min_size_set(gcc, 16, 16);
e_gadcon_client_min_size_set(gcc, 20, 20);
} }
/**/ /**/
/***************************************************************************/ /***************************************************************************/
@ -105,15 +101,12 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{ {
Evas_Coord x, y, w, h; Evas_Coord x, y, w, h;
int cx, cy, cw, ch; int cx, cy, cw, ch;
E_Zone *zone;
evas_object_geometry_get(inst->o_button, &x, &y, &w, &h); evas_object_geometry_get(inst->o_button, &x, &y, &w, &h);
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
&cx, &cy, &cw, &ch);
x += cx; x += cx;
y += cy; y += cy;
zone = e_gadcon_zone_get(inst->gcc->gadcon);
if (!zone)
zone = e_util_zone_current_get(e_manager_current_get());
if (!inst->main_menu) if (!inst->main_menu)
inst->main_menu = e_int_menus_main_new(); inst->main_menu = e_int_menus_main_new();
if (inst->main_menu) if (inst->main_menu)
@ -152,7 +145,8 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
x, y, w, h, x, y, w, h,
dir, ev->timestamp); dir, ev->timestamp);
edje_object_signal_emit(inst->o_button, "active", ""); edje_object_signal_emit(inst->o_button, "active", "");
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, EVAS_BUTTON_NONE, ev->timestamp, NULL); evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
EVAS_BUTTON_NONE, ev->timestamp, NULL);
} }
} }
} }
@ -184,7 +178,7 @@ EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
{ {
e_gadcon_provider_register(&_gadcon_class); e_gadcon_provider_register(&_gadcon_class);
return NULL; return 1;
} }
EAPI int EAPI int
@ -217,11 +211,5 @@ e_modapi_about(E_Module *m)
_("Experimental Button module for E17")); _("Experimental Button module for E17"));
return 1; return 1;
} }
int
e_modapi_config(E_Module *m)
{
return 0;
}
/**/ /**/
/***************************************************************************/ /***************************************************************************/

View File

@ -1,7 +1,9 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifndef E_MOD_MAIN_H #ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
/* standard module api calls e looks for */
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
EAPI void *e_modapi_init (E_Module *m); EAPI void *e_modapi_init (E_Module *m);

View File

@ -20,8 +20,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h \
e_mod_config.c \ e_mod_config.c
e_mod_config.h
module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -3,8 +3,6 @@
*/ */
#include "e.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
/* celsius */ /* celsius */
#define TEMP_LOW_LOW 32 #define TEMP_LOW_LOW 32
@ -42,7 +40,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas,
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
void void
_config_temperature_module(E_Container *con, Temperature *temp) _config_temperature_module(void)
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Config_Dialog_View *v; E_Config_Dialog_View *v;
@ -56,22 +54,23 @@ _config_temperature_module(E_Container *con, Temperature *temp)
v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.apply_cfdata = _advanced_apply_data;
v->advanced.create_widgets = _advanced_create_widgets; v->advanced.create_widgets = _advanced_create_widgets;
cfd = e_config_dialog_new(con, _("Temperature Configuration"), NULL, 0, v, temp); cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
temp->config_dialog = cfd; _("Temperature Configuration"), NULL, 0, v, NULL);
temperature_config->config_dialog = cfd;
} }
static void static void
_fill_data(Temperature *t, E_Config_Dialog_Data *cfdata) _fill_data(E_Config_Dialog_Data *cfdata)
{ {
double p; double p;
cfdata->units = t->conf->units; cfdata->units = temperature_config->units;
if (t->conf->units == CELCIUS) if (temperature_config->units == CELCIUS)
cfdata->unit_method = 0; cfdata->unit_method = 0;
else else
cfdata->unit_method = 1; cfdata->unit_method = 1;
p = t->conf->poll_time; p = temperature_config->poll_time;
cfdata->poll_time = p; cfdata->poll_time = p;
if ((p >= 0) && (p <= 5)) if ((p >= 0) && (p <= 5))
cfdata->poll_method = 1; //Fast cfdata->poll_method = 1; //Fast
@ -82,7 +81,7 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata)
else if (p > 30) else if (p > 30)
cfdata->poll_method = 60; //Very Slow cfdata->poll_method = 60; //Very Slow
p = t->conf->low; p = temperature_config->low;
if (cfdata->units == FAHRENHEIT) if (cfdata->units == FAHRENHEIT)
p = FAR_2_CEL(p - 1); // -1 so the conversion doesn't make mid go hi p = FAR_2_CEL(p - 1); // -1 so the conversion doesn't make mid go hi
cfdata->low_temp = p; cfdata->low_temp = p;
@ -93,7 +92,7 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata)
else if (p > TEMP_LOW_MID) else if (p > TEMP_LOW_MID)
cfdata->low_method = TEMP_LOW_HIGH; cfdata->low_method = TEMP_LOW_HIGH;
p = t->conf->high; p = temperature_config->high;
if (cfdata->units == FAHRENHEIT) if (cfdata->units == FAHRENHEIT)
p = FAR_2_CEL(p - 1); p = FAR_2_CEL(p - 1);
cfdata->high_temp = p; cfdata->high_temp = p;
@ -104,11 +103,11 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata)
else if (p > TEMP_HIGH_MID) else if (p > TEMP_HIGH_MID)
cfdata->high_method = TEMP_HIGH_HIGH; cfdata->high_method = TEMP_HIGH_HIGH;
if (!strcmp(t->conf->sensor_name, "temp1")) if (!strcmp(temperature_config->sensor_name, "temp1"))
cfdata->sensor = 0; cfdata->sensor = 0;
else if (!strcmp(t->conf->sensor_name, "temp2")) else if (!strcmp(temperature_config->sensor_name, "temp2"))
cfdata->sensor = 1; cfdata->sensor = 1;
else if (!strcmp(t->conf->sensor_name, "temp3")) else if (!strcmp(temperature_config->sensor_name, "temp3"))
cfdata->sensor = 2; cfdata->sensor = 2;
} }
@ -116,21 +115,16 @@ static void *
_create_data(E_Config_Dialog *cfd) _create_data(E_Config_Dialog *cfd)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
Temperature *t;
t = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(t, cfdata); _fill_data(cfdata);
return cfdata; return cfdata;
} }
static void static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Temperature *t; temperature_config->config_dialog = NULL;
t = cfd->data;
t->config_dialog = NULL;
free(cfdata); free(cfdata);
} }
@ -217,33 +211,23 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
static int static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Temperature *t;
t = cfd->data;
e_border_button_bindings_ungrab_all();
if (cfdata->unit_method == 0) if (cfdata->unit_method == 0)
t->conf->units = CELCIUS; temperature_config->units = CELCIUS;
else else
t->conf->units = FAHRENHEIT; temperature_config->units = FAHRENHEIT;
temperature_config->poll_time = (double)cfdata->poll_method;
t->conf->poll_time = (double)cfdata->poll_method; if (temperature_config->units == FAHRENHEIT)
if (t->conf->units == FAHRENHEIT)
{ {
t->conf->low = CEL_2_FAR(cfdata->low_method); temperature_config->low = CEL_2_FAR(cfdata->low_method);
t->conf->high = CEL_2_FAR(cfdata->high_method); temperature_config->high = CEL_2_FAR(cfdata->high_method);
} }
else else
{ {
t->conf->low = cfdata->low_method; temperature_config->low = cfdata->low_method;
t->conf->high = cfdata->high_method; temperature_config->high = cfdata->high_method;
} }
_temperature_face_cb_config_updated();
e_border_button_bindings_grab_all();
e_config_save_queue(); e_config_save_queue();
/* Call Config Update */
_temperature_face_cb_config_updated(t);
return 1; return 1;
} }
@ -252,9 +236,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
{ {
Evas_Object *o, *of, *ob; Evas_Object *o, *of, *ob;
E_Radio_Group *rg; E_Radio_Group *rg;
Temperature *t;
t = cfd->data;
o = e_widget_list_add(evas, 0, 0); o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("Display Units"), 0); of = e_widget_framelist_add(evas, _("Display Units"), 0);
@ -312,10 +293,10 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
cfdata->low_temp = t->conf->low; // cfdata->low_temp = temperature_config->low;
cfdata->high_temp = t->conf->high; // cfdata->high_temp = temperature_config->high;
if (t->conf->units == FAHRENHEIT) if (cfdata->units == FAHRENHEIT)
{ {
/* round-off to closest 5 */ /* round-off to closest 5 */
if (cfdata->high_temp % 5 > 3) if (cfdata->high_temp % 5 > 3)
@ -357,14 +338,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
static int static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Temperature *t; if (cfdata->unit_method != temperature_config->units)
t = cfd->data;
e_border_button_bindings_ungrab_all();
/* Check if Display Units has been toggled */
if (cfdata->unit_method != t->conf->units)
{ {
if (cfdata->unit_method == 0) if (cfdata->unit_method == 0)
{ {
@ -377,35 +351,29 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
cfdata->low_temp = CEL_2_FAR(cfdata->low_temp); cfdata->low_temp = CEL_2_FAR(cfdata->low_temp);
} }
} }
if (cfdata->unit_method == 0) if (cfdata->unit_method == 0)
t->conf->units = CELCIUS; temperature_config->units = CELCIUS;
else else
t->conf->units = FAHRENHEIT; temperature_config->units = FAHRENHEIT;
temperature_config->poll_time = cfdata->poll_time;
t->conf->poll_time = cfdata->poll_time; temperature_config->low = cfdata->low_temp;
temperature_config->high = cfdata->high_temp;
t->conf->low = cfdata->low_temp; if (temperature_config->sensor_name)
t->conf->high = cfdata->high_temp; evas_stringshare_del(temperature_config->sensor_name);
temperature_config->sensor_name = NULL;
switch (cfdata->sensor) switch (cfdata->sensor)
{ {
case 0: case 0:
t->conf->sensor_name = strdup("temp1"); temperature_config->sensor_name = evas_stringshare_add("temp1");
break; break;
case 1: case 1:
t->conf->sensor_name = strdup("temp2"); temperature_config->sensor_name = evas_stringshare_add("temp2");
break; break;
case 2: case 2:
t->conf->sensor_name = strdup("temp3"); temperature_config->sensor_name = evas_stringshare_add("temp3");
break; break;
} }
_temperature_face_cb_config_updated();
e_border_button_bindings_grab_all();
e_config_save_queue(); e_config_save_queue();
/* Call Config Update */
_temperature_face_cb_config_updated(t);
return 1; return 1;
} }

View File

@ -1,8 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
#include "e_mod_main.h"
void _config_temperature_module(E_Container *con, Temperature *temp);
#endif
#endif

View File

@ -3,255 +3,153 @@
*/ */
#include "e.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
/* TODO List: /***************************************************************************/
* /**/
* which options should be in main menu, and which in face menu? /* gadcon requirements */
*/ static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
/* module private routines */ static void _gc_orient(E_Gadcon_Client *gcc);
static Temperature *_temperature_new(); /* and actually define the gadcon class that this module provides (just 1) */
static void _temperature_free(Temperature *e); static const E_Gadcon_Client_Class _gadcon_class =
static int _temperature_cb_check(void *data);
static void _temperature_face_init(void *data, E_Gadget_Face *face);
static void _temperature_face_free(void *data, E_Gadget_Face *face);
static void _temperature_face_level_set(E_Gadget_Face *face, double level);
static E_Config_DD *conf_edd;
static E_Config_DD *conf_face_edd;
/* public module routines. all modules must have these */
EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, GADCON_CLIENT_CLASS_VERSION,
"Temperature" "temperature",
{
_gc_init, _gc_shutdown, _gc_orient
}
};
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/* actual module specifics */
typedef struct _Instance Instance;
struct _Instance
{
E_Gadcon_Client *gcc;
Evas_Object *o_temp;
}; };
EAPI void * static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
e_modapi_init(E_Module *m) static void _menu_cb_post(void *data, E_Menu *m);
static int _temperature_cb_check(void *data);
static void _temperature_face_level_set(Instance *inst, double level);
static void _temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
static E_Config_DD *conf_edd = NULL;
Config *temperature_config = NULL;
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, char *name, char *id, char *style)
{ {
E_Gadget *gad = NULL; Evas_Object *o;
E_Gadget_Api *api; E_Gadcon_Client *gcc;
Temperature *e; Instance *inst;
e = _temperature_new();
/* set up our actual gadget */
api = E_NEW(E_Gadget_Api, 1);
api->module = m;
api->name = "temperature";
api->func_face_init = _temperature_face_init;
api->func_face_free = _temperature_face_free;
api->data = e;
gad = e_gadget_new(api);
E_FREE(api);
/* start the timer */
e->gad = gad;
e->temperature_check_timer = ecore_timer_add(e->conf->poll_time, _temperature_cb_check, gad);
return gad;
}
EAPI int
e_modapi_shutdown(E_Module *m)
{
E_Gadget *gad;
Temperature *e;
E_CONFIG_DD_FREE(conf_edd);
E_CONFIG_DD_FREE(conf_face_edd);
gad = m->data;
if (!gad) return 0;
e = gad->data;
if (e)
{
if (e->config_dialog)
{
e_object_del(E_OBJECT(e->config_dialog));
e->config_dialog = NULL;
}
_temperature_free(e);
}
e_object_del(E_OBJECT(gad));
return 1;
}
EAPI int
e_modapi_save(E_Module *m)
{
E_Gadget *gad;
Temperature *e;
gad = m->data;
if (!gad) return 0;
e = gad->data;
if (!e) return 0;
e_config_domain_save("module.temperature", conf_edd, e->conf);
return 1;
}
EAPI int
e_modapi_info(E_Module *m)
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
m->icon_file = strdup(buf);
return 1;
}
EAPI int
e_modapi_about(E_Module *m)
{
e_module_dialog_show(_("Enlightenment Temperature Module"),
_("A module to measure the <hilight>ACPI Thermal sensor</hilight> on Linux.<br>"
"It is especially useful for modern Laptops with high speed<br>"
"CPUs that generate a lot of heat."));
return 1;
}
EAPI int
e_modapi_config(E_Module *m)
{
E_Gadget *gad;
Temperature *e;
gad = m->data; inst = E_NEW(Instance, 1);
if (!gad) return 0;
e = gad->data; o = edje_object_add(gc->evas);
_config_temperature_module(e_container_current_get(e_manager_current_get()), e); e_theme_edje_object_set(o, "base/theme/modules/temperature",
return 1;
}
/* module private routines */
static Temperature *
_temperature_new()
{
Temperature *e;
e = E_NEW(Temperature, 1);
if (!e) return NULL;
/* create the config edd */
conf_face_edd = E_CONFIG_DD_NEW("Temperature_Config_Face", Config_Face);
#undef T
#undef D
#define T Config_Face
#define D conf_face_edd
E_CONFIG_VAL(D, T, enabled, UCHAR);
conf_edd = E_CONFIG_DD_NEW("Temperature_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
E_CONFIG_VAL(D, T, poll_time, DOUBLE);
E_CONFIG_VAL(D, T, low, INT);
E_CONFIG_VAL(D, T, high, INT);
E_CONFIG_LIST(D, T, faces, conf_face_edd);
E_CONFIG_VAL(D, T, sensor_name, STR);
E_CONFIG_VAL(D, T, units, INT);
e->conf = e_config_domain_load("module.temperature", conf_edd);
if (!e->conf)
{
e->conf = E_NEW(Config, 1);
e->conf->poll_time = 10.0;
e->conf->low = 30;
e->conf->high = 80;
e->conf->sensor_name = "temp1";
e->conf->units = CELCIUS;
}
E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
E_CONFIG_LIMIT(e->conf->low, 0, 100);
E_CONFIG_LIMIT(e->conf->high, 0, 220);
E_CONFIG_LIMIT(e->conf->units, CELCIUS, FAHRENHEIT);
e->have_temp = -1;
return e;
}
void _temperature_face_init(void *data, E_Gadget_Face *face)
{
Temperature *e;
Temperature_Face *ef;
E_Gadman_Policy policy;
e = data;
ef = E_NEW(Temperature_Face, 1);
if (!ef) return;
e_gadget_face_theme_set(face, "base/theme/modules/temperature",
"modules/temperature/main"); "modules/temperature/main");
gcc = e_gadcon_client_new(gc, name, id, style, o);
gcc->data = inst;
inst->gcc = gcc;
inst->o_temp = o;
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_button_cb_mouse_down, inst);
temperature_config->instances = evas_list_append(temperature_config->instances, inst);
temperature_config->have_temp = -1;
_temperature_cb_check(NULL);
return gcc;
}
policy = E_GADMAN_POLICY_ANYWHERE | static void
E_GADMAN_POLICY_HMOVE | _gc_shutdown(E_Gadcon_Client *gcc)
E_GADMAN_POLICY_VMOVE | {
E_GADMAN_POLICY_HSIZE | Instance *inst;
E_GADMAN_POLICY_VSIZE;
inst = gcc->data;
temperature_config->instances = evas_list_remove(temperature_config->instances, inst);
evas_object_del(inst->o_temp);
free(inst);
}
e_gadman_client_policy_set(face->gmc, policy); static void
_gc_orient(E_Gadcon_Client *gcc)
{
Instance *inst;
inst = gcc->data;
e_gadcon_client_aspect_set(gcc, 16, 16);
e_gadcon_client_min_size_set(gcc, 16, 16);
}
/**/
/***************************************************************************/
ef->conf = evas_list_nth(e->conf->faces, face->face_num); /***************************************************************************/
if (!ef->conf) /**/
static void
_button_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 == 3) && (!temperature_config->menu))
{ {
ef->conf = E_NEW(Config_Face, 1); E_Menu *mn;
ef->conf->enabled = 1; E_Menu_Item *mi;
e->conf->faces = evas_list_append(e->conf->faces, ef->conf); int cx, cy, cw, ch;
mn = e_menu_new();
e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst);
temperature_config->menu = mn;
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Configuration"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
e_menu_item_callback_set(mi, _temperature_face_cb_menu_configure, NULL);
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()),
cx + ev->output.x, cy + ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
EVAS_BUTTON_NONE, ev->timestamp, NULL);
} }
face->data = ef;
_temperature_cb_check(face->gad);
return;
} }
static void static void
_temperature_free(Temperature *e) _menu_cb_post(void *data, E_Menu *m)
{ {
Evas_List *l; if (!temperature_config->menu) return;
e_object_del(E_OBJECT(temperature_config->menu));
ecore_timer_del(e->temperature_check_timer); temperature_config->menu = NULL;
for (l = e->conf->faces; l; l = l->next)
free(l->data);
evas_list_free(e->conf->faces);
free(e->conf);
free(e);
}
static void
_temperature_face_free(void *data, E_Gadget_Face *face)
{
Temperature_Face *ef;
ef = face->data;
free(ef);
} }
static int static int
_temperature_cb_check(void *data) _temperature_cb_check(void *data)
{ {
E_Gadget *gad;
E_Gadget_Face *face;
Temperature *t;
int ret = 0; int ret = 0;
Instance *inst;
Ecore_List *therms; Ecore_List *therms;
Evas_List *l; Evas_List *l;
int temp = 0; int temp = 0;
@ -261,11 +159,6 @@ _temperature_cb_check(void *data)
int len; int len;
#endif #endif
gad = data;
if (!gad) return 0;
t = gad->data;
if (!t) return 0;
#ifdef __FreeBSD__ #ifdef __FreeBSD__
if (mib[0] == -1) if (mib[0] == -1)
{ {
@ -305,7 +198,7 @@ _temperature_cb_check(void *data)
{ {
char *name, *sensor; char *name, *sensor;
sensor = t->conf->sensor_name; sensor = temperature_config->sensor_name;
if (!sensor) sensor = "temp1"; if (!sensor) sensor = "temp1";
while ((name = ecore_list_next(therms))) while ((name = ecore_list_next(therms)))
@ -370,77 +263,183 @@ _temperature_cb_check(void *data)
} }
#endif #endif
if (t->conf->units == FAHRENHEIT) if (temperature_config->units == FAHRENHEIT)
temp = (temp * 9.0 / 5.0) + 32; temp = (temp * 9.0 / 5.0) + 32;
if (ret) if (ret)
{ {
char *utf8; char *utf8;
if (t->have_temp != 1) if (temperature_config->have_temp != 1)
{ {
/* enable therm object */ /* enable therm object */
for (l = gad->faces; l; l = l->next) for (l = temperature_config->instances; l; l = l->next)
{ {
face = l->data; inst = l->data;
edje_object_signal_emit(face->main_obj, "known", ""); edje_object_signal_emit(inst->o_temp, "known", "");
} }
t->have_temp = 1; temperature_config->have_temp = 1;
} }
if (t->conf->units == FAHRENHEIT) if (temperature_config->units == FAHRENHEIT)
snprintf(buf, sizeof(buf), "%i°F", temp); snprintf(buf, sizeof(buf), "%i°F", temp);
else else
snprintf(buf, sizeof(buf), "%i°C", temp); snprintf(buf, sizeof(buf), "%i°C", temp);
utf8 = ecore_txt_convert("iso-8859-1", "utf-8", buf); utf8 = ecore_txt_convert("iso-8859-1", "utf-8", buf);
for (l = gad->faces; l; l = l->next) for (l = temperature_config->instances; l; l = l->next)
{ {
face = l->data; inst = l->data;
_temperature_face_level_set(face, _temperature_face_level_set(inst,
(double)(temp - t->conf->low) / (double)(temp - temperature_config->low) /
(double)(t->conf->high - t->conf->low)); (double)(temperature_config->high - temperature_config->low));
edje_object_part_text_set(inst->o_temp, "reading", utf8);
edje_object_part_text_set(face->main_obj, "reading", utf8);
} }
free(utf8); free(utf8);
} }
else else
{ {
if (t->have_temp != 0) if (temperature_config->have_temp != 0)
{ {
/* disable therm object */ /* disable therm object */
for (l = gad->faces; l; l = l->next) for (l = temperature_config->instances; l; l = l->next)
{ {
face = l->data; inst = l->data;
edje_object_signal_emit(face->main_obj, "unknown", ""); edje_object_signal_emit(inst->o_temp, "unknown", "");
edje_object_part_text_set(face->main_obj, "reading", "NO TEMP"); edje_object_part_text_set(inst->o_temp, "reading", "NO TEMP");
_temperature_face_level_set(face, 0.5); _temperature_face_level_set(inst, 0.5);
} }
t->have_temp = 0; temperature_config->have_temp = 0;
} }
} }
return 1; return 1;
} }
static void static void
_temperature_face_level_set(E_Gadget_Face *face, double level) _temperature_face_level_set(Instance *inst, double level)
{ {
Edje_Message_Float msg; Edje_Message_Float msg;
if (level < 0.0) level = 0.0; if (level < 0.0) level = 0.0;
else if (level > 1.0) level = 1.0; else if (level > 1.0) level = 1.0;
msg.val = level; msg.val = level;
edje_object_message_send(face->main_obj, EDJE_MESSAGE_FLOAT, 1, &msg); edje_object_message_send(inst->o_temp, EDJE_MESSAGE_FLOAT, 1, &msg);
}
static void
_temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
{
if (!temperature_config) return;
if (temperature_config->config_dialog) return;
_config_temperature_module();
} }
void void
_temperature_face_cb_config_updated(Temperature *temp) _temperature_face_cb_config_updated(void)
{ {
/* Call all funcs needed to handle update */ ecore_timer_del(temperature_config->temperature_check_timer);
ecore_timer_del(temp->temperature_check_timer); temperature_config->temperature_check_timer =
temp->temperature_check_timer = ecore_timer_add(temp->conf->poll_time, _temperature_cb_check, temp->gad); ecore_timer_add(temperature_config->poll_time, _temperature_cb_check,
NULL);
} }
/***************************************************************************/
/**/
/* module setup */
EAPI E_Module_Api e_modapi =
{
E_MODULE_API_VERSION,
"Temperature"
};
EAPI void *
e_modapi_init(E_Module *m)
{
conf_edd = E_CONFIG_DD_NEW("Temperature_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
E_CONFIG_VAL(D, T, poll_time, DOUBLE);
E_CONFIG_VAL(D, T, low, INT);
E_CONFIG_VAL(D, T, high, INT);
E_CONFIG_VAL(D, T, sensor_name, STR);
E_CONFIG_VAL(D, T, units, INT);
temperature_config = e_config_domain_load("module.temperature", conf_edd);
if (!temperature_config)
{
temperature_config = E_NEW(Config, 1);
temperature_config->poll_time = 10.0;
temperature_config->low = 30;
temperature_config->high = 80;
temperature_config->sensor_name = evas_stringshare_add("temp1");
temperature_config->units = CELCIUS;
}
E_CONFIG_LIMIT(temperature_config->poll_time, 0.5, 1000.0);
E_CONFIG_LIMIT(temperature_config->low, 0, 100);
E_CONFIG_LIMIT(temperature_config->high, 0, 220);
E_CONFIG_LIMIT(temperature_config->units, CELCIUS, FAHRENHEIT);
temperature_config->have_temp = -1;
temperature_config->temperature_check_timer =
ecore_timer_add(temperature_config->poll_time, _temperature_cb_check,
NULL);
e_gadcon_provider_register(&_gadcon_class);
return 1;
}
EAPI int
e_modapi_shutdown(E_Module *m)
{
e_gadcon_provider_unregister(&_gadcon_class);
if (temperature_config->config_dialog)
e_object_del(E_OBJECT(temperature_config->config_dialog));
if (temperature_config->temperature_check_timer)
ecore_timer_del(temperature_config->temperature_check_timer);
if (temperature_config->sensor_name)
evas_stringshare_del(temperature_config->sensor_name);
free(temperature_config);
temperature_config = NULL;
E_CONFIG_DD_FREE(conf_edd);
return 1;
}
EAPI int
e_modapi_save(E_Module *m)
{
e_config_domain_save("module.temperature", conf_edd, temperature_config);
return 1;
}
EAPI int
e_modapi_info(E_Module *m)
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
m->icon_file = strdup(buf);
return 1;
}
EAPI int
e_modapi_about(E_Module *m)
{
e_module_dialog_show(_("Enlightenment Temperature Module"),
_("A module to measure the <hilight>ACPI Thermal sensor</hilight> on Linux.<br>"
"It is especially useful for modern Laptops with high speed<br>"
"CPUs that generate a lot of heat."));
return 1;
}
EAPI int
e_modapi_config(E_Module *m)
{
if (!temperature_config) return 0;
if (temperature_config->config_dialog) return 0;
_config_temperature_module();
return 1;
}
/**/
/***************************************************************************/

View File

@ -5,9 +5,6 @@
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
typedef struct _Config Config; typedef struct _Config Config;
typedef struct _Config_Face Config_Face;
typedef struct _Temperature Temperature;
typedef struct _Temperature_Face Temperature_Face;
typedef enum _Unit typedef enum _Unit
{ {
@ -17,32 +14,17 @@ typedef enum _Unit
struct _Config struct _Config
{ {
double poll_time; /* saved * loaded config values */
int low, high; double poll_time;
Evas_List *faces; int low, high;
char *sensor_name; char *sensor_name;
Unit units; Unit units;
}; /* just config state */
E_Config_Dialog *config_dialog;
struct _Config_Face Evas_List *instances;
{ E_Menu *menu;
unsigned char enabled; Ecore_Timer *temperature_check_timer;
};
struct _Temperature
{
Config *conf;
Ecore_Timer *temperature_check_timer;
E_Config_Dialog *config_dialog;
unsigned char have_temp; unsigned char have_temp;
E_Gadget *gad;
};
struct _Temperature_Face
{
Temperature *temp;
Config_Face *conf;
}; };
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
@ -54,6 +36,9 @@ EAPI int e_modapi_info (E_Module *m);
EAPI int e_modapi_about (E_Module *m); EAPI int e_modapi_about (E_Module *m);
EAPI int e_modapi_config (E_Module *m); EAPI int e_modapi_config (E_Module *m);
void _temperature_face_cb_config_updated(Temperature *temp); void _config_temperature_module(void);
void _temperature_face_cb_config_updated(void);
extern Config *temperature_config;
#endif #endif