Enlightenment CVS committal

Author  : chaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src


Modified Files:
        entropy_core.c 


Log Message:
* Allow layouts to register as an event consumer, so that we can move some 
common functionality (progress events, overwrite dialogs, etc), from the local 
plugins, to their parents - this saves duplication, and makes coding a child 
plugin a heckload easier.

===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/entropy_core.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- entropy_core.c      3 Apr 2006 10:11:11 -0000       1.73
+++ entropy_core.c      5 Apr 2006 04:38:29 -0000       1.74
@@ -650,7 +650,8 @@
                        /*ID the global system toolkit*/
                        plugin->toolkit = 
entropy_plugin_helper_toolkit_get(plugin);
 
-                       /*Set this as the default toolkit/plugin type*/
+                       gui_event_callback = dlsym(plugin->dl_ref, 
"gui_event_callback");
+                       plugin->gui_event_callback_p = gui_event_callback;
                } else {
                        return 1;
                }
@@ -866,13 +867,25 @@
 
 /*Register a component to get events created by others in the same layout 
container*/
 void entropy_core_component_event_register(entropy_gui_component_instance* 
comp, char* event) {
+       entropy_gui_component_instance* layout;
+
+
+       if (!comp->layout_parent) {
+               /*This must be a layout (or the programmer has messed up,
+                * use this as the layout*/
+               layout = comp;
+               printf(" ******* Layout registered itself to receive events\n");
+       } else {
+               layout = comp->layout_parent;
+       }
+       
        /*First we have to see if this layout is currently registered with the 
core..*/
-       Ecore_Hash* event_hash = ecore_hash_get(core_core->layout_gui_events, 
comp->layout_parent);
+       Ecore_Hash* event_hash = ecore_hash_get(core_core->layout_gui_events, 
layout);
 
        //printf("   * Registering a component...\n");
 
        if (!event_hash) {
-               printf("Alert! - tried to register events for unreg layout 
component, %p\n", comp->layout_parent);
+               printf("Alert! - tried to register events for unreg layout 
component, %p\n", layout);
        } else {
                Ecore_List* event_list = ecore_hash_get(event_hash, event);
 
@@ -921,7 +934,7 @@
                layout = entropy_core_global_layout_get(instance->core);
        }
        //printf("Instance's core reference: instance: %p, %p\n", instance, 
instance->core);
-       lay_hash = ecore_hash_get(instance->core->layout_gui_events, layout);
+       lay_hash = ecore_hash_get(core_core->layout_gui_events, layout);
        if (!lay_hash) {
                printf("Error: Attempted to raise event for unregistered layout 
container (%p)\n", layout);
                entropy_free(event);




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to