Added option to always show text on the icon.
Added option to launch an app on double-click. SVN revision: 28355
This commit is contained in:
parent
9fc831fc96
commit
735d25b743
106
net.edc
106
net.edc
|
@ -82,6 +82,94 @@ collections
|
|||
image.normal: "idle.png";
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "e.text.recv";
|
||||
type: TEXT;
|
||||
effect: SHADOW;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
visible: 1;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
to: "base";
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 0.5;
|
||||
offset: -1 0;
|
||||
to: "base";
|
||||
}
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 42;
|
||||
color_class: "menu_item";
|
||||
text
|
||||
{
|
||||
text: "Rx:";
|
||||
font: "VeraBold";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
text_class: "menu_item";
|
||||
elipsis: 0.0;
|
||||
}
|
||||
}
|
||||
description
|
||||
{
|
||||
state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "e.text.send";
|
||||
type: TEXT;
|
||||
effect: SHADOW;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
visible: 1;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.5;
|
||||
offset: 0 0;
|
||||
to: "base";
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
to: "base";
|
||||
}
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 42;
|
||||
color_class: "menu_item";
|
||||
text
|
||||
{
|
||||
text: "Tx:";
|
||||
font: "VeraBold";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
text_class: "menu_item";
|
||||
elipsis: 0.0;
|
||||
}
|
||||
}
|
||||
description
|
||||
{
|
||||
state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "overlay";
|
||||
|
@ -148,6 +236,24 @@ collections
|
|||
target: "tx";
|
||||
transition: DECELERATE 0.25;
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "text_hide";
|
||||
signal: "e,state,text,hide";
|
||||
source: "";
|
||||
action: STATE_SET "hidden" 0.0;
|
||||
target: "e.text.recv";
|
||||
target: "e.text.send";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "text_show";
|
||||
signal: "e,state,text,show";
|
||||
source: "";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "e.text.recv";
|
||||
target: "e.text.send";
|
||||
}
|
||||
}
|
||||
}
|
||||
group
|
||||
|
|
|
@ -18,7 +18,9 @@ _config_item_get(const char *id)
|
|||
ci = E_NEW(Config_Item, 1);
|
||||
ci->id = evas_stringshare_add(id);
|
||||
ci->device = evas_stringshare_add("eth0");
|
||||
ci->app = evas_stringshare_add("");
|
||||
ci->limit = 0;
|
||||
ci->show_text = 1;
|
||||
cfg->items = evas_list_append(cfg->items, ci);
|
||||
return ci;
|
||||
}
|
||||
|
@ -74,6 +76,11 @@ _config_updated(const char *id)
|
|||
if (strcmp(inst->gcc->id, id)) continue;
|
||||
if (!inst->timer)
|
||||
inst->timer = ecore_timer_add(0.5, _cb_poll, inst);
|
||||
if (!ci->show_text)
|
||||
edje_object_signal_emit(inst->o_net, "e,state,text,hide", "");
|
||||
else
|
||||
edje_object_signal_emit(inst->o_net, "e,state,text,show", "");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ struct _Config_Item
|
|||
{
|
||||
const char *id;
|
||||
const char *device;
|
||||
int limit;
|
||||
const char *app;
|
||||
int limit, show_text;
|
||||
};
|
||||
|
||||
EAPI Config_Item *_config_item_get(const char *id);
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
char *device;
|
||||
int limit;
|
||||
char *app;
|
||||
int limit, show_text;
|
||||
|
||||
Ecore_List *devs;
|
||||
int num;
|
||||
|
@ -71,10 +72,16 @@ _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
|
|||
char *tmp;
|
||||
int i = 0;
|
||||
|
||||
cfdata->device = NULL;
|
||||
if (ci->device)
|
||||
cfdata->device = strdup(ci->device);
|
||||
else
|
||||
cfdata->device = NULL;
|
||||
|
||||
cfdata->app = NULL;
|
||||
if (ci->app)
|
||||
cfdata->app = strdup(ci->app);
|
||||
|
||||
cfdata->show_text = ci->show_text;
|
||||
cfdata->limit = ci->limit;
|
||||
|
||||
cfdata->devs = _config_devices_get();
|
||||
if (!cfdata->devs) return;
|
||||
|
@ -88,7 +95,6 @@ _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
|
|||
}
|
||||
i++;
|
||||
}
|
||||
cfdata->limit = ci->limit;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
|
@ -100,13 +106,23 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
int i = 0;
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||
ob = e_widget_check_add(evas, _("Show Text"), &(cfdata->show_text));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_label_add(evas, _("Launch Application On Double-Click"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_entry_add(evas, &(cfdata->app));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Activity Notification Level"), 0);
|
||||
rg = e_widget_radio_group_new(&(cfdata->limit));
|
||||
ob = e_widget_radio_add(evas, "High (MB)", 1048575, rg);
|
||||
ob = e_widget_radio_add(evas, _("High (MB)"), 1048575, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, "Middle (KB)", 1023, rg);
|
||||
ob = e_widget_radio_add(evas, _("Middle (KB)"), 1023, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, "Low (B)", 0, rg);
|
||||
ob = e_widget_radio_add(evas, _("Low (B)"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
|
@ -140,7 +156,12 @@ _apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
ci->device = evas_stringshare_add(tmp);
|
||||
}
|
||||
ci->limit = cfdata->limit;
|
||||
ci->show_text = cfdata->show_text;
|
||||
|
||||
if (ci->app) evas_stringshare_del(ci->app);
|
||||
if (cfdata->app != NULL)
|
||||
ci->app = evas_stringshare_add(cfdata->app);
|
||||
|
||||
e_config_save_queue();
|
||||
_config_updated(ci->id);
|
||||
return 1;
|
||||
|
|
|
@ -59,24 +59,32 @@ _cb_poll(void *data)
|
|||
else
|
||||
edje_object_signal_emit(inst->o_net, "e,state,send,active", "e");
|
||||
|
||||
if (!inst->popup) return 1;
|
||||
|
||||
if (bin > 1048576)
|
||||
snprintf(tmp, sizeof(tmp), "Rx: %ld Mb", (bin / 1048576));
|
||||
snprintf(tmp, sizeof(tmp), "%ld Mb", (bin / 1048576));
|
||||
else if ((bin > 1024) && (bin < 1048576))
|
||||
snprintf(tmp, sizeof(tmp), "Rx: %ld Kb", (bin / 1024));
|
||||
snprintf(tmp, sizeof(tmp), "%ld Kb", (bin / 1024));
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp), "Rx: %ld B", bin);
|
||||
edje_object_part_text_set(inst->popup->o_bg, "e.text.recv", tmp);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%ld B", bin);
|
||||
edje_object_part_text_set(inst->o_net, "e.text.recv", tmp);
|
||||
if (inst->popup)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Rx: %s", tmp);
|
||||
edje_object_part_text_set(inst->popup->o_bg, "e.text.recv", buf);
|
||||
}
|
||||
|
||||
if (bout > 1048576)
|
||||
snprintf(tmp, sizeof(tmp), "Tx: %ld Mb", (bout / 1048576));
|
||||
snprintf(tmp, sizeof(tmp), "%ld Mb", (bout / 1048576));
|
||||
else if ((bout > 1024) && (bout < 1048576))
|
||||
snprintf(tmp, sizeof(tmp), "Tx: %ld Kb", (bout / 1024));
|
||||
snprintf(tmp, sizeof(tmp), "%ld Kb", (bout / 1024));
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp), "Tx: %ld B", bout);
|
||||
edje_object_part_text_set(inst->popup->o_bg, "e.text.send", tmp);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%ld B", bout);
|
||||
edje_object_part_text_set(inst->o_net, "e.text.send", tmp);
|
||||
if (inst->popup)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Tx: %s", tmp);
|
||||
edje_object_part_text_set(inst->popup->o_bg, "e.text.send", buf);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -84,11 +92,22 @@ EAPI void
|
|||
_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
Instance *inst;
|
||||
Config_Item *ci;
|
||||
Ecore_Exe *x;
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
|
||||
inst = data;
|
||||
ev = event;
|
||||
if ((ev->button == 1) && (!cfg->menu))
|
||||
ci = _config_item_get(inst->gcc->id);
|
||||
if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK))
|
||||
{
|
||||
if (ci->app != NULL)
|
||||
{
|
||||
x = ecore_exe_run(ci->app, NULL);
|
||||
if (x) ecore_exe_free(x);
|
||||
}
|
||||
}
|
||||
else if ((ev->button == 1) && (!cfg->menu))
|
||||
{
|
||||
if (inst->popup_locked)
|
||||
inst->popup_locked=0;
|
||||
|
|
Loading…
Reference in New Issue