Enlightenment CVS committal Author : devilhorns Project : e_modules Module : mem
Dir : e_modules/mem Modified Files: Makefile.am configure.in e_mod_config.c e_mod_main.c e_mod_main.h mem.edc Added Files: DejaVuSansMono.ttf machdep_freebsd.c machdep_linux.c Log Message: Added patch from Stanislav Sedov to allow mem module to run on freeBsd. Great work, thanks :) =================================================================== RCS file: /cvs/e/e_modules/mem/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- Makefile.am 27 May 2006 20:02:48 -0000 1.6 +++ Makefile.am 14 Jun 2006 14:15:39 -0000 1.7 @@ -1,5 +1,6 @@ MAINTAINERCLEANFILES = Makefile.in e_modules-mem.spec + SUBDIRS = po EDJE_CC = @edje_cc@ @@ -9,7 +10,7 @@ filesdir = $(datadir) files_DATA = module_icon.png module.eap mem.edj mem.edc \ - VeraMono.ttf $(wildcard real*.png) $(wildcard swap*.png) + DejaVuSansMono.ttf $(wildcard real*.png) $(wildcard swap*.png) EXTRA_DIST=e_modules-mem.spec.in e_modules-mem.spec autogen.sh mem.png module_icon.png $(files_DATA) @@ -21,11 +22,31 @@ pkgdir = $(datadir)/$(MODULE_ARCH) pkg_LTLIBRARIES = module.la -module_la_SOURCES = e_mod_main.c \ - e_mod_main.h \ - e_mod_config.c +if BUILD_FREEBSD +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h \ + machdep_freebsd.c \ + e_mod_config.c +endif +if BUILD_LINUX +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h \ + machdep_linux.c \ + e_mod_config.c +endif +if BUILD_NETBSD +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h \ + machdep_netbsd.c \ + e_mod_config.c +endif + +EXTRA_module_la_SOURCES = machdep_linux.c \ + machdep_freebsd.c \ + machdep_netbsd.c + -module_la_LIBADD = @e_libs@ -lm +module_la_LIBADD = @e_libs@ -lm @machdep_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h =================================================================== RCS file: /cvs/e/e_modules/mem/configure.in,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- configure.in 10 Jun 2006 02:27:23 -0000 1.9 +++ configure.in 14 Jun 2006 14:15:39 -0000 1.10 @@ -17,7 +17,7 @@ AM_ENABLE_SHARED AM_PROG_LIBTOOL -ALL_LINGUAS="eo fi it sv ja" +ALL_LINGUAS="eo fi it sv ja ru" AC_SUBST(ALL_LINGUAS) AM_GNU_GETTEXT([external]) @@ -26,6 +26,25 @@ MODULE_ARCH="$host_os-$host_cpu" AC_SUBST(MODULE_ARCH) AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture") + +uname=`uname` + +AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux) +AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD) +AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD) + +case $uname in + FreeBSD*) + machdep_libs= + ;; + Linux*) + machdep_libs= + ;; + NetBSD*) + machdep_libs="-lkvm" + ;; +esac +AC_SUBST(machdep_libs) if test "x${bindir}" = 'x${exec_prefix}/bin'; then if test "x${exec_prefix}" = "xNONE"; then =================================================================== RCS file: /cvs/e/e_modules/mem/e_mod_config.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- e_mod_config.c 25 May 2006 23:32:39 -0000 1.6 +++ e_mod_config.c 14 Jun 2006 14:15:39 -0000 1.7 @@ -6,8 +6,10 @@ double poll_time; int always_text; int show_percent; +#ifdef __linux__ int real_ignore_buffers; int real_ignore_cached; +#endif }; /* Protos */ @@ -41,8 +43,10 @@ _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata) { cfdata->poll_time = ci->poll_time; +#ifdef __linux__ cfdata->real_ignore_buffers = ci->real_ignore_buffers; cfdata->real_ignore_cached = ci->real_ignore_cached; +#endif // cfdata->show_text = c->conf->show_text; cfdata->always_text = ci->always_text; cfdata->show_percent = ci->show_percent; @@ -85,10 +89,12 @@ e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, D_("Show Text As Percent"), &(cfdata->show_percent)); e_widget_framelist_object_append(of, ob); +#ifdef __linux__ ob = e_widget_check_add(evas, D_("Ignore Buffers"), &(cfdata->real_ignore_buffers)); e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, D_("Ignore Cached"), &(cfdata->real_ignore_cached)); e_widget_framelist_object_append(of, ob); +#endif ob = e_widget_label_add(evas, D_("Check Interval:")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1.0, 60.0, 1.0, 0, &(cfdata->poll_time), NULL, 150); @@ -106,8 +112,10 @@ ci = cfd->data; ci->poll_time = cfdata->poll_time; +#ifdef __linux__ ci->real_ignore_buffers = cfdata->real_ignore_buffers; ci->real_ignore_cached = cfdata->real_ignore_cached; +#endif ci->always_text = cfdata->always_text; ci->show_percent = cfdata->show_percent; e_config_save_queue(); =================================================================== RCS file: /cvs/e/e_modules/mem/e_mod_main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- e_mod_main.c 6 Jun 2006 15:29:19 -0000 1.30 +++ e_mod_main.c 14 Jun 2006 14:15:39 -0000 1.31 @@ -35,7 +35,6 @@ static Mem *_mem_new(Evas *evas); static void _mem_free(Mem *mem); static int _mem_cb_check(void *data); -static void _mem_get_values(Config_Item *ci, int *real, int *swap, int *total_real, int *total_swap); static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_item_edd = NULL; @@ -56,7 +55,6 @@ Instance *inst; Config_Item *ci; Mem *mem; - char buf[4096]; inst = E_NEW(Instance, 1); @@ -74,7 +72,6 @@ inst->mem_obj = o; evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mem_cb_mouse_down, inst); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _mem_cb_mouse_in, inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _mem_cb_mouse_in, inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _mem_cb_mouse_out, inst); @@ -117,20 +114,11 @@ _gc_shutdown(E_Gadcon_Client *gcc) { Instance *inst; - Mem *mem; inst = gcc->data; - mem = inst->mem; - if (inst->check_timer) ecore_timer_del(inst->check_timer); mem_config->instances = evas_list_remove(mem_config->instances, inst); - - evas_object_event_callback_del(mem->mem_obj, EVAS_CALLBACK_MOUSE_DOWN, _mem_cb_mouse_down); - evas_object_event_callback_del(mem->mem_obj, EVAS_CALLBACK_MOUSE_MOVE, _mem_cb_mouse_in); - evas_object_event_callback_del(mem->mem_obj, EVAS_CALLBACK_MOUSE_IN, _mem_cb_mouse_in); - evas_object_event_callback_del(mem->mem_obj, EVAS_CALLBACK_MOUSE_OUT, _mem_cb_mouse_out); - - _mem_free(mem); + _mem_free(inst->mem); free(inst); } @@ -234,8 +222,10 @@ ci->poll_time = 1.0; ci->always_text = 0; ci->show_percent = 1; +#ifdef __linux__ ci->real_ignore_buffers = 0; ci->real_ignore_cached = 0; +#endif mem_config->items = evas_list_append(mem_config->items, ci); return ci; @@ -247,7 +237,7 @@ "Mem" }; -EAPI void * +EAPI int e_modapi_init(E_Module *m) { bindtextdomain(PACKAGE, LOCALEDIR); @@ -263,8 +253,10 @@ E_CONFIG_VAL(D, T, poll_time, DOUBLE); E_CONFIG_VAL(D, T, always_text, INT); E_CONFIG_VAL(D, T, show_percent, INT); +#ifdef __linux__ E_CONFIG_VAL(D, T, real_ignore_buffers, INT); E_CONFIG_VAL(D, T, real_ignore_cached, INT); +#endif conf_edd = E_CONFIG_DD_NEW("Mem_Config", Config); @@ -286,8 +278,10 @@ ci->poll_time = 1.0; ci->always_text = 0; ci->show_percent = 1; +#ifdef __linux__ ci->real_ignore_buffers = 0; ci->real_ignore_cached = 0; +#endif mem_config->items = evas_list_append(mem_config->items, ci); } mem_config->module = m; @@ -435,65 +429,6 @@ double ts = ((double)swap / (double)total_swap); msg.val = ts; edje_object_message_send(inst->mem_obj, EDJE_MESSAGE_FLOAT, 2, &msg); -} - -static void -_mem_get_values(Config_Item *ci, int *real, int *swap, int *total_real, int *total_swap) -{ - FILE *pmeminfo = NULL; - int cursor = 0; - char *line, *field; - unsigned char c; - long int value = 0, mtotal = 0, stotal = 0, mfree = 0, sfree = 0; - ldiv_t ldresult; - long int liresult; - - if (!(pmeminfo = fopen("/proc/meminfo", "r"))) - { - fprintf(stderr, "can't open /proc/meminfo"); - return; - } - - line = (char *)calloc(64, sizeof(char)); - while (fscanf(pmeminfo, "%c", &c) != EOF) - { - if (c != '\n') line[cursor++] = c; - else - { - field = (char *)malloc(strlen(line) * sizeof(char)); - sscanf(line, "%s %ld kB", field, &value); - if (!strcmp(field, "MemTotal:")) mtotal = value; - else if (!strcmp(field, "MemFree:")) mfree = value; - else if (ci->real_ignore_buffers && (!strcmp(field, "Buffers:"))) - mfree += value; - else if (ci->real_ignore_cached && (!strcmp(field, "Cached:"))) - mfree += value; - else if (ci->real_ignore_cached && (!strcmp(field, "SwapCached:"))) - sfree += value; - else if (!strcmp(field, "SwapTotal:")) stotal = value; - else if (!strcmp(field, "SwapFree:")) sfree = value; - - free(line); - free(field); - cursor = 0; - line = (char *)calloc(64, sizeof(char)); - } - } - fclose(pmeminfo); - - if (stotal >= 1) - { - ldresult = ldiv(stotal, 100); - liresult = ldresult.quot; - ldresult = ldiv((stotal - sfree), liresult); - } - ldresult = ldiv(mtotal, 100); - liresult = ldresult.quot; - ldresult = ldiv((mtotal - mfree), liresult); - - *real = (mtotal - mfree); - *swap = (stotal - sfree); - *total_real = mtotal; - *total_swap = stotal; + return 0; } =================================================================== RCS file: /cvs/e/e_modules/mem/e_mod_main.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- e_mod_main.h 6 Jun 2006 15:29:19 -0000 1.10 +++ e_mod_main.h 14 Jun 2006 14:15:39 -0000 1.11 @@ -27,13 +27,15 @@ EAPI extern E_Module_Api e_modapi; -EAPI void *e_modapi_init(E_Module *m); -EAPI int e_modapi_shutdown(E_Module *m); -EAPI int e_modapi_save(E_Module *m); -EAPI int e_modapi_about(E_Module *m); +EAPI int e_modapi_init(E_Module *m); +EAPI int e_modapi_shutdown(E_Module *m); +EAPI int e_modapi_save(E_Module *m); +EAPI int e_modapi_about(E_Module *m); void _mem_config_updated(const char *id); void _config_mem_module(Config_Item *ci); +void _mem_get_values(Config_Item *ci, int *real, int *swap, int *total_real, + int *total_swap); extern Config *mem_config; #endif =================================================================== RCS file: /cvs/e/e_modules/mem/mem.edc,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- mem.edc 6 Jun 2006 14:39:40 -0000 1.14 +++ mem.edc 14 Jun 2006 14:15:39 -0000 1.15 @@ -27,7 +27,7 @@ fonts { - font: "VeraMono.ttf" "VeraMono"; + font: "DejaVuSansMono.ttf" "DejaVuSansMono"; } collections @@ -248,7 +248,7 @@ text { text: "Real:"; - font: "VeraMono"; + font: "DejaVuSansMono"; size: 9; min: 1 1; align: 0.5 1.0; @@ -406,7 +406,7 @@ text { text: "Swap:"; - font: "VeraMono"; + font: "DejaVuSansMono"; size: 9; min: 1 1; align: 0.5 1.0; _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs