Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/modules/wizard
Modified Files:
Makefile.am e_mod_main.c e_wizard.c e_wizard.h
Added Files:
page_000.c page_100.c page_200.c
Log Message:
moving wizard pages to their own files - modules loaded. in alphabetical
order only if they start with "page_". this way 3rd parties can add new
wizard pages post e install (or remove them) without a recompile needed.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/modules/wizard/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 12 Aug 2007 10:16:26 -0000 1.1
+++ Makefile.am 14 Sep 2007 16:57:01 -0000 1.2
@@ -17,15 +17,34 @@
-I$(top_srcdir)/src/modules \
@e_cflags@
pkgdir =
$(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
-pkg_LTLIBRARIES = module.la
+pkg_LTLIBRARIES = module.la \
+ page_000.la \
+ page_100.la \
+ page_200.la
+
module_la_SOURCES = e_mod_main.c \
e_mod_main.h \
e_wizard.c \
e_wizard.h
-
+
module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h
+
+page_000_la_SOURCES = page_000.c
+page_000_la_LIBADD = @e_libs@ @dlopen_libs@
+page_000_la_LDFLAGS = -module -avoid-version
+page_000_la_DEPENDENCIES = $(top_builddir)/config.h
+
+page_100_la_SOURCES = page_100.c
+page_100_la_LIBADD = @e_libs@ @dlopen_libs@
+page_100_la_LDFLAGS = -module -avoid-version
+page_100_la_DEPENDENCIES = $(top_builddir)/config.h
+
+page_200_la_SOURCES = page_200.c
+page_200_la_LIBADD = @e_libs@ @dlopen_libs@
+page_200_la_LDFLAGS = -module -avoid-version
+page_200_la_DEPENDENCIES = $(top_builddir)/config.h
uninstall:
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
===================================================================
RCS file: /cvs/e/e17/apps/e/src/modules/wizard/e_mod_main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_mod_main.c 14 Sep 2007 13:58:18 -0000 1.3
+++ e_mod_main.c 14 Sep 2007 16:57:01 -0000 1.4
@@ -29,92 +29,45 @@
};
-static int t0_init (E_Wizard_Page *pg){
- return 1;
-}
-static int t0_shutdown (E_Wizard_Page *pg){
- return 1;
-}
-static int t0_show (E_Wizard_Page *pg){
- printf("t0\n");
- return 0; /* 1 == show ui, and wait for user, 0 == just continue */
-}
-static int t0_hide (E_Wizard_Page *pg){
- return 1;
-}
-static int t0_apply (E_Wizard_Page *pg){
- printf("a0\n");
- return 1;
-}
-
-static int t1_init (E_Wizard_Page *pg){
- return 1;
-}
-static int t1_shutdown (E_Wizard_Page *pg){
- return 1;
-}
-static int t1_show (E_Wizard_Page *pg){
- Evas_Object *ob, *o;
-
- printf("t1\n");
- ob = e_widget_list_add(pg->evas, 1, 0);
- o = e_widget_button_add(pg->evas,
- "Hello World", NULL,
- NULL, NULL, NULL);
- e_widget_list_object_append(ob, o, 0, 0, 0.5);
- evas_object_show(o);
- e_wizard_page_show(ob);
- pg->data = ob;
- return 1; /* 1 == show ui, and wait for user, 0 == just continue */
-}
-static int t1_hide (E_Wizard_Page *pg){
- evas_object_del(pg->data);
- return 1;
-}
-static int t1_apply (E_Wizard_Page *pg){
- printf("a1\n");
- return 1;
-}
-
-static int t2_init (E_Wizard_Page *pg){
- return 1;
-}
-static int t2_shutdown (E_Wizard_Page *pg){
- return 1;
-}
-static int t2_show (E_Wizard_Page *pg){
- Evas_Object *ob, *o;
-
- printf("t2\n");
- ob = e_widget_list_add(pg->evas, 1, 0);
- o = e_widget_button_add(pg->evas,
- "Hello to Another World", NULL,
- NULL, NULL, NULL);
- e_widget_list_object_append(ob, o, 0, 0, 0.5);
- evas_object_show(o);
- e_wizard_page_show(ob);
- pg->data = ob;
- return 1;
-}
-static int t2_hide (E_Wizard_Page *pg){
- evas_object_del(pg->data);
- return 1;
-}
-static int t2_apply (E_Wizard_Page *pg){
- printf("a2\n");
- return 1;
-}
-
-
EAPI void *
e_modapi_init(E_Module *m)
{
+ Ecore_List *files;
+ char buf[PATH_MAX];
+
conf_module = m;
e_wizard_init();
- e_wizard_page_add(t0_init, t0_shutdown, t0_show, t0_hide, t0_apply);
- e_wizard_page_add(t1_init, t1_shutdown, t1_show, t1_hide, t1_apply);
- e_wizard_page_add(t2_init, t2_shutdown, t2_show, t2_hide, t2_apply);
+ snprintf(buf, sizeof(buf), "%s/%s", e_module_dir_get(m), MODULE_ARCH);
+ files = ecore_file_ls(buf);
+ if (files)
+ {
+ char *file;
+
+ ecore_list_first_goto(files);
+ while ((file = ecore_list_current(files)))
+ {
+ if (!strncmp(file, "page_", 5))
+ {
+ void *handle;
+
+ snprintf(buf, sizeof(buf), "%s/%s/%s",
+ e_module_dir_get(m), MODULE_ARCH, file);
+ handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
+ if (handle)
+ {
+ e_wizard_page_add(handle,
+ dlsym(handle, "wizard_page_init"),
+ dlsym(handle, "wizard_page_shutdown"),
+ dlsym(handle, "wizard_page_show"),
+ dlsym(handle, "wizard_page_hide"),
+ dlsym(handle, "wizard_page_apply"));
+ }
+ }
+ ecore_list_next(files);
+ }
+ ecore_list_destroy(files);
+ }
e_wizard_go();
@@ -126,6 +79,9 @@
{
e_wizard_shutdown();
conf_module = NULL;
+// FIXME: wrong place
+// e_module_disable(m); /* disable - on restart this won't be loaded now */
+// e_sys_action_do(E_SYS_RESTART, NULL); /* restart e - cleanly try settings
*/
return 1;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/modules/wizard/e_wizard.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_wizard.c 14 Sep 2007 13:58:18 -0000 1.5
+++ e_wizard.c 14 Sep 2007 16:57:01 -0000 1.6
@@ -62,7 +62,10 @@
e_object_del(E_OBJECT(pops->data));
pops = evas_list_remove_list(pops, pops);
}
- /* FIXME: remove wizard module */
+ while (pages)
+ {
+ e_wizard_page_del(pages->data);
+ }
return 1;
}
@@ -190,7 +193,8 @@
/* FIXME: decide how pages are defined - how about an array of page structs? */
EAPI E_Wizard_Page *
-e_wizard_page_add(int (*init) (E_Wizard_Page *pg),
+e_wizard_page_add(void *handle,
+ int (*init) (E_Wizard_Page *pg),
int (*shutdown) (E_Wizard_Page *pg),
int (*show) (E_Wizard_Page *pg),
int (*hide) (E_Wizard_Page *pg),
@@ -202,19 +206,24 @@
pg = E_NEW(E_Wizard_Page, 1);
if (!pg) return NULL;
- pages = evas_list_append(pages, pg);
+ pg->handle = handle;
pg->evas = pop->evas;
+
pg->init = init;
pg->shutdown = shutdown;
pg->show = show;
pg->hide = hide;
pg->apply = apply;
+
+ pages = evas_list_append(pages, pg);
+
return pg;
}
EAPI void
e_wizard_page_del(E_Wizard_Page *pg)
{
+ if (pg->handle) dlclose(pg->handle);
pages = evas_list_remove(pages, pg);
free(pg);
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/modules/wizard/e_wizard.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_wizard.h 13 Sep 2007 13:58:23 -0000 1.3
+++ e_wizard.h 14 Sep 2007 16:57:01 -0000 1.4
@@ -11,6 +11,7 @@
struct _E_Wizard_Page
{
+ void *handle;
Evas *evas;
int (*init) (E_Wizard_Page *pg);
int (*shutdown) (E_Wizard_Page *pg);
@@ -23,11 +24,13 @@
EAPI int e_wizard_init(void);
EAPI int e_wizard_shutdown(void);
EAPI void e_wizard_go(void);
+EAPI void e_wizard_apply(void);
EAPI void e_wizard_next(void);
EAPI void e_wizard_back(void);
EAPI void e_wizard_page_show(Evas_Object *obj);
EAPI E_Wizard_Page *
- e_wizard_page_add(int (*init) (E_Wizard_Page *pg),
+ e_wizard_page_add(void *handle,
+ int (*init) (E_Wizard_Page *pg),
int (*shutdown) (E_Wizard_Page *pg),
int (*show) (E_Wizard_Page *pg),
int (*hide) (E_Wizard_Page *pg),
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs