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 = \
module_icon.png \
module.eap \
net.edj \
net.edc \
VeraMono.ttf
@ -24,9 +25,8 @@ pkgdir = $(datadir)/$(MODULE_ARCH)
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@ -lm
module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,14 +1,11 @@
#include <e.h>
#include <Ecore.h>
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "config.h"
struct _E_Config_Dialog_Data
{
char *device;
int check_interval;
int show_text;
int show_graph;
double poll_time;
Ecore_List *devs;
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 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 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);
/* Config Calls */
void
_configure_net_module(Net_Face *nf)
_config_net_module(Config_Item *ci)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
E_Container *con;
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.create_widgets = _basic_create_widgets;
cfd = e_config_dialog_new(nf->con, D_("Net Configuration"), NULL, 0, v, nf);
nf->net->cfd = cfd;
con = e_container_current_get(e_manager_current_get());
cfd = e_config_dialog_new(con, D_("Net Configuration"), NULL, 0, v, ci);
net_config->config_dialog = cfd;
}
static void
_fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata)
_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
{
char *tmp;
int i;
cfdata->check_interval = nf->conf->check_interval;
cfdata->show_text = nf->conf->show_text;
cfdata->show_graph = nf->conf->show_graph;
cfdata->poll_time = ci->poll_time;
if (nf->conf->device != NULL)
cfdata->device = strdup(nf->conf->device);
if (ci->device != NULL)
cfdata->device = strdup(ci->device);
else
cfdata->device = NULL;
@ -81,22 +78,20 @@ static void *
_create_data(E_Config_Dialog *cfd)
{
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);
_fill_data(nf, cfdata);
_fill_data(ci, cfdata);
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
Net_Face *nf;
nf = cfd->data;
nf->net->cfd = NULL;
if (!net_config)
return;
net_config->config_dialog = NULL;
E_FREE(cfdata->device);
if (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;
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);
ot = e_widget_table_add(evas, 0);
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:"));
e_widget_table_object_append(ot, ob, 0, i, 1, 1, 0, 0, 1, 0);
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_framelist_object_append(of, ot);
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)
{
char *tmp;
Net_Face *nf;
nf = cfd->data;
Config_Item *ci;
ci = cfd->data;
tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num);
if (tmp != NULL)
{
if (strcmp(tmp, nf->conf->device))
if (strcmp(tmp, ci->device))
{
_net_face_graph_clear(nf);
nf->conf->device = (char *)evas_stringshare_add(strdup(tmp));
evas_stringshare_del(ci->device);
ci->device = evas_stringshare_add(strdup(tmp));
}
}
nf->conf->check_interval = cfdata->check_interval;
nf->conf->show_text = cfdata->show_text;
nf->conf->show_graph = cfdata->show_graph;
ci->poll_time = cfdata->poll_time;
e_config_save_queue();
if (nf->monitor)
ecore_timer_interval_set(nf->monitor, (double)cfdata->check_interval);
_net_config_updated(ci->id);
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
typedef struct _Config Config;
typedef struct _Config_Face Config_Face;
typedef struct _Net Net;
typedef struct _Net_Face Net_Face;
typedef struct _Config_Item Config_Item;
struct _Config
struct _Config
{
Evas_List *faces;
};
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_Module *module;
E_Config_Dialog *config_dialog;
E_Menu *menu;
Net *net;
Evas_List *old_rx, *old_tx;
Config_Face *conf;
Evas_List *instances;
Evas_List *items;
};
Evas_Object *net_obj;
Evas_Object *event_obj;
Evas_Object *chart_obj;
Evas_Object *rtxt_obj;
Evas_Object *ttxt_obj;
Ecore_Timer *monitor;
E_Gadman_Client *gmc;
struct _Config_Item
{
const char *id;
const char *device;
double poll_time;
double max;
};
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_info(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

BIN
module.eap Normal file

Binary file not shown.

Binary file not shown.

550
net.edc
View File

@ -1,6 +1,28 @@
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
@ -13,190 +35,434 @@ collections
group
{
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
{
part
{
name: "net_clip";
type: RECT;
mouse_events: 0;
name: "fade_clip";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
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
{
relative: 0.0 0.0;
offset: 0 0;
}
rel2
{
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
{
normal: "eth_dev.png";
}
fill
{
smooth: 0;
normal: "module_icon.png";
}
color: 255 255 255 192;
}
}
part
{
name, "lines";
mouse_events, 0;
type, SWALLOW;
clip_to: "net_clip";
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;
name: "rx_meter";
type: IMAGE;
clip_to: "fade_clip";
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 255;
rel1
rel1
{
relative: 0.0 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
{
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;
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;
}
}
}
}
}
group
{
name: "modules/net/rx_text";
parts
programs
{
part
program
{
name: "net_clip";
type: RECT;
mouse_events: 0;
description
{
state: "default" 0.0;
color: 255 255 255 255;
rel1
{
relative: 0.0 0.0;
offset: 0 0;
}
rel2
{
relative: 1.0 1.0;
offset: -1 -1;
}
}
name: "go_active";
signal: "label_active";
source: "";
action: STATE_SET "visible" 0.0;
transition: SINUSOIDAL 0.5;
target: "rx_label";
target: "tx_label";
//after: "go_passive2";
}
part
program
{
name: "rx-text";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
clip_to: "net_clip";
mouse_events: 0;
description
{
state: "default" 0.0;
align: 1.0 1.0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
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;
}
}
name: "go_passive2";
signal: "label_passive2";
source: "";
action: ACTION_STOP;
target: "go_active";
//after: "go_passive2";
}
program
{
name: "go_passive";
signal: "label_passive";
source: "";
action: STATE_SET "default" 0.0;
transition: SINUSOIDAL 1.0;
target: "rx_label";
target: "tx_label";
}
}
}
}

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.