Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/modules/temperature Modified Files: Makefile.am e_mod_config.c e_mod_main.c e_mod_main.h Removed Files: e_mod_config.h Log Message: 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 =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/temperature/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- Makefile.am 18 Feb 2006 04:35:34 -0000 1.6 +++ Makefile.am 20 Apr 2006 11:30:25 -0000 1.7 @@ -20,8 +20,7 @@ pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h + e_mod_config.c module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/temperature/e_mod_config.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- e_mod_config.c 12 Mar 2006 16:12:59 -0000 1.18 +++ e_mod_config.c 20 Apr 2006 11:30:25 -0000 1.19 @@ -3,8 +3,6 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" /* celsius */ #define TEMP_LOW_LOW 32 @@ -42,7 +40,7 @@ static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); void -_config_temperature_module(E_Container *con, Temperature *temp) +_config_temperature_module(void) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -56,22 +54,23 @@ v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.create_widgets = _advanced_create_widgets; - cfd = e_config_dialog_new(con, _("Temperature Configuration"), NULL, 0, v, temp); - temp->config_dialog = cfd; + cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + _("Temperature Configuration"), NULL, 0, v, NULL); + temperature_config->config_dialog = cfd; } static void -_fill_data(Temperature *t, E_Config_Dialog_Data *cfdata) +_fill_data(E_Config_Dialog_Data *cfdata) { double p; - cfdata->units = t->conf->units; - if (t->conf->units == CELCIUS) + cfdata->units = temperature_config->units; + if (temperature_config->units == CELCIUS) cfdata->unit_method = 0; else cfdata->unit_method = 1; - p = t->conf->poll_time; + p = temperature_config->poll_time; cfdata->poll_time = p; if ((p >= 0) && (p <= 5)) cfdata->poll_method = 1; //Fast @@ -82,7 +81,7 @@ else if (p > 30) cfdata->poll_method = 60; //Very Slow - p = t->conf->low; + p = temperature_config->low; if (cfdata->units == FAHRENHEIT) p = FAR_2_CEL(p - 1); // -1 so the conversion doesn't make mid go hi cfdata->low_temp = p; @@ -93,7 +92,7 @@ else if (p > TEMP_LOW_MID) cfdata->low_method = TEMP_LOW_HIGH; - p = t->conf->high; + p = temperature_config->high; if (cfdata->units == FAHRENHEIT) p = FAR_2_CEL(p - 1); cfdata->high_temp = p; @@ -104,11 +103,11 @@ else if (p > TEMP_HIGH_MID) cfdata->high_method = TEMP_HIGH_HIGH; - if (!strcmp(t->conf->sensor_name, "temp1")) + if (!strcmp(temperature_config->sensor_name, "temp1")) cfdata->sensor = 0; - else if (!strcmp(t->conf->sensor_name, "temp2")) + else if (!strcmp(temperature_config->sensor_name, "temp2")) cfdata->sensor = 1; - else if (!strcmp(t->conf->sensor_name, "temp3")) + else if (!strcmp(temperature_config->sensor_name, "temp3")) cfdata->sensor = 2; } @@ -116,21 +115,16 @@ _create_data(E_Config_Dialog *cfd) { E_Config_Dialog_Data *cfdata; - Temperature *t; - t = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(t, cfdata); + _fill_data(cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Temperature *t; - - t = cfd->data; - t->config_dialog = NULL; + temperature_config->config_dialog = NULL; free(cfdata); } @@ -217,33 +211,23 @@ static int _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) - t->conf->units = CELCIUS; + temperature_config->units = CELCIUS; else - t->conf->units = FAHRENHEIT; - - t->conf->poll_time = (double)cfdata->poll_method; - - if (t->conf->units == FAHRENHEIT) + temperature_config->units = FAHRENHEIT; + temperature_config->poll_time = (double)cfdata->poll_method; + if (temperature_config->units == FAHRENHEIT) { - t->conf->low = CEL_2_FAR(cfdata->low_method); - t->conf->high = CEL_2_FAR(cfdata->high_method); + temperature_config->low = CEL_2_FAR(cfdata->low_method); + temperature_config->high = CEL_2_FAR(cfdata->high_method); } else { - t->conf->low = cfdata->low_method; - t->conf->high = cfdata->high_method; + temperature_config->low = cfdata->low_method; + temperature_config->high = cfdata->high_method; } - - e_border_button_bindings_grab_all(); + _temperature_face_cb_config_updated(); e_config_save_queue(); - - /* Call Config Update */ - _temperature_face_cb_config_updated(t); return 1; } @@ -252,9 +236,6 @@ { Evas_Object *o, *of, *ob; E_Radio_Group *rg; - Temperature *t; - - t = cfd->data; o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("Display Units"), 0); @@ -312,10 +293,10 @@ e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - cfdata->low_temp = t->conf->low; - cfdata->high_temp = t->conf->high; +// cfdata->low_temp = temperature_config->low; +// cfdata->high_temp = temperature_config->high; - if (t->conf->units == FAHRENHEIT) + if (cfdata->units == FAHRENHEIT) { /* round-off to closest 5 */ if (cfdata->high_temp % 5 > 3) @@ -357,14 +338,7 @@ static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Temperature *t; - - 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 != temperature_config->units) { if (cfdata->unit_method == 0) { @@ -377,35 +351,29 @@ cfdata->low_temp = CEL_2_FAR(cfdata->low_temp); } } - if (cfdata->unit_method == 0) - t->conf->units = CELCIUS; + temperature_config->units = CELCIUS; else - t->conf->units = FAHRENHEIT; - - t->conf->poll_time = cfdata->poll_time; - - t->conf->low = cfdata->low_temp; - t->conf->high = cfdata->high_temp; - + temperature_config->units = FAHRENHEIT; + temperature_config->poll_time = cfdata->poll_time; + temperature_config->low = cfdata->low_temp; + temperature_config->high = cfdata->high_temp; + if (temperature_config->sensor_name) + evas_stringshare_del(temperature_config->sensor_name); + temperature_config->sensor_name = NULL; switch (cfdata->sensor) { case 0: - t->conf->sensor_name = strdup("temp1"); + temperature_config->sensor_name = evas_stringshare_add("temp1"); break; case 1: - t->conf->sensor_name = strdup("temp2"); + temperature_config->sensor_name = evas_stringshare_add("temp2"); break; case 2: - t->conf->sensor_name = strdup("temp3"); + temperature_config->sensor_name = evas_stringshare_add("temp3"); break; } - - e_border_button_bindings_grab_all(); + _temperature_face_cb_config_updated(); e_config_save_queue(); - - /* Call Config Update */ - _temperature_face_cb_config_updated(t); - return 1; } =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/temperature/e_mod_main.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- e_mod_main.c 12 Mar 2006 16:12:59 -0000 1.55 +++ e_mod_main.c 20 Apr 2006 11:30:25 -0000 1.56 @@ -3,255 +3,153 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" #ifdef __FreeBSD__ #include <sys/types.h> #include <sys/sysctl.h> #endif -/* TODO List: - * - * which options should be in main menu, and which in face menu? - */ - -/* module private routines */ -static Temperature *_temperature_new(); -static void _temperature_free(Temperature *e); -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, - "Temperature" -}; - -EAPI void * -e_modapi_init(E_Module *m) -{ - E_Gadget *gad = NULL; - E_Gadget_Api *api; - Temperature *e; - - 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) +/***************************************************************************/ +/**/ +/* 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 = { - 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) + GADCON_CLIENT_CLASS_VERSION, + "temperature", { - if (e->config_dialog) - { - e_object_del(E_OBJECT(e->config_dialog)); - e->config_dialog = NULL; - } - _temperature_free(e); + _gc_init, _gc_shutdown, _gc_orient } - e_object_del(E_OBJECT(gad)); - return 1; -} +}; +/**/ +/***************************************************************************/ -EAPI int -e_modapi_save(E_Module *m) -{ - E_Gadget *gad; - Temperature *e; +/***************************************************************************/ +/**/ +/* actual module specifics */ - 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; -} +typedef struct _Instance Instance; -EAPI int -e_modapi_info(E_Module *m) +struct _Instance { - char buf[4096]; - - snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); - m->icon_file = strdup(buf); - return 1; -} + E_Gadcon_Client *gcc; + Evas_Object *o_temp; +}; -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; +static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +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) +{ + 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/temperature", + "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; } -EAPI int -e_modapi_config(E_Module *m) +static void +_gc_shutdown(E_Gadcon_Client *gcc) { - E_Gadget *gad; - Temperature *e; + Instance *inst; - gad = m->data; - if (!gad) return 0; - e = gad->data; - _config_temperature_module(e_container_current_get(e_manager_current_get()), e); - - return 1; + inst = gcc->data; + temperature_config->instances = evas_list_remove(temperature_config->instances, inst); + evas_object_del(inst->o_temp); + free(inst); } - - -/* module private routines */ -static Temperature * -_temperature_new() +static void +_gc_orient(E_Gadcon_Client *gcc) { - 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; + Instance *inst; + + inst = gcc->data; + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); } +/**/ +/***************************************************************************/ -void _temperature_face_init(void *data, E_Gadget_Face *face) +/***************************************************************************/ +/**/ +static void +_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { - 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"); - - 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); - - ef->conf = evas_list_nth(e->conf->faces, face->face_num); - if (!ef->conf) + 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); - ef->conf->enabled = 1; - e->conf->faces = evas_list_append(e->conf->faces, ef->conf); + E_Menu *mn; + E_Menu_Item *mi; + 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 -_temperature_free(Temperature *e) +_menu_cb_post(void *data, E_Menu *m) { - Evas_List *l; - - ecore_timer_del(e->temperature_check_timer); - - 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); + if (!temperature_config->menu) return; + e_object_del(E_OBJECT(temperature_config->menu)); + temperature_config->menu = NULL; } static int _temperature_cb_check(void *data) { - E_Gadget *gad; - E_Gadget_Face *face; - Temperature *t; int ret = 0; + Instance *inst; Ecore_List *therms; Evas_List *l; int temp = 0; @@ -261,11 +159,6 @@ int len; #endif - gad = data; - if (!gad) return 0; - t = gad->data; - if (!t) return 0; - #ifdef __FreeBSD__ if (mib[0] == -1) { @@ -305,7 +198,7 @@ { char *name, *sensor; - sensor = t->conf->sensor_name; + sensor = temperature_config->sensor_name; if (!sensor) sensor = "temp1"; while ((name = ecore_list_next(therms))) @@ -370,77 +263,183 @@ } #endif - if (t->conf->units == FAHRENHEIT) - temp = (temp * 9.0 / 5.0) + 32; + if (temperature_config->units == FAHRENHEIT) + temp = (temp * 9.0 / 5.0) + 32; if (ret) { char *utf8; - if (t->have_temp != 1) + if (temperature_config->have_temp != 1) { /* enable therm object */ - for (l = gad->faces; l; l = l->next) + for (l = temperature_config->instances; l; l = l->next) { - face = l->data; - edje_object_signal_emit(face->main_obj, "known", ""); + inst = l->data; + 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); else snprintf(buf, sizeof(buf), "%i°C", temp); 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; - _temperature_face_level_set(face, - (double)(temp - t->conf->low) / - (double)(t->conf->high - t->conf->low)); - - edje_object_part_text_set(face->main_obj, "reading", utf8); + inst = l->data; + _temperature_face_level_set(inst, + (double)(temp - temperature_config->low) / + (double)(temperature_config->high - temperature_config->low)); + edje_object_part_text_set(inst->o_temp, "reading", utf8); } free(utf8); } else { - if (t->have_temp != 0) + if (temperature_config->have_temp != 0) { /* disable therm object */ - for (l = gad->faces; l; l = l->next) - + for (l = temperature_config->instances; l; l = l->next) { - face = l->data; - edje_object_signal_emit(face->main_obj, "unknown", ""); - edje_object_part_text_set(face->main_obj, "reading", "NO TEMP"); - _temperature_face_level_set(face, 0.5); + inst = l->data; + edje_object_signal_emit(inst->o_temp, "unknown", ""); + edje_object_part_text_set(inst->o_temp, "reading", "NO TEMP"); + _temperature_face_level_set(inst, 0.5); } - t->have_temp = 0; + temperature_config->have_temp = 0; } } return 1; } static void -_temperature_face_level_set(E_Gadget_Face *face, double level) +_temperature_face_level_set(Instance *inst, double level) { Edje_Message_Float msg; if (level < 0.0) level = 0.0; else if (level > 1.0) level = 1.0; 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 -_temperature_face_cb_config_updated(Temperature *temp) +_temperature_face_cb_config_updated(void) +{ + ecore_timer_del(temperature_config->temperature_check_timer); + temperature_config->temperature_check_timer = + 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) { - /* Call all funcs needed to handle update */ - ecore_timer_del(temp->temperature_check_timer); - temp->temperature_check_timer = ecore_timer_add(temp->conf->poll_time, _temperature_cb_check, temp->gad); + 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; +} +/**/ +/***************************************************************************/ =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/temperature/e_mod_main.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- e_mod_main.h 12 Mar 2006 16:12:59 -0000 1.17 +++ e_mod_main.h 20 Apr 2006 11:30:25 -0000 1.18 @@ -5,9 +5,6 @@ #define E_MOD_MAIN_H typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Temperature Temperature; -typedef struct _Temperature_Face Temperature_Face; typedef enum _Unit { @@ -17,32 +14,17 @@ struct _Config { - double poll_time; - int low, high; - Evas_List *faces; - char *sensor_name; - Unit units; -}; - -struct _Config_Face -{ - unsigned char enabled; -}; - -struct _Temperature -{ - Config *conf; - Ecore_Timer *temperature_check_timer; - E_Config_Dialog *config_dialog; + /* saved * loaded config values */ + double poll_time; + int low, high; + char *sensor_name; + Unit units; + /* just config state */ + E_Config_Dialog *config_dialog; + Evas_List *instances; + E_Menu *menu; + Ecore_Timer *temperature_check_timer; unsigned char have_temp; - E_Gadget *gad; -}; - -struct _Temperature_Face -{ - Temperature *temp; - Config_Face *conf; - }; EAPI extern E_Module_Api e_modapi; @@ -54,6 +36,9 @@ EAPI int e_modapi_about (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 ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs