Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/elation

Dir     : e17/apps/elation/src/bin


Modified Files:
        Elation.h elation_main.c elation_module.c 


Log Message:


disk checking is in a module of its own now. it forks of a slave to do the
checking too and ejecting. the eventual plan is to have the slave do all the
disk work that coudl block and it just messages back to the parent process
(via the disk module) whats going on. it does some of this already.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elation/src/bin/Elation.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Elation.h   18 Jul 2004 08:04:21 -0000      1.2
+++ Elation.h   20 Jul 2004 08:11:58 -0000      1.3
@@ -20,6 +20,9 @@
 struct _Elation_Info
 {
    Evas *evas;
+   struct {
+      void (*action_broadcast) (int action);
+   } func;
 };
 
 struct _Elation_Module
@@ -59,10 +62,15 @@
      ELATION_ACT_PAUSE,
      ELATION_ACT_STOP,
      ELATION_ACT_REC,
-     ELATION_ACT_SKIP
+     ELATION_ACT_SKIP,
+     ELATION_ACT_DISK_OUT,
+     ELATION_ACT_DISK_IN,
+     ELATION_ACT_DISK_EJECT
 };
 
 Elation_Module *elation_module_open(Elation_Info *info, Elation_Module *parent, char 
*name);
 void            elation_module_close(Elation_Module *em);
-
+void            elation_module_action_broadcast(int action);
+void            elation_module_resize_broadcast(void); 
+   
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elation/src/bin/elation_main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- elation_main.c      18 Jul 2004 08:04:21 -0000      1.2
+++ elation_main.c      20 Jul 2004 08:11:58 -0000      1.3
@@ -6,12 +6,13 @@
 int  main_signal_exit(void *data, int ev_type, void *ev);
 void main_delete_request(Ecore_Evas *ee);
 void bg_setup(void);
-void bg_resize(Evas_Coord w, Evas_Coord h);
-void menu_setup(void);
-void menu_resize(Evas_Coord w, Evas_Coord h);
+void bg_resize(void);
+void dvd_setup(void);
+void disk_setup(void);
 
 static Evas_Object *o_bg = NULL;
-static Elation_Module *em_menu = NULL;
+static Elation_Module *em_disk = NULL;
+static Elation_Module *em_dvd = NULL;
 
 Ecore_Evas  *ecore_evas = NULL;
 Evas        *evas       = NULL;
@@ -23,9 +24,15 @@
 int
 main(int argc, char **argv)
 {
+   /* methods modules can call */
+   elation_info.func.action_broadcast = elation_module_action_broadcast;
+   
    if (main_start(argc, argv) < 1) return -1;
    bg_setup();
-   menu_setup();
+   dvd_setup();
+   disk_setup();
+   bg_resize();
+   elation_module_resize_broadcast();
    ecore_main_loop_begin();
    main_stop();
    return 0;
@@ -127,11 +134,8 @@
 void
 main_resize(Ecore_Evas *ee)
 {
-   Evas_Coord w, h;
-   
-   evas_output_viewport_get(evas, NULL, NULL, &w, &h);
-   bg_resize(w, h);
-   menu_resize(w, h);
+   bg_resize();
+   elation_module_resize_broadcast();
 }
 
 int
@@ -153,7 +157,6 @@
 bg_setup(void)
 {
    Evas_Object *o;
-   Evas_Coord w, h;
 
    o = edje_object_add(evas);
    o_bg = o;
@@ -162,37 +165,48 @@
    evas_object_layer_set(o, -999);
    evas_object_show(o);   
    
-   evas_output_viewport_get(evas, NULL, NULL, &w, &h);
-   bg_resize(w, h);
 }
 
 void
-bg_resize(Evas_Coord w, Evas_Coord h)
+bg_resize(void)
 {
+   Evas_Coord w, h;
+   
+   evas_output_viewport_get(evas, NULL, NULL, &w, &h);
+   evas_object_move(o_bg, 0, 0);
    evas_object_resize(o_bg, w, h);
 }
 
-/*** menu ***/
+/*** dvd ***/
 
 void
-menu_setup(void)
+dvd_setup(void)
 {
    Elation_Module *em;
    Evas_Coord w, h;
    
    em = elation_module_open(&elation_info, NULL, "dvd");
-   em_menu = em;
+   em_dvd = em;
    if (em)
      {
        em->show(em);
        em->focus(em);
      }
-   evas_output_viewport_get(evas, NULL, NULL, &w, &h);
-   menu_resize(w, h);
 }
 
+/*** disk ***/
+
 void
-menu_resize(Evas_Coord w, Evas_Coord h)
+disk_setup(void)
 {
-   em_menu->resize(em_menu);
+   Elation_Module *em;
+   Evas_Coord w, h;
+   
+   em = elation_module_open(&elation_info, NULL, "disk");
+   em_disk = em;
+   if (em)
+     {
+       em->show(em);
+       em->focus(em);
+     }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elation/src/bin/elation_module.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- elation_module.c    18 Jul 2004 08:04:21 -0000      1.2
+++ elation_module.c    20 Jul 2004 08:11:58 -0000      1.3
@@ -2,6 +2,8 @@
 
 #include <dlfcn.h>
 
+Evas_List *modules = NULL;
+
 Elation_Module *
 elation_module_open(Elation_Info *info, Elation_Module *parent, char *name)
 {
@@ -9,7 +11,8 @@
    void *(*init) (Elation_Module *em);
    void *handle;
    char buf[4096];
-   
+
+   dlopen(NULL, RTLD_NOW | RTLD_GLOBAL);
    snprintf(buf, sizeof(buf), "%s/elation_%s.so", PACKAGE_LIB_DIR"/elation", name);
    handle = dlopen(buf, RTLD_NOW | RTLD_LOCAL);
    if (!handle)
@@ -43,6 +46,7 @@
        free(em);
        return NULL;
      }
+   modules = evas_list_append(modules, em);
    return em;
 }
 
@@ -66,6 +70,35 @@
    if (em->parent)
      em->parent->children = evas_list_remove(em->parent->children, em);
    
+   modules = evas_list_remove(modules, em);
    free(em);
 }
 
+void
+elation_module_action_broadcast(int action)
+{
+   Evas_List *l;
+   
+   /* FIXME: what if amodule quits as a result of an action???? */
+   for (l = modules; l; l = l->next)
+     {
+       Elation_Module *em;
+       
+       em = l->data;
+       if (em->action) em->action(em, action);
+     }
+}
+
+void
+elation_module_resize_broadcast(void)
+{
+   Evas_List *l;
+   
+   for (l = modules; l; l = l->next)
+     {
+       Elation_Module *em;
+       
+       em = l->data;
+       if (em->resize) em->resize(em);
+     }
+}




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to