parent
02c668dab0
commit
0ba90c9c74
|
@ -2,18 +2,38 @@
|
|||
#include "e_mod_config.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_net.h"
|
||||
#include "e_mod_gadcon.h"
|
||||
|
||||
EAPI Config_Item *
|
||||
_config_item_get(const char *id)
|
||||
{
|
||||
Evas_List *l;
|
||||
Config_Item *ci;
|
||||
|
||||
for (l = cfg->items; l; l = l->next)
|
||||
char buf[128];
|
||||
|
||||
if (!id)
|
||||
{
|
||||
ci = l->data;
|
||||
if (!ci->id) continue;
|
||||
if (!strcmp(ci->id, id)) return ci;
|
||||
int num = 0;
|
||||
|
||||
/* Create id */
|
||||
if (cfg->items)
|
||||
{
|
||||
const char *p;
|
||||
ci = evas_list_last(cfg->items)->data;
|
||||
p = strrchr(ci->id, '.');
|
||||
if (p) num = atoi(p + 1) + 1;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s.%d", _gc_name(), num);
|
||||
id = buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (l = cfg->items; l; l = l->next)
|
||||
{
|
||||
ci = l->data;
|
||||
if (!ci->id) continue;
|
||||
if (!strcmp(ci->id, id)) return ci;
|
||||
}
|
||||
}
|
||||
ci = E_NEW(Config_Item, 1);
|
||||
ci->id = evas_stringshare_add(id);
|
||||
|
|
|
@ -9,11 +9,12 @@ static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|||
static void _gc_orient(E_Gadcon_Client *gcc);
|
||||
static char *_gc_label(void);
|
||||
static Evas_Object *_gc_icon(Evas *evas);
|
||||
static const char *_gc_id_new(void);
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION, "net",
|
||||
{_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon},
|
||||
{_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
|
||||
|
@ -28,8 +29,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|||
|
||||
inst = E_NEW(Instance, 1);
|
||||
inst->ci = _config_item_get(id);
|
||||
if (!inst->ci->id) evas_stringshare_add(id);
|
||||
|
||||
|
||||
inst->o_net = edje_object_add(gc->evas);
|
||||
if (!e_theme_edje_object_set(inst->o_net, "base/theme/modules/net",
|
||||
"modules/net/main"))
|
||||
|
@ -103,6 +103,15 @@ _gc_icon(Evas *evas)
|
|||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(void)
|
||||
{
|
||||
Config_Item *ci;
|
||||
|
||||
ci = _config_item_get(NULL);
|
||||
return ci->id;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
_gc_register(void)
|
||||
{
|
||||
|
@ -114,3 +123,9 @@ _gc_unregister(void)
|
|||
{
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
_gc_name(void)
|
||||
{
|
||||
return _gc_class.name;
|
||||
}
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
|
||||
EAPI void _gc_register(void);
|
||||
EAPI void _gc_unregister(void);
|
||||
EAPI const char *_gc_name(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue