forked from enlightenment/enlightenment
parent
2bb78dbd3b
commit
b1836c9e56
|
@ -135,7 +135,7 @@ _temperature_new()
|
||||||
E_CONFIG_VAL(D, T, high, INT);
|
E_CONFIG_VAL(D, T, high, INT);
|
||||||
E_CONFIG_LIST(D, T, faces, conf_face_edd);
|
E_CONFIG_LIST(D, T, faces, conf_face_edd);
|
||||||
E_CONFIG_VAL(D, T, sensor_name, STR);
|
E_CONFIG_VAL(D, T, sensor_name, STR);
|
||||||
E_CONFIG_VAL(D,T,units,INT);
|
E_CONFIG_VAL(D, T, units, INT);
|
||||||
|
|
||||||
e->conf = e_config_domain_load("module.temperature", conf_edd);
|
e->conf = e_config_domain_load("module.temperature", conf_edd);
|
||||||
if (!e->conf)
|
if (!e->conf)
|
||||||
|
@ -144,13 +144,13 @@ _temperature_new()
|
||||||
e->conf->poll_time = 10.0;
|
e->conf->poll_time = 10.0;
|
||||||
e->conf->low = 30;
|
e->conf->low = 30;
|
||||||
e->conf->high = 80;
|
e->conf->high = 80;
|
||||||
e->conf->sensor_name = "temp1";
|
e->conf->sensor_name = "temp1";
|
||||||
e->conf->units = celcius;
|
e->conf->units = CELCIUS;
|
||||||
}
|
}
|
||||||
E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
|
E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
|
||||||
E_CONFIG_LIMIT(e->conf->low, 0, 100);
|
E_CONFIG_LIMIT(e->conf->low, 0, 100);
|
||||||
E_CONFIG_LIMIT(e->conf->high, 0, 220);
|
E_CONFIG_LIMIT(e->conf->high, 0, 220);
|
||||||
E_CONFIG_LIMIT(e->conf->units, 0, 1);
|
E_CONFIG_LIMIT(e->conf->units, CELCIUS, FAHRENHEIT);
|
||||||
|
|
||||||
_temperature_config_menu_new(e);
|
_temperature_config_menu_new(e);
|
||||||
e->have_temp = -1;
|
e->have_temp = -1;
|
||||||
|
@ -317,7 +317,7 @@ _temperature_menu_low_10(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->low = (10 + (30*(e->conf->units)));
|
e->conf->low = (10 + (30 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ _temperature_menu_low_20(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->low = (20 + (40*(e->conf->units)));
|
e->conf->low = (20 + (40 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ _temperature_menu_low_30(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->low = (30 + (50*(e->conf->units)));
|
e->conf->low = (30 + (50 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ _temperature_menu_low_40(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->low = (40 + (60*(e->conf->units)));
|
e->conf->low = (40 + (60 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ _temperature_menu_low_50(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->low = (50 + (70*(e->conf->units)));
|
e->conf->low = (50 + (70 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ _temperature_menu_high_20(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (20 + (40*(e->conf->units)));
|
e->conf->high = (20 + (40 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ _temperature_menu_high_30(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (30 + (50*(e->conf->units)));
|
e->conf->high = (30 + (50 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ _temperature_menu_high_40(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (40 + (60*(e->conf->units)));
|
e->conf->high = (40 + (60 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ _temperature_menu_high_50(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (50 + (70*(e->conf->units)));
|
e->conf->high = (50 + (70 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ _temperature_menu_high_60(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (60 + (80*(e->conf->units)));
|
e->conf->high = (60 + (80 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ _temperature_menu_high_70(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (70 + (90*(e->conf->units)));
|
e->conf->high = (70 + (90 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ _temperature_menu_high_80(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (80 + (100*(e->conf->units)));
|
e->conf->high = (80 + (100 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ _temperature_menu_high_90(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (90 + (120*(e->conf->units)));
|
e->conf->high = (90 + (120 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ _temperature_menu_high_100(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->high = (100 + (140*(e->conf->units)));
|
e->conf->high = (100 + (140 * e->conf->units));
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ _temperature_menu_unit_fahrenheit(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->units = fahrenheit;
|
e->conf->units = FAHRENHEIT;
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ _temperature_menu_unit_celcius(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Temperature *e;
|
Temperature *e;
|
||||||
|
|
||||||
e = data;
|
e = data;
|
||||||
e->conf->units = celcius;
|
e->conf->units = CELCIUS;
|
||||||
_temperature_cb_check(e);
|
_temperature_cb_check(e);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
@ -526,35 +526,32 @@ _temperature_config_menu_boundaries_new(Temperature *e)
|
||||||
E_Menu *mn;
|
E_Menu *mn;
|
||||||
E_Menu_Item *mi;
|
E_Menu_Item *mi;
|
||||||
|
|
||||||
|
int i;
|
||||||
char* unit_str[10];
|
char* unit_str[10];
|
||||||
int unit_int[10];
|
int unit_int[10];
|
||||||
|
|
||||||
if(e->conf->units == fahrenheit)
|
if (e->conf->units == FAHRENHEIT)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char s[6];
|
char s[6];
|
||||||
|
|
||||||
for(i=0; i < 10; ++i)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
unit_int[i] = ((i+2)*20);
|
unit_int[i] = (i + 2) * 20;
|
||||||
sprintf(s, "%u F", unit_int[i]);
|
sprintf(s, "%u F", unit_int[i]);
|
||||||
unit_str[i] = calloc(strlen(s)+1, sizeof(char));
|
unit_str[i] = strdup(s);
|
||||||
strcpy(unit_str[i], s);
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (e->conf->units == CELCIUS)
|
||||||
else if(e->conf->units == celcius)
|
{
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char s[6];
|
char s[6];
|
||||||
|
|
||||||
for(i=0; i < 10; ++i)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
unit_int[i] = ((i+1)*10);
|
unit_int[i] = (i + 1) * 10;
|
||||||
sprintf(s, "%u C", unit_int[i]);
|
sprintf(s, "%u C", unit_int[i]);
|
||||||
unit_str[i] = calloc(strlen(s)+1, sizeof(char));
|
unit_str[i] = strdup(s);
|
||||||
strcpy(unit_str[i], s);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Low temperature */
|
/* Low temperature */
|
||||||
mn = e_menu_new();
|
mn = e_menu_new();
|
||||||
|
@ -663,6 +660,11 @@ _temperature_config_menu_boundaries_new(Temperature *e)
|
||||||
e_menu_item_callback_set(mi, _temperature_menu_high_100, e);
|
e_menu_item_callback_set(mi, _temperature_menu_high_100, e);
|
||||||
|
|
||||||
e->config_menu_high = mn;
|
e->config_menu_high = mn;
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
free(unit_str[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -720,14 +722,14 @@ _temperature_config_menu_new(Temperature *e)
|
||||||
e_menu_item_label_set(mi, _("Fahrenheit"));
|
e_menu_item_label_set(mi, _("Fahrenheit"));
|
||||||
e_menu_item_radio_set(mi, 1);
|
e_menu_item_radio_set(mi, 1);
|
||||||
e_menu_item_radio_group_set(mi, 1);
|
e_menu_item_radio_group_set(mi, 1);
|
||||||
if (e->conf->units == fahrenheit) e_menu_item_toggle_set(mi, 1);
|
if (e->conf->units == FAHRENHEIT) e_menu_item_toggle_set(mi, 1);
|
||||||
e_menu_item_callback_set(mi, _temperature_menu_unit_fahrenheit, e);
|
e_menu_item_callback_set(mi, _temperature_menu_unit_fahrenheit, e);
|
||||||
|
|
||||||
mi = e_menu_item_new(mn);
|
mi = e_menu_item_new(mn);
|
||||||
e_menu_item_label_set(mi, _("Celcius"));
|
e_menu_item_label_set(mi, _("Celcius"));
|
||||||
e_menu_item_radio_set(mi, 1);
|
e_menu_item_radio_set(mi, 1);
|
||||||
e_menu_item_radio_group_set(mi, 1);
|
e_menu_item_radio_group_set(mi, 1);
|
||||||
if (e->conf->units == celcius) e_menu_item_toggle_set(mi, 1);
|
if (e->conf->units == CELCIUS) e_menu_item_toggle_set(mi, 1);
|
||||||
e_menu_item_callback_set(mi, _temperature_menu_unit_celcius, e);
|
e_menu_item_callback_set(mi, _temperature_menu_unit_celcius, e);
|
||||||
|
|
||||||
e->config_menu_unit = mn;
|
e->config_menu_unit = mn;
|
||||||
|
@ -808,14 +810,6 @@ _temperature_config_menu_new(Temperature *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
e->config_menu = mn;
|
e->config_menu = mn;
|
||||||
|
|
||||||
/* int i,j;
|
|
||||||
|
|
||||||
for(i=0; i < 10; ++i)
|
|
||||||
{
|
|
||||||
free(unit_str[i]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Temperature_Face *
|
static Temperature_Face *
|
||||||
|
@ -1075,8 +1069,8 @@ _temperature_cb_check(void *data)
|
||||||
if (therms) ecore_list_destroy(therms);
|
if (therms) ecore_list_destroy(therms);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ef->conf->units == fahrenheit)
|
if (ef->conf->units == FAHRENHEIT)
|
||||||
temp = (temp*9/5)+32;
|
temp = (temp * 9.0 / 5.0) + 32;
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -1098,7 +1092,7 @@ _temperature_cb_check(void *data)
|
||||||
(double)(temp - ef->conf->low) /
|
(double)(temp - ef->conf->low) /
|
||||||
(double)(ef->conf->high - ef->conf->low));
|
(double)(ef->conf->high - ef->conf->low));
|
||||||
|
|
||||||
if(ef->conf->units == fahrenheit)
|
if (ef->conf->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);
|
||||||
|
|
|
@ -9,7 +9,11 @@ typedef struct _Config_Face Config_Face;
|
||||||
typedef struct _Temperature Temperature;
|
typedef struct _Temperature Temperature;
|
||||||
typedef struct _Temperature_Face Temperature_Face;
|
typedef struct _Temperature_Face Temperature_Face;
|
||||||
|
|
||||||
typedef enum _unit {celcius=0, fahrenheit} unit;
|
typedef enum _Unit
|
||||||
|
{
|
||||||
|
CELCIUS,
|
||||||
|
FAHRENHEIT
|
||||||
|
} Unit;
|
||||||
|
|
||||||
struct _Config
|
struct _Config
|
||||||
{
|
{
|
||||||
|
@ -17,7 +21,7 @@ struct _Config
|
||||||
int low, high;
|
int low, high;
|
||||||
Evas_List *faces;
|
Evas_List *faces;
|
||||||
char *sensor_name;
|
char *sensor_name;
|
||||||
unit units;
|
Unit units;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Config_Face
|
struct _Config_Face
|
||||||
|
|
Loading…
Reference in New Issue