136 lines
2.8 KiB
C
136 lines
2.8 KiB
C
/*
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
*/
|
|
#include "e.h"
|
|
#include "e_mod_main.h"
|
|
|
|
/***************************************************************************/
|
|
/**/
|
|
/* gadcon requirements */
|
|
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style);
|
|
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
static void _gc_orient(E_Gadcon_Client *gcc);
|
|
/* 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",
|
|
{
|
|
_gc_init, _gc_shutdown, _gc_orient
|
|
}
|
|
};
|
|
/**/
|
|
/***************************************************************************/
|
|
|
|
/***************************************************************************/
|
|
/**/
|
|
/* actual module specifics */
|
|
|
|
typedef struct _Instance Instance;
|
|
|
|
struct _Instance
|
|
{
|
|
E_Gadcon_Client *gcc;
|
|
Evas_Object *o_clock;
|
|
};
|
|
|
|
static E_Gadcon_Client *
|
|
_gc_init(E_Gadcon *gc, char *name, char *id, char *style)
|
|
{
|
|
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",
|
|
"modules/clock/main");
|
|
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;
|
|
}
|
|
|
|
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);
|
|
}
|
|
/**/
|
|
/***************************************************************************/
|
|
|
|
/***************************************************************************/
|
|
/**/
|
|
|
|
/**/
|
|
/***************************************************************************/
|
|
|
|
/***************************************************************************/
|
|
/**/
|
|
/* module setup */
|
|
EAPI E_Module_Api e_modapi =
|
|
{
|
|
E_MODULE_API_VERSION,
|
|
"Clock"
|
|
};
|
|
|
|
EAPI void *
|
|
e_modapi_init(E_Module *module)
|
|
{
|
|
e_gadcon_provider_register(&_gadcon_class);
|
|
return 1;
|
|
}
|
|
|
|
EAPI int
|
|
e_modapi_shutdown(E_Module *module)
|
|
{
|
|
e_gadcon_provider_unregister(&_gadcon_class);
|
|
return 1;
|
|
}
|
|
|
|
EAPI int
|
|
e_modapi_save(E_Module *module)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
EAPI int
|
|
e_modapi_info(E_Module *module)
|
|
{
|
|
char buf[4096];
|
|
|
|
snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(module));
|
|
module->icon_file = strdup(buf);
|
|
return 1;
|
|
}
|
|
|
|
EAPI int
|
|
e_modapi_about(E_Module *module)
|
|
{
|
|
e_module_dialog_show(_("Enlightenment Clock Module"),
|
|
_("A simple module to give E17 a clock."));
|
|
return 1;
|
|
}
|