parent
bfcc278324
commit
e71bfdddde
33
e_mod_main.c
33
e_mod_main.c
|
@ -17,6 +17,7 @@ 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);
|
||||
|
||||
/* Module Protos */
|
||||
static void _tclock_cb_mouse_down (void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
@ -34,7 +35,7 @@ Config *tclock_config = NULL;
|
|||
/* Define the class and gadcon functions this module provides */
|
||||
static const E_Gadcon_Client_Class _gc_class = {
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"tclock", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon},
|
||||
"tclock", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
|
||||
|
@ -100,7 +101,7 @@ _gc_shutdown (E_Gadcon_Client * gcc)
|
|||
tclock_config->instances =
|
||||
evas_list_remove (tclock_config->instances, inst);
|
||||
|
||||
if (evas_list_count(tclock_config->instances) <= 0)
|
||||
if (evas_list_count (tclock_config->instances) <= 0)
|
||||
{
|
||||
ecore_timer_del (check_timer);
|
||||
check_timer = NULL;
|
||||
|
@ -140,6 +141,15 @@ _gc_icon (Evas * evas)
|
|||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new (void)
|
||||
{
|
||||
Config_Item *ci;
|
||||
|
||||
ci = _tclock_config_item_get (NULL);
|
||||
return ci->id;
|
||||
}
|
||||
|
||||
static void
|
||||
_tclock_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
|
||||
void *event_info)
|
||||
|
@ -275,7 +285,25 @@ _tclock_config_item_get (const char *id)
|
|||
{
|
||||
Evas_List *l;
|
||||
Config_Item *ci;
|
||||
char buf[128];
|
||||
|
||||
if (!id)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
/* Create id */
|
||||
if (tclock_config->items)
|
||||
{
|
||||
const char *p;
|
||||
ci = evas_list_last (tclock_config->items)->data;
|
||||
p = strrchr (ci->id, '.');
|
||||
if (p) num = atoi (p + 1) + 1;
|
||||
}
|
||||
snprintf (buf, sizeof (buf), "%s.%d", _gc_class.name, num);
|
||||
id = buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (l = tclock_config->items; l; l = l->next)
|
||||
{
|
||||
ci = l->data;
|
||||
|
@ -284,6 +312,7 @@ _tclock_config_item_get (const char *id)
|
|||
if (!strcmp (ci->id, id))
|
||||
return ci;
|
||||
}
|
||||
}
|
||||
|
||||
ci = E_NEW (Config_Item, 1);
|
||||
ci->id = evas_stringshare_add (id);
|
||||
|
|
Loading…
Reference in New Issue