forked from enlightenment/enlightenment
parent
5a4e004564
commit
ec8e145dcd
|
@ -5,12 +5,12 @@
|
|||
#include "e_mod_main.h"
|
||||
|
||||
/* celsius */
|
||||
#define TEMP_LOW_LOW 32
|
||||
#define TEMP_LOW_MID 43
|
||||
#define TEMP_LOW_HIGH 55
|
||||
#define TEMP_HIGH_LOW 43
|
||||
#define TEMP_HIGH_MID 65
|
||||
#define TEMP_HIGH_HIGH 93
|
||||
#define TEMP_LOW_LOW 32
|
||||
#define TEMP_LOW_MID 43
|
||||
#define TEMP_LOW_HIGH 55
|
||||
#define TEMP_HIGH_LOW 43
|
||||
#define TEMP_HIGH_MID 65
|
||||
#define TEMP_HIGH_HIGH 93
|
||||
|
||||
#define FAR_2_CEL(x) (x - 32) / 1.8
|
||||
#define CEL_2_FAR(x) (x * 1.8) + 32
|
||||
|
@ -23,10 +23,8 @@ struct _E_Config_Dialog_Data
|
|||
int unit_method;
|
||||
Unit units;
|
||||
|
||||
int low_method;
|
||||
int low_temp;
|
||||
int high_method;
|
||||
int high_temp;
|
||||
int low_method, low_temp;
|
||||
int high_method, high_temp;
|
||||
|
||||
int sensor;
|
||||
Eina_List *sensors;
|
||||
|
@ -35,19 +33,19 @@ struct _E_Config_Dialog_Data
|
|||
};
|
||||
|
||||
/* Protos */
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
void
|
||||
config_temperature_module(Config_Face *inst)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
char buf[4096];
|
||||
char buf[PATH_MAX];
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
|
@ -58,7 +56,8 @@ config_temperature_module(Config_Face *inst)
|
|||
v->advanced.apply_cfdata = _advanced_apply_data;
|
||||
v->advanced.create_widgets = _advanced_create_widgets;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-temperature.edj", e_module_dir_get(inst->module));
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-temperature.edj",
|
||||
e_module_dir_get(inst->module));
|
||||
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Temperature Settings"),
|
||||
"E", "_e_mod_temperature_config_dialog",
|
||||
|
@ -69,12 +68,10 @@ config_temperature_module(Config_Face *inst)
|
|||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
double p;
|
||||
int pi;
|
||||
Eina_List *therms;
|
||||
Eina_List *l;
|
||||
char *name;
|
||||
char path[PATH_MAX];
|
||||
double p;
|
||||
int pi;
|
||||
Eina_List *therms, *l;
|
||||
char path[PATH_MAX], *name;
|
||||
|
||||
cfdata->units = cfdata->inst->units;
|
||||
if (cfdata->inst->units == CELCIUS)
|
||||
|
@ -129,8 +126,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
therms = temperature_get_bus_files("i2c");
|
||||
if (therms)
|
||||
{
|
||||
char *name;
|
||||
|
||||
EINA_LIST_FREE(therms, name)
|
||||
{
|
||||
if (ecore_file_exists(name))
|
||||
|
@ -140,7 +135,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
sprintf(path, "%s", ecore_file_file_get(name));
|
||||
len = strlen(path);
|
||||
if (len > 6)
|
||||
path[len - 6] = '\0';
|
||||
path[len - 6] = '\0';
|
||||
cfdata->sensors = eina_list_append(cfdata->sensors, strdup(path));
|
||||
/* TODO: Track down the user friendly names and display them instead.
|
||||
* User friendly names are not available on the system, lm-sensors
|
||||
|
@ -164,8 +159,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
therms = temperature_get_bus_files("pci");
|
||||
if (therms)
|
||||
{
|
||||
char *name;
|
||||
|
||||
EINA_LIST_FREE(therms, name)
|
||||
{
|
||||
if (ecore_file_exists(name))
|
||||
|
@ -205,9 +198,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
{
|
||||
cfdata->sensors = eina_list_append(cfdata->sensors, name);
|
||||
if (!strcmp(cfdata->inst->sensor_name, name))
|
||||
{
|
||||
cfdata->sensor = n;
|
||||
}
|
||||
cfdata->sensor = n;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +256,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
|
||||
if (cfdata->units == FAHRENHEIT)
|
||||
{
|
||||
of = e_widget_framelist_add(evas, _("High Temperature"), 0);
|
||||
|
@ -362,7 +352,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
|
|||
/* TODO: Notify user which thermal system is in use */
|
||||
/* TODO: Let the user choose the wanted thermal system */
|
||||
char *name;
|
||||
int n = 0;
|
||||
int n = 0;
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Sensors"), 0);
|
||||
rg = e_widget_radio_group_new(&(cfdata->sensor));
|
||||
|
|
Loading…
Reference in New Issue