From 76a332743b26e5f06d5f45f5c6bbed3fd827cfa7 Mon Sep 17 00:00:00 2001 From: rephorm Date: Thu, 1 Dec 2005 05:19:19 +0000 Subject: [PATCH] oops forgot these. SVN revision: 18743 --- src/modules/gadget_test/Makefile.am | 25 ++++++++ src/modules/gadget_test/e_mod_main.c | 107 +++++++++++++++++++++++++++++++++++ src/modules/gadget_test/e_mod_main.h | 17 ++++++ 3 files changed, 149 insertions(+) create mode 100644 src/modules/gadget_test/Makefile.am create mode 100644 src/modules/gadget_test/e_mod_main.c create mode 100644 src/modules/gadget_test/e_mod_main.h diff --git a/src/modules/gadget_test/Makefile.am b/src/modules/gadget_test/Makefile.am new file mode 100644 index 0000000..292a811 --- /dev/null +++ b/src/modules/gadget_test/Makefile.am @@ -0,0 +1,25 @@ +MAINTAINERCLEANFILES = Makefile.in +MODULE = gadget_test + +# data files for the module +filesdir = $(libdir)/enlightenment/modules/$(MODULE) +files_DATA = +EXTRA_DIST = $(files_DATA) + +# the module .so file +INCLUDES = -I. \ + -I$(top_srcdir) \ + -I$(includedir) \ + -I$(top_srcdir)/$(MODULE) \ + -I$(top_srcdir)/src/bin \ + -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/src/modules \ + @e_cflags@ +pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h +module_la_LIBADD = @e_libs@ @dlopen_libs@ +module_la_LDFLAGS = -module -avoid-version +module_la_DEPENDENCIES = $(top_builddir)/config.h + diff --git a/src/modules/gadget_test/e_mod_main.c b/src/modules/gadget_test/e_mod_main.c new file mode 100644 index 0000000..a0260cc --- /dev/null +++ b/src/modules/gadget_test/e_mod_main.c @@ -0,0 +1,107 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" +#include "e_mod_main.h" + +E_Module_Api e_modapi = +{ + E_MODULE_API_VERSION, + "Gadget Test" +}; + +static void _test_face_init(void *data, E_Gadget_Face *face); +static void _test_face_free(void *data, E_Gadget_Face *face); +static void _test_face_change(void *data, E_Gadget_Face *face, E_Gadman_Client *gmc, E_Gadman_Change change); +static void _test_menu_init(void *data, E_Gadget *gad); +static void _test_face_menu_init(void *data, E_Gadget_Face *face); + + +void * +e_modapi_init(E_Module *m) +{ + E_Gadget *gad = NULL; + + Test *t = E_NEW(Test, 1); + + gad = e_gadget_new(m, + "test_gadget", + _test_face_init, + _test_face_free, + _test_face_change, + _test_menu_init, + _test_face_menu_init, + t); + + return gad; +} + +int +e_modapi_shutdown(E_Module *m) +{ + E_Gadget *gad; + + gad = m->data; + if (gad) e_object_del(E_OBJECT(gad)); + return 1; +} + +int +e_modapi_save(E_Module *m) +{ + return 1; +} + +int +e_modapi_info(E_Module *m) +{ + return 1; +} + +int +e_modapi_about(E_Module *m) +{ + e_module_dialog_show(_("Enlightenment Test Module"), _("Gadget test")); + return 1; +} + +static void +_test_face_init(void *data, E_Gadget_Face *face) +{ + Test *t = data; + + e_gadget_face_theme_set(face, "base/theme/modules/clock", "modules/clock/main"); + +} + +static void +_test_face_free(void *data, E_Gadget_Face *face) +{ + Test *t; + t = data; + if (t) free(t); +} + +static void +_test_face_change(void *data, E_Gadget_Face *face, E_Gadman_Client *gmc, E_Gadman_Change change) +{ + printf("change face!\n"); +} + +static void +_test_menu_init(void *data, E_Gadget *gad) +{ + E_Menu_Item *mi; + + mi = e_menu_item_new(gad->menu); + e_menu_item_label_set(mi, _("Test Menu Item")); +} + +static void +_test_face_menu_init(void *data, E_Gadget_Face *face) +{ + E_Menu_Item *mi; + + mi = e_menu_item_new(face->menu); + e_menu_item_label_set(mi, _("Test Face Menu Item")); +} diff --git a/src/modules/gadget_test/e_mod_main.h b/src/modules/gadget_test/e_mod_main.h new file mode 100644 index 0000000..6c3d899 --- /dev/null +++ b/src/modules/gadget_test/e_mod_main.h @@ -0,0 +1,17 @@ +#ifndef E_MOD_MAIN_H +#define E_MOD_MAIN_H + +typedef struct _Test Test; +struct _Test +{ + int val; +}; +extern E_Module_Api e_modapi; + +EAPI void *e_modapi_init (E_Module *m); +EAPI int e_modapi_shutdown (E_Module *m); +EAPI int e_modapi_save (E_Module *m); +EAPI int e_modapi_info (E_Module *m); +EAPI int e_modapi_about (E_Module *m); + +#endif -- 2.7.4