Net module meets shelf :)

-Removed graphs (they ate memory for lunch).
    -Added led-type gradient indicators in place of graph.
    -Added mouse-over send and recieve values.

It may not be 100% perfect yet, but it won't crash E.

Users will need to remove any old module.net.cfg file they have before
running.


SVN revision: 22854
This commit is contained in:
Christopher Michael 2006-05-23 22:07:37 +00:00
parent b5d109c809
commit ea1f8be62b
30 changed files with 853 additions and 828 deletions

View File

@ -10,6 +10,7 @@ filesdir = $(datadir)
files_DATA = \ files_DATA = \
module_icon.png \ module_icon.png \
module.eap \
net.edj \ net.edj \
net.edc \ net.edc \
VeraMono.ttf VeraMono.ttf
@ -24,9 +25,8 @@ pkgdir = $(datadir)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h \
e_mod_config.c \ e_mod_config.c
e_mod_config.h
module_la_LIBADD = @e_libs@ -lm module_la_LIBADD = @e_libs@ -lm
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,14 +1,11 @@
#include <e.h> #include <e.h>
#include <Ecore.h>
#include "e_mod_main.h" #include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
char *device; char *device;
int check_interval; double poll_time;
int show_text;
int show_graph;
Ecore_List *devs; Ecore_List *devs;
int dev_num; int dev_num;
@ -19,15 +16,16 @@ static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); 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 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 int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata); static void _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata);
static void _net_config_get_devices(Ecore_List *devs); static void _net_config_get_devices(Ecore_List *devs);
/* Config Calls */ /* Config Calls */
void void
_configure_net_module(Net_Face *nf) _config_net_module(Config_Item *ci)
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Config_Dialog_View *v; E_Config_Dialog_View *v;
E_Container *con;
v = E_NEW(E_Config_Dialog_View, 1); v = E_NEW(E_Config_Dialog_View, 1);
@ -36,22 +34,21 @@ _configure_net_module(Net_Face *nf)
v->basic.apply_cfdata = _basic_apply_data; v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets; v->basic.create_widgets = _basic_create_widgets;
cfd = e_config_dialog_new(nf->con, D_("Net Configuration"), NULL, 0, v, nf); con = e_container_current_get(e_manager_current_get());
nf->net->cfd = cfd; cfd = e_config_dialog_new(con, D_("Net Configuration"), NULL, 0, v, ci);
net_config->config_dialog = cfd;
} }
static void static void
_fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata) _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
{ {
char *tmp; char *tmp;
int i; int i;
cfdata->check_interval = nf->conf->check_interval; cfdata->poll_time = ci->poll_time;
cfdata->show_text = nf->conf->show_text;
cfdata->show_graph = nf->conf->show_graph;
if (nf->conf->device != NULL) if (ci->device != NULL)
cfdata->device = strdup(nf->conf->device); cfdata->device = strdup(ci->device);
else else
cfdata->device = NULL; cfdata->device = NULL;
@ -81,22 +78,20 @@ static void *
_create_data(E_Config_Dialog *cfd) _create_data(E_Config_Dialog *cfd)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
Net_Face *nf; Config_Item *ci;
nf = cfd->data; ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(ci, cfdata);
_fill_data(nf, cfdata);
return cfdata; return cfdata;
} }
static void static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
Net_Face *nf; if (!net_config)
return;
nf = cfd->data; net_config->config_dialog = NULL;
nf->net->cfd = NULL;
E_FREE(cfdata->device); E_FREE(cfdata->device);
if (cfdata->devs) if (cfdata->devs)
ecore_list_destroy(cfdata->devs); ecore_list_destroy(cfdata->devs);
@ -112,13 +107,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
int i; int i;
o = e_widget_list_add(evas, 0, 0); o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, D_("General Settings"), 0);
ob = e_widget_check_add(evas, D_("Show Text"), (&(cfdata->show_text)));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, D_("Show Graph"), (&(cfdata->show_graph)));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, D_("Device Settings"), 0); of = e_widget_framelist_add(evas, D_("Device Settings"), 0);
ot = e_widget_table_add(evas, 0); ot = e_widget_table_add(evas, 0);
rg = e_widget_radio_group_new(&(cfdata->dev_num)); rg = e_widget_radio_group_new(&(cfdata->dev_num));
@ -134,7 +122,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
ob = e_widget_label_add(evas, D_("Check Interval:")); ob = e_widget_label_add(evas, D_("Check Interval:"));
e_widget_table_object_append(ot, ob, 0, i, 1, 1, 0, 0, 1, 0); e_widget_table_object_append(ot, ob, 0, i, 1, 1, 0, 0, 1, 0);
i++; i++;
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 60, 1, 0, NULL, &(cfdata->check_interval), 150); ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 60, 1, 0, &(cfdata->poll_time), NULL, 150);
e_widget_table_object_append(ot, ob, 0, i, 1, 1, 1, 0, 1, 0); e_widget_table_object_append(ot, ob, 0, i, 1, 1, 1, 0, 1, 0);
e_widget_framelist_object_append(of, ot); e_widget_framelist_object_append(of, ot);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
@ -146,27 +134,22 @@ static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{ {
char *tmp; char *tmp;
Net_Face *nf; Config_Item *ci;
nf = cfd->data; ci = cfd->data;
tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num); tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num);
if (tmp != NULL) if (tmp != NULL)
{ {
if (strcmp(tmp, nf->conf->device)) if (strcmp(tmp, ci->device))
{ {
_net_face_graph_clear(nf); evas_stringshare_del(ci->device);
nf->conf->device = (char *)evas_stringshare_add(strdup(tmp)); ci->device = evas_stringshare_add(strdup(tmp));
} }
} }
nf->conf->check_interval = cfdata->check_interval; ci->poll_time = cfdata->poll_time;
nf->conf->show_text = cfdata->show_text;
nf->conf->show_graph = cfdata->show_graph;
e_config_save_queue(); e_config_save_queue();
_net_config_updated(ci->id);
if (nf->monitor)
ecore_timer_interval_set(nf->monitor, (double)cfdata->check_interval);
return 1; return 1;
} }

View File

@ -1,11 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
#include "e_mod_main.h"
void _configure_net_module(Net_Face *nf);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -4,61 +4,34 @@
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
typedef struct _Config Config; typedef struct _Config Config;
typedef struct _Config_Face Config_Face; typedef struct _Config_Item Config_Item;
typedef struct _Net Net;
typedef struct _Net_Face Net_Face;
struct _Config struct _Config
{ {
Evas_List *faces; E_Module *module;
}; E_Config_Dialog *config_dialog;
struct _Config_Face
{
unsigned char enabled;
char *device;
int check_interval;
int show_text;
int show_graph;
};
struct _Net
{
E_Menu *config_menu;
Evas_List *faces;
Config *conf;
E_Config_Dialog *cfd;
};
struct _Net_Face
{
Evas *evas;
E_Container *con;
E_Menu *menu; E_Menu *menu;
Net *net; Evas_List *instances;
Evas_List *old_rx, *old_tx; Evas_List *items;
Config_Face *conf; };
Evas_Object *net_obj; struct _Config_Item
Evas_Object *event_obj; {
Evas_Object *chart_obj; const char *id;
Evas_Object *rtxt_obj; const char *device;
Evas_Object *ttxt_obj; double poll_time;
double max;
Ecore_Timer *monitor;
E_Gadman_Client *gmc;
}; };
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
EAPI void *e_modapi_init(E_Module *m); EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m); EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m); EAPI int e_modapi_save(E_Module *m);
EAPI int e_modapi_info(E_Module *m); EAPI int e_modapi_info(E_Module *m);
EAPI int e_modapi_about(E_Module *m); EAPI int e_modapi_about(E_Module *m);
EAPI int e_modapi_config(E_Module *m);
void _net_face_graph_clear(Net_Face *nf); void _net_config_updated(const char *id);
void _config_net_module(Config_Item *ci);
extern Config *net_config;
#endif #endif

BIN
module.eap Normal file

Binary file not shown.

Binary file not shown.

550
net.edc
View File

@ -1,6 +1,28 @@
images images
{ {
image: "eth_dev.png" COMP; image: "module_icon.png" COMP;
image: "rx_00.png" COMP;
image: "rx_01.png" COMP;
image: "rx_02.png" COMP;
image: "rx_03.png" COMP;
image: "rx_04.png" COMP;
image: "rx_05.png" COMP;
image: "rx_06.png" COMP;
image: "rx_07.png" COMP;
image: "rx_08.png" COMP;
image: "rx_09.png" COMP;
image: "rx_10.png" COMP;
image: "tx_00.png" COMP;
image: "tx_01.png" COMP;
image: "tx_02.png" COMP;
image: "tx_03.png" COMP;
image: "tx_04.png" COMP;
image: "tx_05.png" COMP;
image: "tx_06.png" COMP;
image: "tx_07.png" COMP;
image: "tx_08.png" COMP;
image: "tx_09.png" COMP;
image: "tx_10.png" COMP;
} }
fonts fonts
@ -13,190 +35,434 @@ collections
group group
{ {
name: "modules/net/main"; name: "modules/net/main";
min: 4 4;
max: 128 128;
script
{
public message(Msg_Type:type, id, ...)
{
if ((type == MSG_INT_SET) && (id == 1))
{
new f = getarg(2);
new Float:value;
value = f;
value = (value / 10);
set_state(PART:"rx_meter", "default", value);
}
if ((type == MSG_INT_SET) && (id == 2))
{
new f = getarg(2);
new Float:value;
value = f;
value = (value / 10);
set_state(PART:"tx_meter", "default", value);
}
}
}
parts parts
{ {
part part
{ {
name: "net_clip"; name: "fade_clip";
type: RECT; type: RECT;
mouse_events: 0; mouse_events: 1;
description description
{ {
state: "default" 0.0; state: "default" 0.0;
color: 255 255 255 255; color: 255 255 255 255;
}
}
part
{
name: "net";
clip_to: "net_clip";
mouse_events: 0;
description
{
state: "default" 0.0;
color: 255 255 255 176;
//aspect: 0.5 2.25;
rel1 rel1
{ {
relative: 0.0 0.0; relative: 0.0 0.0;
offset: 0 0;
} }
rel2 rel2
{ {
relative: 1.0 1.0; relative: 1.0 1.0;
offset: -1 -1;
}
}
}
part
{
name: "net";
type: IMAGE;
mouse_events: 1;
clip_to: "fade_clip";
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
rel1
{
relative: 0.0 0.0;
offset: 0 0;
}
rel2
{
relative: 1.0 1.0;
offset: -1 -1;
} }
image image
{ {
normal: "eth_dev.png"; normal: "module_icon.png";
}
fill
{
smooth: 0;
} }
color: 255 255 255 192;
} }
} }
part part
{ {
name, "lines"; name: "rx_meter";
mouse_events, 0; type: IMAGE;
type, SWALLOW; clip_to: "fade_clip";
clip_to: "net_clip"; mouse_events: 1;
description
{
state, "default" 0.0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
color, 0 0 0 0;
}
}
}
}
group
{
name: "modules/net/tx_text";
parts
{
part
{
name: "net_clip";
type: RECT;
mouse_events: 0;
description description
{ {
state: "default" 0.0; state: "default" 0.0;
color: 255 255 255 255; rel1
rel1
{ {
relative: 0.0 0.0; relative: 0.0 0.0;
offset: 0 0; offset: 0 0;
} }
rel2
{
relative: 1.0 0.25;
offset: -1 -1;
}
image
{
normal: "rx_00.png";
}
color: 255 255 255 192;
}
description
{
state: "default" 0.1;
inherit: "default" 0.0;
image
{
normal: "rx_01.png";
}
}
description
{
state: "default" 0.2;
inherit: "default" 0.0;
image
{
normal: "rx_02.png";
}
}
description
{
state: "default" 0.3;
inherit: "default" 0.0;
image
{
normal: "rx_03.png";
}
}
description
{
state: "default" 0.4;
inherit: "default" 0.0;
image
{
normal: "rx_04.png";
}
}
description
{
state: "default" 0.5;
inherit: "default" 0.0;
image
{
normal: "rx_05.png";
}
}
description
{
state: "default" 0.6;
inherit: "default" 0.0;
image
{
normal: "rx_06.png";
}
}
description
{
state: "default" 0.7;
inherit: "default" 0.0;
image
{
normal: "rx_07.png";
}
}
description
{
state: "default" 0.8;
inherit: "default" 0.0;
image
{
normal: "rx_08.png";
}
}
description
{
state: "default" 0.9;
inherit: "default" 0.0;
image
{
normal: "rx_09.png";
}
}
description
{
state: "default" 1.0;
inherit: "default" 0.0;
image
{
normal: "rx_10.png";
}
}
}
part
{
name: "rx_label";
type: TEXT;
clip_to: "fade_clip";
effect: SOFT_SHADOW;
description
{
state: "default" 0.0;
color: 255 255 255 0;
color3: 0 0 0 0;
visible: 0;
rel1
{
relative: 0.5 0.0;
offset: 0 0;
to: "rx_meter";
}
rel2 rel2
{
relative: 0.5 1.0;
offset: -1 -1;
to: "rx_meter";
}
text
{
text: "Rx: 10 Kbps";
font: "VeraMono";
size: 9;
min: 1 1;
align: 0.5 1.0;
text_class: "module_small";
}
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
color3: 0 0 0 42;
}
}
part
{
name: "tx_meter";
type: IMAGE;
clip_to: "fade_clip";
mouse_events: 1;
description
{
state: "default" 0.0;
rel1
{
relative: 0.0 0.75;
offset: 0 0;
}
rel2
{ {
relative: 1.0 1.0; relative: 1.0 1.0;
offset: -1 -1; offset: -1 -1;
} }
image
{
normal: "tx_00.png";
}
color: 255 255 255 192;
}
description
{
state: "default" 0.1;
inherit: "default" 0.0;
image
{
normal: "tx_01.png";
}
}
description
{
state: "default" 0.2;
inherit: "default" 0.0;
image
{
normal: "tx_02.png";
}
}
description
{
state: "default" 0.3;
inherit: "default" 0.0;
image
{
normal: "tx_03.png";
}
}
description
{
state: "default" 0.4;
inherit: "default" 0.0;
image
{
normal: "tx_04.png";
}
}
description
{
state: "default" 0.5;
inherit: "default" 0.0;
image
{
normal: "tx_05.png";
}
}
description
{
state: "default" 0.6;
inherit: "default" 0.0;
image
{
normal: "tx_06.png";
}
}
description
{
state: "default" 0.7;
inherit: "default" 0.0;
image
{
normal: "tx_07.png";
}
}
description
{
state: "default" 0.8;
inherit: "default" 0.0;
image
{
normal: "tx_08.png";
}
}
description
{
state: "default" 0.9;
inherit: "default" 0.0;
image
{
normal: "tx_09.png";
}
}
description
{
state: "default" 1.0;
inherit: "default" 0.0;
image
{
normal: "tx_10.png";
}
}
}
part
{
name: "tx_label";
type: TEXT;
clip_to: "fade_clip";
effect: SOFT_SHADOW;
description
{
state: "default" 0.0;
color: 255 255 255 0;
color3: 0 0 0 0;
visible: 0;
rel1
{
relative: 0.5 0.0;
offset: 0 0;
to: "tx_meter";
}
rel2
{
relative: 0.5 1.0;
offset: -1 -1;
to: "tx_meter";
}
text
{
text: "Tx: 10 Kbps";
font: "VeraMono";
size: 9;
min: 1 1;
align: 0.5 1.0;
text_class: "module_small";
}
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
color3: 0 0 0 42;
} }
} }
part
{
name: "tx-text";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
clip_to: "net_clip";
mouse_events: 0;
description
{
state: "default" 0.0;
align: 1.0 0.0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 0.0;
}
color: 128 255 128 255;
color2: 0 0 0 192;
color3: 128 128 128 192;
text
{
text: "Tx";
font: "VeraMono";
size: 10;
min: 1 1;
align: 1.0 0.0;
}
}
}
} }
} programs
group
{
name: "modules/net/rx_text";
parts
{ {
part program
{ {
name: "net_clip"; name: "go_active";
type: RECT; signal: "label_active";
mouse_events: 0; source: "";
description action: STATE_SET "visible" 0.0;
{ transition: SINUSOIDAL 0.5;
state: "default" 0.0; target: "rx_label";
color: 255 255 255 255; target: "tx_label";
rel1 //after: "go_passive2";
{
relative: 0.0 0.0;
offset: 0 0;
}
rel2
{
relative: 1.0 1.0;
offset: -1 -1;
}
}
} }
part program
{ {
name: "rx-text"; name: "go_passive2";
type: TEXT; signal: "label_passive2";
effect: OUTLINE_SOFT_SHADOW; source: "";
clip_to: "net_clip"; action: ACTION_STOP;
mouse_events: 0; target: "go_active";
description //after: "go_passive2";
{ }
state: "default" 0.0; program
align: 1.0 1.0; {
rel1 name: "go_passive";
{ signal: "label_passive";
relative: 0.0 0.0; source: "";
} action: STATE_SET "default" 0.0;
rel2 transition: SINUSOIDAL 1.0;
{ target: "rx_label";
relative: 1.0 1.0; target: "tx_label";
}
color: 255 192 128 255;
color2: 0 0 0 216;
color3: 128 128 128 192;
text
{
text: "Rx";
font: "VeraMono";
size: 10;
min: 1 1;
align: 1.0 1.0;
}
}
} }
} }
} }
} }

BIN
rx_00.png Normal file

Binary file not shown.

BIN
rx_01.png Normal file

Binary file not shown.

BIN
rx_02.png Normal file

Binary file not shown.

BIN
rx_03.png Normal file

Binary file not shown.

BIN
rx_04.png Normal file

Binary file not shown.

BIN
rx_05.png Normal file

Binary file not shown.

BIN
rx_06.png Normal file

Binary file not shown.

BIN
rx_07.png Normal file

Binary file not shown.

BIN
rx_08.png Normal file

Binary file not shown.

BIN
rx_09.png Normal file

Binary file not shown.

BIN
rx_10.png Normal file

Binary file not shown.

BIN
tx_00.png Normal file

Binary file not shown.

BIN
tx_01.png Normal file

Binary file not shown.

BIN
tx_02.png Normal file

Binary file not shown.

BIN
tx_03.png Normal file

Binary file not shown.

BIN
tx_04.png Normal file

Binary file not shown.

BIN
tx_05.png Normal file

Binary file not shown.

BIN
tx_06.png Normal file

Binary file not shown.

BIN
tx_07.png Normal file

Binary file not shown.

BIN
tx_08.png Normal file

Binary file not shown.

BIN
tx_09.png Normal file

Binary file not shown.

BIN
tx_10.png Normal file

Binary file not shown.