2005-02-07 03:29:36 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2004-11-26 02:53:38 -08:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
/* gadcon requirements */
|
2006-05-31 09:19:11 -07:00
|
|
|
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
2006-04-20 04:30:25 -07:00
|
|
|
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
|
|
static void _gc_orient(E_Gadcon_Client *gcc);
|
2006-05-09 06:02:48 -07:00
|
|
|
static char *_gc_label(void);
|
|
|
|
static Evas_Object *_gc_icon(Evas *evas);
|
2006-04-20 04:30:25 -07:00
|
|
|
/* and actually define the gadcon class that this module provides (just 1) */
|
|
|
|
static const E_Gadcon_Client_Class _gadcon_class =
|
|
|
|
{
|
|
|
|
GADCON_CLIENT_CLASS_VERSION,
|
|
|
|
"clock",
|
|
|
|
{
|
2006-05-09 06:02:48 -07:00
|
|
|
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon
|
2006-08-08 23:38:35 -07:00
|
|
|
},
|
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
2006-04-20 04:30:25 -07:00
|
|
|
};
|
|
|
|
/**/
|
|
|
|
/***************************************************************************/
|
2004-11-26 02:53:38 -08:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
/* actual module specifics */
|
2005-02-09 03:48:55 -08:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
typedef struct _Instance Instance;
|
2004-11-26 02:53:38 -08:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
struct _Instance
|
|
|
|
{
|
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
Evas_Object *o_clock;
|
|
|
|
};
|
2005-02-09 03:48:55 -08:00
|
|
|
|
2006-05-09 06:02:48 -07:00
|
|
|
static E_Module *clock_module = NULL;
|
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
static E_Gadcon_Client *
|
2006-05-31 09:19:11 -07:00
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
2006-04-20 04:30:25 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
inst = E_NEW(Instance, 1);
|
|
|
|
|
|
|
|
o = edje_object_add(gc->evas);
|
|
|
|
e_theme_edje_object_set(o, "base/theme/modules/clock",
|
2006-08-22 21:02:03 -07:00
|
|
|
"e/modules/clock/main");
|
2006-04-20 04:30:25 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
|
|
gcc->data = inst;
|
|
|
|
|
|
|
|
inst->gcc = gcc;
|
|
|
|
inst->o_clock = o;
|
|
|
|
|
|
|
|
e_gadcon_client_util_menu_attach(gcc);
|
|
|
|
|
|
|
|
return gcc;
|
|
|
|
}
|
2005-02-10 03:54:18 -08:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
static void
|
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
|
|
{
|
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
inst = gcc->data;
|
|
|
|
evas_object_del(inst->o_clock);
|
|
|
|
free(inst);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gc_orient(E_Gadcon_Client *gcc)
|
|
|
|
{
|
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
inst = gcc->data;
|
|
|
|
e_gadcon_client_aspect_set(gcc, 16, 16);
|
|
|
|
e_gadcon_client_min_size_set(gcc, 16, 16);
|
|
|
|
}
|
2006-05-09 06:02:48 -07:00
|
|
|
|
|
|
|
static char *
|
|
|
|
_gc_label(void)
|
|
|
|
{
|
|
|
|
return _("Clock");
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_gc_icon(Evas *evas)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
char buf[4096];
|
|
|
|
|
|
|
|
o = edje_object_add(evas);
|
2006-09-03 00:42:06 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/module.edj",
|
2006-05-09 06:02:48 -07:00
|
|
|
e_module_dir_get(clock_module));
|
|
|
|
edje_object_file_set(o, buf, "icon");
|
|
|
|
return o;
|
|
|
|
}
|
2006-04-20 04:30:25 -07:00
|
|
|
/**/
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
|
|
|
|
/**/
|
|
|
|
/***************************************************************************/
|
2005-07-11 20:53:56 -07:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
/* module setup */
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI E_Module_Api e_modapi =
|
2005-09-23 10:13:47 -07:00
|
|
|
{
|
|
|
|
E_MODULE_API_VERSION,
|
2005-12-14 15:26:10 -08:00
|
|
|
"Clock"
|
2005-09-23 10:13:47 -07:00
|
|
|
};
|
|
|
|
|
2006-06-06 08:33:44 -07:00
|
|
|
EAPI void *
|
2006-05-09 06:02:48 -07:00
|
|
|
e_modapi_init(E_Module *m)
|
2004-11-26 02:53:38 -08:00
|
|
|
{
|
2006-05-09 06:02:48 -07:00
|
|
|
clock_module = m;
|
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
e_gadcon_provider_register(&_gadcon_class);
|
2006-07-24 21:11:41 -07:00
|
|
|
return m;
|
2004-11-26 02:53:38 -08:00
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2006-05-09 06:02:48 -07:00
|
|
|
e_modapi_shutdown(E_Module *m)
|
2004-11-26 02:53:38 -08:00
|
|
|
{
|
2006-05-09 06:02:48 -07:00
|
|
|
clock_module = NULL;
|
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
e_gadcon_provider_unregister(&_gadcon_class);
|
2004-11-26 02:53:38 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2006-05-09 06:02:48 -07:00
|
|
|
e_modapi_save(E_Module *m)
|
2004-11-26 02:53:38 -08:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2006-05-09 06:02:48 -07:00
|
|
|
e_modapi_about(E_Module *m)
|
2004-11-26 02:53:38 -08:00
|
|
|
{
|
2006-07-02 11:55:33 -07:00
|
|
|
e_module_dialog_show(m, _("Enlightenment Clock Module"),
|
2005-12-14 15:26:10 -08:00
|
|
|
_("A simple module to give E17 a clock."));
|
2005-09-20 23:57:36 -07:00
|
|
|
return 1;
|
2004-11-26 02:53:38 -08:00
|
|
|
}
|