Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : uptime

Dir     : e_modules/uptime


Modified Files:
        AUTHORS Makefile.am e_mod_config.c e_mod_main.c e_mod_main.h 
        uptime.edc 
Removed Files:
        module_icon.png 


Log Message:
Modified Patch from Stanislav Sedov for:

-Uptime works on FreeBsd now.
-Added additional parameter to specify period of syncronization with system
clock which allows smooth clock update without high system load.
-Module can now display load averages and number of users for FreeBsd.

===================================================================
RCS file: /cvs/e/e_modules/uptime/AUTHORS,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- AUTHORS     20 Feb 2006 17:21:15 -0000      1.1
+++ AUTHORS     28 Jun 2006 23:48:53 -0000      1.2
@@ -1,2 +1,4 @@
 Originally by Matthew Mullins.
-Recoded into seperate modules by Christopher 'devilhorns' Michael <[EMAIL 
PROTECTED]>
+Recoded into seperate modules by Christopher 'devilhorns' Michael <[EMAIL 
PROTECTED]>.
+FreeBSD, load averages and number of users patches as well as additional 
cleanup
+by Stanislav Sedov <[EMAIL PROTECTED]>.
===================================================================
RCS file: /cvs/e/e_modules/uptime/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- Makefile.am 27 Jun 2006 02:37:15 -0000      1.7
+++ Makefile.am 28 Jun 2006 23:48:53 -0000      1.8
@@ -28,7 +28,7 @@
                       e_mod_main.h \
                       e_mod_config.c
 
-module_la_LIBADD       = @e_libs@
+module_la_LIBADD       = @e_libs@ -lm
 module_la_LDFLAGS      = -module -avoid-version
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
===================================================================
RCS file: /cvs/e/e_modules/uptime/e_mod_config.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- e_mod_config.c      14 Jun 2006 01:03:32 -0000      1.7
+++ e_mod_config.c      28 Jun 2006 23:48:53 -0000      1.8
@@ -1,9 +1,16 @@
 #include <e.h>
 #include "e_mod_main.h"
 
+#include <stdlib.h>
+#include <stdint.h>
+#include <err.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
 struct _E_Config_Dialog_Data
 {
    double check_interval;
+   double update_interval;
 };
 
 /* Protos */
@@ -20,8 +27,15 @@
    E_Config_Dialog *cfd;
    E_Config_Dialog_View *v;
    E_Container *con;
-   
+
+   if (!ut_config) return;
+
    v = E_NEW(E_Config_Dialog_View, 1);
+   if (v == NULL)
+     {
+       warn("malloc()");
+       return;
+     }
 
    v->create_cfdata = _create_data;
    v->free_cfdata = _free_data;
@@ -36,27 +50,39 @@
 static void
 _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
 {
+   if (!cfdata) return;
    cfdata->check_interval = ci->check_interval;
+   cfdata->update_interval = ci->update_interval;
 }
 
 static void *
 _create_data(E_Config_Dialog *cfd)
 {
-   E_Config_Dialog_Data *cfdata;
+   E_Config_Dialog_Data        *cfdata;
    Config_Item *ci;
 
+   if (!cfd) return NULL;
+   
    ci = cfd->data;
    cfdata = E_NEW(E_Config_Dialog_Data, 1);
+   if (cfdata == NULL)
+     {
+       warn("malloc()");
+       return NULL;
+     }
 
    _fill_data(ci, cfdata);
+
    return cfdata;
 }
 
 static void
 _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
-   if (!ut_config) return;
+   if (ut_config == NULL)
+     return;
    ut_config->config_dialog = NULL;
+
    free(cfdata);
 }
 
@@ -67,10 +93,21 @@
 
    o = e_widget_list_add(evas, 0, 0);
    of = e_widget_framelist_add(evas, D_("Uptime Settings"), 0);
+
+   ob = e_widget_label_add(evas, D_("Update 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->update_interval), NULL, 100);
+   e_widget_framelist_object_append(of, ob);
+
    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->check_interval), NULL, 100);
+
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 15.0, 60.0,
+                           1.0, 0, &(cfdata->check_interval), NULL, 100);
    e_widget_framelist_object_append(of, ob);
+
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
    return o;
@@ -80,9 +117,11 @@
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    Config_Item *ci;
-   
+
+   if (!cfd) return 0;
    ci = cfd->data;
    ci->check_interval = cfdata->check_interval;
+   ci->update_interval = cfdata->update_interval;
    e_config_save_queue();
    _ut_config_updated(ci->id);
 
===================================================================
RCS file: /cvs/e/e_modules/uptime/e_mod_main.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- e_mod_main.c        14 Jun 2006 01:03:32 -0000      1.10
+++ e_mod_main.c        28 Jun 2006 23:48:53 -0000      1.11
@@ -1,20 +1,38 @@
 #include <e.h>
-#include <linux/kernel.h>
 #include "e_mod_main.h"
 
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <syslog.h>
+
+#ifdef __linux__
+# include <linux/kernel.h>
+#endif
+
+#ifdef __FreeBSD__
+# include <utmp.h>
+# include <paths.h>
+# include <sys/tty.h>
+#endif
+
 typedef struct _Instance Instance;
 typedef struct _Uptime Uptime;
 
-struct _Instance 
+struct _Instance
 {
    E_Gadcon_Client *gcc;
    Evas_Object *ut_obj;
    Uptime *ut;
    Ecore_Timer *monitor;
-   int uptime;
+   time_t uptime;
+   time_t counter;
+   int nusers;
+   double la[3];
 };
 
-struct _Uptime 
+struct _Uptime
 {
    Instance *inst;
    Evas_Object *ut_obj;
@@ -33,20 +51,21 @@
 static Uptime *_ut_new(Evas *evas);
 static void _ut_free(Uptime *ut);
 static int _ut_cb_check(void *data);
+static void update_counters(Instance *inst);
 
 static E_Config_DD *conf_edd = NULL;
 static E_Config_DD *conf_item_edd = NULL;
 
 Config *ut_config = NULL;
 
-static const E_Gadcon_Client_Class _gc_class = 
+static const E_Gadcon_Client_Class _gc_class =
 {
    GADCON_CLIENT_CLASS_VERSION,
      "uptime", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon}
 };
 
 static E_Gadcon_Client *
-_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) 
+_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
 {
    Evas_Object *o;
    E_Gadcon_Client *gcc;
@@ -54,45 +73,53 @@
    Config_Item *ci;
    Uptime *ut;
    char buf[4096];
-   struct sysinfo s_info;
-   
+
    inst = E_NEW(Instance, 1);
    ci = _ut_config_item_get(id);
-   if (!ci->id) ci->id = evas_stringshare_add(id);
-   
+
+#ifdef UPTIME_DEBUG
+   syslog(LOG_EMERG, "ii id= %s, ci->update_interval = %d, ci = %d\n",
+         ci->id, ci->update_interval, ci->check_interval);
+#endif
+
    ut = _ut_new(gc->evas);
    ut->inst = inst;
    inst->ut = ut;
-   
+
    o = ut->ut_obj;
    gcc = e_gadcon_client_new(gc, name, id, style, o);
    gcc->data = inst;
    inst->gcc = gcc;
    inst->ut_obj = o;
-   
+
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 
_ut_cb_mouse_down, inst);
    ut_config->instances = evas_list_append(ut_config->instances, inst);
 
-   sysinfo(&s_info);
-   inst->uptime = s_info.uptime;
-   
+   (void)update_counters(inst);
+   inst->counter = 0;
+
    if (!inst->monitor)
-     inst->monitor = ecore_timer_add(ci->check_interval, _ut_cb_check, inst);
-   
+     inst->monitor = ecore_timer_add(ci->update_interval, _ut_cb_check, inst);
+
    return gcc;
 }
 
 static void
-_gc_shutdown(E_Gadcon_Client *gcc) 
+_gc_shutdown(E_Gadcon_Client *gcc)
 {
    Instance *inst;
    Uptime *ut;
+
+   if (!gcc) return;
+   if (!gcc->data) return;
    
    inst = gcc->data;
    ut = inst->ut;
+   if (!ut) return;
+
+   if (inst->monitor != NULL)
+     ecore_timer_del(inst->monitor);
 
-   if (inst->monitor) ecore_timer_del(inst->monitor);
-   
    ut_config->instances = evas_list_remove(ut_config->instances, inst);
    evas_object_event_callback_del(ut->ut_obj, EVAS_CALLBACK_MOUSE_DOWN, 
_ut_cb_mouse_down);
 
@@ -101,133 +128,151 @@
 }
 
 static void
-_gc_orient(E_Gadcon_Client *gcc) 
+_gc_orient(E_Gadcon_Client *gcc)
 {
    e_gadcon_client_aspect_set(gcc, 16, 16);
    e_gadcon_client_min_size_set(gcc, 16, 16);
 }
 
 static char *
-_gc_label(void) 
+_gc_label(void)
 {
    return D_("Uptime");
 }
 
 static Evas_Object *
-_gc_icon(Evas *evas) 
+_gc_icon(Evas *evas)
 {
    Evas_Object *o;
    char buf[4096];
-   
+
    o = edje_object_add(evas);
    snprintf(buf, sizeof(buf), "%s/module.eap", 
e_module_dir_get(ut_config->module));
    edje_object_file_set(o, buf, "icon");
+
    return o;
 }
 
-static void 
-_ut_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) 
+static void
+_ut_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
    Instance *inst;
    Evas_Event_Mouse_Down *ev;
-   
-   if (ut_config->menu) return;
-   
+
+   if (ut_config->menu != NULL)
+     return;
+
    inst = data;
    ev = event_info;
+
    if (ev->button == 3)
      {
        E_Menu *mn;
        E_Menu_Item *mi;
        int x, y, w, h;
-       
+
        mn = e_menu_new();
        e_menu_post_deactivate_callback_set(mn, _ut_menu_cb_post, inst);
        ut_config->menu = mn;
-       
+
        mi = e_menu_item_new(mn);
        e_menu_item_label_set(mi, D_("Configuration"));
        e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
        e_menu_item_callback_set(mi, _ut_menu_cb_configure, inst);
-       
+
        mi = e_menu_item_new(mn);
        e_menu_item_separator_set(mi, 1);
-       
-        e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
-        e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, &w, &h);
-        e_menu_activate_mouse(mn, 
e_util_zone_current_get(e_manager_current_get()),
-                              x + ev->output.x, y + 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);
+
+       e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
+       e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y,
+                                         &w, &h);
+       e_menu_activate_mouse(mn,
+                             e_util_zone_current_get(e_manager_current_get()),
+                             x + ev->output.x, y + 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);
      }
 }
 
 static void
-_ut_menu_cb_post(void *data, E_Menu *m) 
+_ut_menu_cb_post(void *data, E_Menu *m)
 {
-   if (!ut_config->menu) return;
+   if (ut_config->menu == NULL)
+     return;
    e_object_del(E_OBJECT(ut_config->menu));
    ut_config->menu = NULL;
 }
 
 static void
-_ut_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi) 
+_ut_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
 {
    Instance *inst;
    Config_Item *ci;
-   
+
    inst = data;
    ci = _ut_config_item_get(inst->gcc->id);
    _config_ut_module(ci);
 }
 
 static Config_Item *
-_ut_config_item_get(const char *id) 
+_ut_config_item_get(const char *id)
 {
    Evas_List *l;
    Config_Item *ci;
    char buf[4096];
-   
-   for (l = ut_config->items; l; l = l->next) 
+
+   for (l = ut_config->items; l; l = l->next)
      {
        ci = l->data;
-       if (!ci->id) continue;
-       if (!strcmp(ci->id, id)) return ci;
+       if (ci->id == NULL)
+         continue;
+       if (strcmp(ci->id, id) == 0)
+         return ci;
      }
+
    ci = E_NEW(Config_Item, 1);
    ci->id = evas_stringshare_add(id);
    ci->check_interval = 60.0;
-   
+   ci->update_interval = 60.0;
+
    ut_config->items = evas_list_append(ut_config->items, ci);
+
    return ci;
 }
 
 void
-_ut_config_updated(const char *id) 
+_ut_config_updated(const char *id)
 {
    Evas_List *l;
    Config_Item *ci;
-   
-   if (!ut_config) return;
+
+   if (ut_config == NULL)
+     return;
+
    ci = _ut_config_item_get(id);
-   for (l = ut_config->instances; l; l = l->next) 
+
+   for (l = ut_config->instances; l; l = l->next)
      {
        Instance *inst;
-       
+
        inst = l->data;
-       if (!inst->gcc->id) continue;
-       if (!strcmp(inst->gcc->id, ci->id)) 
+       if (inst->gcc->id == NULL)
+         continue;
+       if (strcmp(inst->gcc->id, ci->id) == 0)
          {
-            if (inst->monitor) ecore_timer_del(inst->monitor);
-            inst->monitor = ecore_timer_add(ci->check_interval, _ut_cb_check, 
inst);
+            if (inst->monitor != NULL)
+              ecore_timer_del(inst->monitor);
+            inst->monitor = ecore_timer_add(ci->update_interval, _ut_cb_check, 
inst);
             break;
          }
      }
-   return;
 }
 
-EAPI E_Module_Api e_modapi = {
+EAPI E_Module_Api e_modapi =
+{
    E_MODULE_API_VERSION,
-   "Uptime"
+     "Uptime"
 };
 
 EAPI void *
@@ -237,65 +282,74 @@
    bind_textdomain_codeset(PACKAGE, "UTF-8");
 
    conf_item_edd = E_CONFIG_DD_NEW("Uptime_Config_Item", Config_Item);
-   #undef T
-   #undef D
-   #define T Config_Item
-   #define D conf_item_edd
+#undef T
+#undef D
+#define T Config_Item
+#define D conf_item_edd
    E_CONFIG_VAL(D, T, id, STR);
-   E_CONFIG_VAL(D, T, check_interval, DOUBLE);
-   
+   E_CONFIG_VAL(D, T, check_interval, INT);
+   E_CONFIG_VAL(D, T, update_interval, INT);
+
    conf_edd = E_CONFIG_DD_NEW("Uptime_Config", Config);
-   #undef T
-   #undef D
-   #define T Config
-   #define D conf_edd
+#undef T
+#undef D
+#define T Config
+#define D conf_edd
    E_CONFIG_LIST(D, T, items, conf_item_edd);
-   
+
    ut_config = e_config_domain_load("module.uptime", conf_edd);
-   if (!ut_config) 
+   if (ut_config == NULL)
      {
        Config_Item *ci;
        char buf[4096];
-       
+
        ut_config = E_NEW(Config, 1);
        ci = E_NEW(Config_Item, 1);
        ci->id = evas_stringshare_add("0");
        ci->check_interval = 60.0;
+       ci->update_interval = 60.0;
        ut_config->items = evas_list_append(ut_config->items, ci);
      }
    ut_config->module = m;
    e_gadcon_provider_register(&_gc_class);
-   return 1;
+
+   return m;
 }
 
 EAPI int
 e_modapi_shutdown(E_Module *m)
 {
+
    ut_config->module = NULL;
    e_gadcon_provider_unregister(&_gc_class);
-   
-   if (ut_config->config_dialog) 
+
+   if (ut_config->config_dialog != NULL)
      e_object_del(E_OBJECT(ut_config->config_dialog));
-   
-   if (ut_config->menu) 
+
+   if (ut_config->menu)
      {
        e_menu_post_deactivate_callback_set(ut_config->menu, NULL, NULL);
        e_object_del(E_OBJECT(ut_config->menu));
        ut_config->menu = NULL;
      }
-   while (ut_config->items) 
+   while (ut_config->items)
      {
        Config_Item *ci;
-       
+
        ci = ut_config->items->data;
        ut_config->items = evas_list_remove_list(ut_config->items, 
ut_config->items);
-       if (ci->id) evas_stringshare_del(ci->id);
+
+       if (ci->id != NULL)
+         evas_stringshare_del(ci->id);
+
        free(ci);
      }
+
    free(ut_config);
    ut_config = NULL;
    E_CONFIG_DD_FREE(conf_item_edd);
    E_CONFIG_DD_FREE(conf_edd);
+
    return 1;
 }
 
@@ -303,35 +357,38 @@
 e_modapi_save(E_Module *m)
 {
    Evas_List *l;
-   
-   for (l = ut_config->instances; l; l = l->next) 
+
+   for (l = ut_config->instances; l; l = l->next)
      {
        Instance *inst;
        Config_Item *ci;
-       
+
        inst = l->data;
        ci = _ut_config_item_get(inst->gcc->id);
-       if (ci->id) evas_stringshare_del(ci->id);
+       if (ci->id != NULL)
+         evas_stringshare_del(ci->id);
        ci->id = evas_stringshare_add(inst->gcc->id);
      }
+
    e_config_domain_save("module.uptime", conf_edd, ut_config);
+
    return 1;
 }
 
 EAPI int
 e_modapi_about(E_Module *m)
 {
-   e_module_dialog_show(D_("Enlightenment Uptime Monitor Module"), 
+   e_module_dialog_show(D_("Enlightenment Uptime Monitor Module"),
                        D_("This module is used to monitor uptime."));
    return 1;
 }
 
 static Uptime *
-_ut_new(Evas *evas) 
+_ut_new(Evas *evas)
 {
    Uptime *ut;
-   char buf[4096];
-   
+   char        buf[4096];
+
    ut = E_NEW(Uptime, 1);
    snprintf(buf, sizeof(buf), "%s/uptime.edj", 
e_module_dir_get(ut_config->module));
 
@@ -339,38 +396,142 @@
    if (!e_theme_edje_object_set(ut->ut_obj, "base/theme/modules/uptime", 
"modules/uptime/main"))
      edje_object_file_set(ut->ut_obj, buf, "modules/uptime/main");
 
-   evas_object_show(ut->ut_obj);   
+   evas_object_show(ut->ut_obj);
    return ut;
 }
 
 static void
-_ut_free(Uptime *ut) 
+_ut_free(Uptime *ut)
 {
    evas_object_del(ut->ut_obj);
    free(ut);
 }
 
+static void
+update_counters(Instance *inst)
+{
+#ifdef __linux__
+   struct sysinfo s_info;
+#elif defined(__FreeBSD__)
+   FILE                *utmp;
+   struct timespec tp;
+   struct utmp ut;
+   char ttybuf[MAXPATHLEN];
+   struct stat st;
+   int ret;
+#endif
+
+   if (!inst) return;
+
+#ifdef __linux__
+   sysinfo(&s_info);
+   inst->uptime = s_info.uptime;
+
+   inst->la[0] = -1; /* unsupported */
+   inst->nusers = -1; /* unsupported */
+#elif defined(__FreeBSD__)
+   /* retrive uptime info */
+   ret = clock_gettime(CLOCK_UPTIME, &tp);
+   if (ret != 0)
+     {
+       warn("clock_gettime()");
+       inst->uptime = -1;
+     }
+   else
+     inst->uptime = tp.tv_sec;
+
+   /* retrive load averages */
+   ret = getloadavg(inst->la, sizeof(inst->la)/sizeof(inst->la[0]));
+   if (ret < 0)
+     {
+       warn("getloadavg()");
+       inst->la[0] = -1;
+     }
+
+   /* retrive number of active users */
+   utmp = fopen(_PATH_UTMP, "r");
+   if (utmp == NULL)
+     inst->nusers = -1;
+   else
+     {
+       for (inst->nusers = 0; fread(&ut, sizeof(ut), 1, utmp);)
+         {
+            if (ut.ut_name[0] == '\0')
+              continue;
+            (void)snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, 
UT_LINESIZE, ut.ut_line);
+            if (stat(ttybuf, &st) != 0)
+              continue;        /* broken record */
+
+            inst->nusers++;
+         }
+       fclose(utmp);
+     }
+#else /* unsupported */
+   inst->uptime = -1;
+   inst->nusers = -1;
+   inst->la[0] = -1;
+#endif
+}
+
 static int
 _ut_cb_check(void *data)
 {
    Instance *inst;
    Config_Item *ci;
-   long minute = 60;
-   long hour = minute * 60;
-   long day = hour * 24;
-   char u_date_time[256];
+   int days, hours, minutes;
+   char u_date_time[256] = "up: N/A";
+   char load_avg[256] = "la: N/A";
+   char users[256] = "users: N/A";
+   time_t uptime;
 
    inst = data;
-   if (!inst) return 0;
+   if (inst == 0)
+     return 0;
 
    ci = _ut_config_item_get(inst->gcc->id);
-   if (!ci) return 0;
-   
-   inst->uptime += (1 * ci->check_interval);
-   
-   sprintf(u_date_time, D_("uptime: %ld days, %ld:%02ld:%02ld"),
-           inst->uptime / day, (inst->uptime % day) / hour, (inst->uptime % 
hour) / minute, inst->uptime % minute);
+   if (ci == 0)
+     return 0;
+
+#ifdef UPTIME_DEBUG
+   syslog(LOG_EMERG, "counter = %d  update = %d\n", inst->counter, 
ci->check_interval);
+#endif
+
+   inst->counter += ci->update_interval;
+   if (inst->counter >= ci->check_interval)
+     {
+       inst->counter = 0;
+       (void)update_counters(inst);
+     }
+
+   uptime = inst->uptime + inst->counter;
+
+   if (uptime != -1)
+     {
+       days = uptime / (24 * 3600);
+       uptime %= 24 * 3600;
+
+       hours = uptime / 3600;
+       uptime %= 3600;
+
+       minutes = uptime / 60;
+       uptime %= 60;
+
+       snprintf(u_date_time, sizeof(u_date_time), 
+                D_("up: %ld days, %ld:%02ld:%02ld"), 
+                days, hours, minutes, uptime);
+     }
+
+   if (inst->la[0] != -1)
+     snprintf(load_avg, sizeof(load_avg), 
+             D_("la: %.2f %.2f %.2f"), 
+             inst->la[0], inst->la[1], inst->la[2]);
+
+   if (inst->nusers != -1)
+     snprintf(users, sizeof(users), D_("users: %d"), inst->nusers);
+
    edje_object_part_text_set(inst->ut->ut_obj, "uptime", u_date_time);
-   
+   edje_object_part_text_set(inst->ut->ut_obj, "load_average", load_avg);
+   edje_object_part_text_set(inst->ut->ut_obj, "nusers", users);
+
    return 1;
 }
===================================================================
RCS file: /cvs/e/e_modules/uptime/e_mod_main.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_mod_main.h        9 Jun 2006 11:42:59 -0000       1.5
+++ e_mod_main.h        28 Jun 2006 23:48:53 -0000      1.6
@@ -19,6 +19,7 @@
 {
    const char *id;
    int check_interval;
+   int update_interval;
 };
 
 EAPI extern E_Module_Api e_modapi;
===================================================================
RCS file: /cvs/e/e_modules/uptime/uptime.edc,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- uptime.edc  14 Jun 2006 01:03:32 -0000      1.8
+++ uptime.edc  28 Jun 2006 23:48:53 -0000      1.9
@@ -27,12 +27,12 @@
                       rel1
                         {
                            relative: 0.0 0.0;
-                           offset: 0 2;
+                           offset: 0 0;
                         }
                       rel2
                         {
-                           relative: 1.0 0.5;
-                           offset: -1 -1;
+                           relative: 1.0 0.33;
+                           offset: 0 0;
                         }
                       color: 255 255 255 255;
                       color2: 0 0 0 96;
@@ -40,6 +40,70 @@
                       text
                         {
                            text: "uptime";
+                           font: "VeraMono";
+                           size:  12;
+                           min:     1 1;
+                           align: 0.5 0.5;
+                        }
+                   }
+              }
+            part
+              {
+                 name,         "load_average";
+                 type,           TEXT;
+                 effect,         OUTLINE_SOFT_SHADOW;
+                 mouse_events, 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      rel1
+                        {
+                           relative: 0.0 0.33;
+                           offset: 0 0;
+                        }
+                      rel2
+                        {
+                           relative: 1.0 0.66;
+                           offset: 0 0;
+                        }
+                      color: 255 255 255 255;
+                      color2: 0 0 0 96;
+                      color3: 0 0 0 32;
+                      text
+                        {
+                           text: "load average";
+                           font: "VeraMono";
+                           size:  12;
+                           min:     1 1;
+                           align: 0.5 0.5;
+                        }
+                   }
+              }
+            part
+              {
+                 name,         "nusers";
+                 type,           TEXT;
+                 effect,         OUTLINE_SOFT_SHADOW;
+                 mouse_events, 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      rel1
+                        {
+                           relative: 0.0 0.66;
+                           offset: 0 0;
+                        }
+                      rel2
+                        {
+                           relative: 1.0 1.0;
+                           offset: 0 0;
+                        }
+                      color: 255 255 255 255;
+                      color2: 0 0 0 96;
+                      color3: 0 0 0 32;
+                      text
+                        {
+                           text: "users";
                            font: "VeraMono";
                            size:  12;
                            min:     1 1;



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

Reply via email to