create a different layout, when forecasts is used within gadman

SVN revision: 36873
This commit is contained in:
Viktor Kojouharov 2008-10-20 20:03:42 +00:00
parent e8ed909924
commit 2b8ed436ff
2 changed files with 515 additions and 81 deletions

View File

@ -75,8 +75,7 @@ struct _Instance
} astronomy;
} details;
struct
{
struct {
char day[4];
char date[12];
int low, high, code;
@ -147,7 +146,7 @@ _gc_init(E_Gadcon * gc, const char *name, const char *id, const char *style)
inst = E_NEW(Instance, 1);
inst->ci = _forecasts_config_item_get(id);
inst->area = evas_stringshare_add(inst->ci->code);
inst->area = eina_stringshare_add(inst->ci->code);
w = _forecasts_new(gc->evas);
w->inst = inst;
@ -187,7 +186,7 @@ _gc_init(E_Gadcon * gc, const char *name, const char *id, const char *style)
evas_object_event_callback_add(w->forecasts_obj, EVAS_CALLBACK_MOUSE_DOWN,
_forecasts_cb_mouse_down, inst);
forecasts_config->instances =
evas_list_append(forecasts_config->instances, inst);
eina_list_append(forecasts_config->instances, inst);
_forecasts_cb_check(inst);
inst->check_timer =
@ -216,11 +215,11 @@ _gc_shutdown(E_Gadcon_Client * gcc)
if (inst->server)
ecore_con_server_del(inst->server);
if (inst->area)
evas_stringshare_del(inst->area);
eina_stringshare_del(inst->area);
inst->server = NULL;
forecasts_config->instances =
evas_list_remove(forecasts_config->instances, inst);
eina_list_remove(forecasts_config->instances, inst);
evas_object_event_callback_del(w->forecasts_obj, EVAS_CALLBACK_MOUSE_DOWN,
_forecasts_cb_mouse_down);
@ -235,8 +234,20 @@ _gc_orient(E_Gadcon_Client * gcc)
Instance *inst;
inst = gcc->data;
switch (gcc->gadcon->orient)
{
case E_GADCON_ORIENT_FLOAT:
edje_object_signal_emit(inst->forecasts_obj, "e,state,orientation,float", "e");
e_gadcon_client_aspect_set(gcc, 64, 32);
e_gadcon_client_min_size_set(gcc, 64, 32);
break;
default:
edje_object_signal_emit(inst->forecasts_obj, "e,state,orientation,default", "e");
e_gadcon_client_aspect_set(gcc, 16, 16);
e_gadcon_client_min_size_set(gcc, 16, 16);
break;
}
}
static char *
@ -327,7 +338,7 @@ _forecasts_menu_cb_configure(void *data, E_Menu * m, E_Menu_Item * mi)
static Config_Item *
_forecasts_config_item_get(const char *id)
{
Evas_List *l;
Eina_List *l;
Config_Item *ci;
char buf[128];
@ -339,7 +350,7 @@ _forecasts_config_item_get(const char *id)
if (forecasts_config->items)
{
const char *p;
ci = evas_list_last(forecasts_config->items)->data;
ci = eina_list_last(forecasts_config->items)->data;
p = strrchr(ci->id, '.');
if (p) num = atoi(p + 1) + 1;
}
@ -359,15 +370,15 @@ _forecasts_config_item_get(const char *id)
}
ci = E_NEW(Config_Item, 1);
ci->id = evas_stringshare_add(id);
ci->id = eina_stringshare_add(id);
ci->poll_time = 60.0;
ci->degrees = DEGREES_C;
ci->host = evas_stringshare_add("xml.weather.yahoo.com");
ci->code = evas_stringshare_add("BUXX0005");
ci->host = eina_stringshare_add("xml.weather.yahoo.com");
ci->code = eina_stringshare_add("BUXX0005");
ci->show_text = 1;
ci->popup_on_hover = 1;
forecasts_config->items = evas_list_append(forecasts_config->items, ci);
forecasts_config->items = eina_list_append(forecasts_config->items, ci);
return ci;
}
@ -416,13 +427,13 @@ e_modapi_init(E_Module * m)
ci = E_NEW(Config_Item, 1);
ci->poll_time = 60.0;
ci->degrees = DEGREES_C;
ci->host = evas_stringshare_add("xml.weather.yahoo.com");
ci->code = evas_stringshare_add("BUXX0005");
ci->id = evas_stringshare_add("0");
ci->host = eina_stringshare_add("xml.weather.yahoo.com");
ci->code = eina_stringshare_add("BUXX0005");
ci->id = eina_stringshare_add("0");
ci->show_text = 1;
ci->popup_on_hover = 1;
forecasts_config->items = evas_list_append(forecasts_config->items, ci);
forecasts_config->items = eina_list_append(forecasts_config->items, ci);
}
_forecasts_get_proxy();
@ -452,13 +463,13 @@ e_modapi_shutdown(E_Module * m)
ci = forecasts_config->items->data;
if (ci->id)
evas_stringshare_del(ci->id);
eina_stringshare_del(ci->id);
if (ci->host)
evas_stringshare_del(ci->host);
eina_stringshare_del(ci->host);
if (ci->code)
evas_stringshare_del(ci->code);
eina_stringshare_del(ci->code);
forecasts_config->items =
evas_list_remove_list(forecasts_config->items, forecasts_config->items);
eina_list_remove_list(forecasts_config->items, forecasts_config->items);
free(ci);
ci = NULL;
}
@ -537,8 +548,8 @@ _forecasts_get_proxy(void)
}
if ((host) && (port))
{
if (proxy.host) evas_stringshare_del(proxy.host);
proxy.host = evas_stringshare_add(host);
if (proxy.host) eina_stringshare_del(proxy.host);
proxy.host = eina_stringshare_add(host);
proxy.port = port;
}
free(env);
@ -896,6 +907,34 @@ _forecasts_display_set(Instance * inst, int ok)
edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.temp", buf);
edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.description",
inst->condition.desc);
edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.location", inst->location);
if (inst->gcc->gadcon->orient == E_GADCON_ORIENT_FLOAT)
{
char buf[4096], name[60];
int i;
for (i = 0; i < FORECASTS; i++)
{
snprintf(name, sizeof(name), "e.text.day%d.date", i);
edje_object_part_text_set(inst->forecasts->forecasts_obj, name, inst->forecast[i].date);
snprintf(name, sizeof(name), "e.text.day%d.desc", i);
edje_object_part_text_set(inst->forecasts->forecasts_obj, name, inst->forecast[i].desc);
snprintf(name, sizeof(name), "e.text.day%d.high", i);
snprintf(buf, sizeof(buf), "%d°%c", inst->forecast[i].high, inst->units.temp);
edje_object_part_text_set(inst->forecasts->forecasts_obj, name, buf);
snprintf(name, sizeof(name), "e.text.day%d.low", i);
snprintf(buf, sizeof(buf), "%d°%c", inst->forecast[i].low, inst->units.temp);
edje_object_part_text_set(inst->forecasts->forecasts_obj, name, buf);
snprintf(name, sizeof(name), "e.swallow.day%d.icon", i);
edje_object_part_swallow(inst->forecasts->forecasts_obj, name,
_forecasts_popup_icon_create(inst->gcc->gadcon->evas, inst->forecast[i].code));
}
}
if (inst->popup) _forecasts_popup_destroy(inst);
inst->popup = NULL;
@ -904,7 +943,7 @@ _forecasts_display_set(Instance * inst, int ok)
void
_forecasts_config_updated(Config_Item *ci)
{
Evas_List *l;
Eina_List *l;
char buf[4096];
if (!forecasts_config)
@ -920,8 +959,8 @@ _forecasts_config_updated(Config_Item *ci)
if (inst->area && strcmp(inst->area, inst->ci->code))
area_changed = 1;
if (inst->area) evas_stringshare_del(inst->area);
inst->area = evas_stringshare_add(inst->ci->code);
if (inst->area) eina_stringshare_del(inst->area);
inst->area = eina_stringshare_add(inst->ci->code);
_forecasts_converter(inst);
if (inst->popup) _forecasts_popup_destroy(inst);
@ -1030,7 +1069,8 @@ _forecasts_popup_content_create(Instance *inst)
e_widget_list_object_append(o, of, 1, 1, 0.5);
ol = e_widget_list_add(evas, 1, 1);
for (i = 0; i < FORECASTS; i++) {
for (i = 0; i < FORECASTS; i++)
{
int row = 0;
snprintf(buf, sizeof(buf), "%s", inst->forecast[i].date);

View File

@ -3,6 +3,22 @@ fonts {
font: "VeraBd.ttf" "Vera Bold";
}
#define ORIENT_TARGETS \
target: "day0"; \
target: "day1"; \
target: "icon"; \
target: "e.text.location"; \
target: "e.text.temp"; \
target: "e.text.description"; \
target: "e.text.day0.date"; \
target: "e.swallow.day0.icon"; \
target: "e.text.day0.high"; \
target: "e.text.day0.low"; \
target: "e.text.day1.date"; \
target: "e.swallow.day1.icon"; \
target: "e.text.day1.high"; \
target: "e.text.day1.low"; \
#define FORECASTS_ICON(icon_code, minw, minh, maxw, maxh, a) \
images { \
image: icon_code".png" COMP; \
@ -66,6 +82,18 @@ collections {
}
//color: 0 0 0 0;
}
description {
state: "float" 0.0;
inherit: "default" 0.0;
aspect: 1.0 1.0;
rel1 {
relative: 0.0 0.0;
}
rel2 {
relative: 0.6 1.0;
offset: 2 2;
}
}
}
part {
name: "e.text.temp";
@ -89,7 +117,7 @@ collections {
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "";
text: "TEMPERATURE";
font: "Vera Bold";
size: 10;
min: 1 1;
@ -97,6 +125,19 @@ collections {
text_class: "module_large";
}
}
description {
state: "float" 0.0;
inherit: "default" 0.0;
rel1 {
relative: 0.0 1.0;
offset: 2 -20;
}
rel2 {
relative: 1.0 1.0;
offset: -2 -2;
}
text.align: 0.5 1.0;
}
}
part {
name: "e.text.description";
@ -119,7 +160,7 @@ collections {
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "";
text: "DESCRIPTION";
font: "Vera Bold";
size: 8;
min: 1 1;
@ -132,6 +173,345 @@ collections {
inherit: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
inherit: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: -2 -2;
to: "e.text.temp";
}
rel2 {
relative: 1.0 0.0;
offset: -2 -2;
to: "e.text.temp";
}
}
}
part {
name: "e.text.location";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 0.2;
offset: 1 1;
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "LOCATION";
font: "Vera Bold";
size: 10;
min: 1 1;
align: 0.0 0.0;
text_class: "module_normal";
}
}
}
part {
name: "day0";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
color: 0 0 0 0;
rel1 {
relative: 0.6 0.0;
offset: 1 1;
}
rel2 {
relative: 1.0 0.5;
offset: -5 -5;
}
}
}
part {
name: "e.text.day0.date";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 0.0;
offset: 1 1;
to: "day0";
}
rel2 {
relative: 1.0 0.0;
offset: 1 30;
to: "day0";
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "DATE0";
font: "Vera Bold";
size: 10;
min: 1 1;
align: 0.5 0.0;
text_class: "module_normal";
}
}
}
part {
name: "e.swallow.day0.icon";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
to: "day0";
}
rel2 {
to: "day0";
}
}
}
part {
name: "e.text.day0.low";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 1.0;
offset: 1 -14;
to: "day0";
}
rel2 {
relative: 0.0 1.0;
offset: -1 -1;
to: "day0";
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "LOW0";
font: "Vera Bold";
size: 8;
min: 1 1;
align: 0.0 0.0;
text_class: "module_normal";
}
}
}
part {
name: "e.text.day0.high";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 1.0;
offset: 0 -14;
to: "day0";
}
rel2 {
relative: 1.0 1.0;
to: "day0";
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "HIGH0";
font: "Vera Bold";
size: 8;
min: 1 1;
align: 1.0 0.0;
text_class: "module_normal";
}
}
}
part {
name: "day1";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
color: 0 0 0 0;
rel1 {
relative: 0.6 0.5;
offset: 4 4;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
part {
name: "e.text.day1.date";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 0.0;
offset: 1 1;
to: "day1";
}
rel2 {
relative: 1.0 0.0;
offset: 1 1;
to: "day1";
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "DATE1";
font: "Vera Bold";
size: 10;
min: 1 1;
align: 0.5 0.0;
text_class: "module_normal";
}
}
}
part {
name: "e.swallow.day1.icon";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
to: "day1";
}
rel1 {
to: "day1";
}
}
}
part {
name: "e.text.day1.low";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 1.0;
offset: 1 -14;
to: "day1";
}
rel2 {
relative: 0.0 1.0;
offset: -1 -1;
to: "day1";
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "LOW0";
font: "Vera Bold";
size: 8;
min: 1 1;
align: 0.0 0.0;
text_class: "module_normal";
}
}
}
part {
name: "e.text.day1.high";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "float" 0.0;
visible: 1;
rel1 {
relative: 0.0 1.0;
offset: 0 -14;
to: "day1";
}
rel2 {
relative: 1.0 1.0;
to: "day1";
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text {
text: "HIGH0";
font: "Vera Bold";
size: 8;
min: 1 1;
align: 1.0 0.0;
text_class: "module_normal";
}
}
}
}
programs {
@ -149,56 +529,70 @@ collections {
action: STATE_SET "default" 0.0;
target: "e.text.description";
}
program {
name: "float";
signal: "e,state,orientation,float";
source: "e";
action: STATE_SET "float" 0.0;
ORIENT_TARGETS
}
program {
name: "shelf";
signal: "e,state,orientation,default";
source: "e";
action: STATE_SET "default" 0.0;
ORIENT_TARGETS
}
}
FORECASTS_ICON(0, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(1, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(2, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(3, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(4, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(5, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(6, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(7, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(8, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(9, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(10, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(11, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(12, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(13, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(14, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(15, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(16, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(17, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(18, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(19, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(20, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(21, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(22, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(23, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(24, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(25, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(26, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(27, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(28, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(29, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(30, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(31, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(32, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(33, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(34, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(35, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(36, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(37, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(38, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(39, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(40, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(41, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(42, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(43, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(44, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(45, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(46, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(47, 40, 40, 110, 110, 1.0)
FORECASTS_ICON(3200, 40, 40, 110, 110, 1.0)
}
FORECASTS_ICON(0, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(1, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(2, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(3, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(4, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(5, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(6, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(7, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(8, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(9, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(10, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(11, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(12, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(13, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(14, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(15, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(16, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(17, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(18, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(19, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(20, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(21, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(22, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(23, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(24, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(25, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(26, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(27, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(28, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(29, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(30, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(31, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(32, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(33, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(34, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(35, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(36, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(37, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(38, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(39, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(40, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(41, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(42, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(43, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(44, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(45, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(46, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(47, 10, 10, 110, 110, 1.0)
FORECASTS_ICON(3200, 10, 10, 110, 110, 1.0)
}