Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src


Modified Files:
        entropy_core.c main.c plugin_helper.c 


Log Message:
Lotsa changes (tm):
* Layout engine selector.  EWL layout engine is currently the default.  Can be 
selected with 'entropy --layout=(ewl|etk)'
* ETK structure viewer/ETK list viewer.  Currently needs a bit of work, but it 
functions.  Ability to add/remove locations coming soon.
* Core settings engine, and command line parser

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_core.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- entropy_core.c      4 Feb 2006 01:06:38 -0000       1.42
+++ entropy_core.c      20 Feb 2006 06:48:34 -0000      1.43
@@ -111,9 +111,26 @@
        return core;
 }
 
+void entropy_core_args_parse(entropy_core* core, int argc, char** argv) 
+{
+       int ac = 1;
 
+       /*Defaults*/
+       core->settings.layout_engine = "ewl";
+               
+       while (ac < argc) {
+               printf("Parsing '%s'...\n", argv[ac]);
 
-entropy_core* entropy_core_init() {
+               if (!strncmp(argv[ac], "--layout=", 9)) {
+                               core->settings.layout_engine = argv[ac]+9;
+                               printf("Layout engine is '%s'\n", 
core->settings.layout_engine);
+               }
+               
+               ac++;
+       }
+}
+
+entropy_core* entropy_core_init(int argc, char** argv) {
        entropy_plugin* plugin;
        void (*entropy_plugin_layout_main)();
        entropy_gui_component_instance* 
(*entropy_plugin_layout_create)(entropy_core*);
@@ -127,6 +144,9 @@
        entropy_core* core = entropy_core_new();
        core_core=core;
 
+       /*Read inbound arguments*/
+       entropy_core_args_parse(core, argc,argv);
+
        /*Init the file cache mutex*/
        pthread_mutex_init(&core->file_cache_mutex, NULL);
 
@@ -209,6 +229,7 @@
        layout->core = core;
        core->layout_global = layout;
        entropy_core_layout_register(core, layout);
+       printf("Registered global layout %p...\n", core->layout_global);
 
         /*Init the mime register */
         core->entropy_thumbnailers = entropy_thumbnailers_register_init();
@@ -219,8 +240,16 @@
 
         /*Load plugins*/
         ecore_list_goto_first(core->plugin_list);
-        while ( (plugin = ecore_list_next(core->plugin_list)) ) {
-                entropy_plugin_load(core, plugin);
+        while ( (plugin = ecore_list_current(core->plugin_list)) ) {
+                int res = entropy_plugin_load(core, plugin);
+               if (res) {
+                       printf("Removing plugin from list..%s\n", 
plugin->filename);
+                       ecore_list_remove(core->plugin_list);
+               } else {
+                       printf("Going to next plugin...%s\n", plugin->filename);
+                       ecore_list_next(core->plugin_list);
+               }
+               
         }
 
 
@@ -571,6 +600,7 @@
         int (*entropy_plugin_type_get)();
        int (*entropy_plugin_sub_type_get)();
        void* (*entropy_plugin_init)(entropy_core* core);
+       
 
        void (*gui_event_callback)(void*,void*);
 
@@ -628,21 +658,28 @@
 
 
         } else if (type == ENTROPY_PLUGIN_GUI_LAYOUT) {
-                //printf("Found a layout manager.\n");
-                core->layout_plugin = entropy_plugin_layout_register(plugin);
+                char* id = entropy_plugin_plugin_identify(plugin);
+               
+               if (!strncmp(core->settings.layout_engine, id, 
strlen(core->settings.layout_engine))) {
+                       core->layout_plugin = 
entropy_plugin_layout_register(plugin);
 
-               /*Initializing..*/
-               entropy_plugin_init = dlsym(plugin->dl_ref, 
"entropy_plugin_init");
-               (*entropy_plugin_init)(core);
+                       /*Initializing..*/
+                       entropy_plugin_init = dlsym(plugin->dl_ref, 
"entropy_plugin_init");
+                       (*entropy_plugin_init)(core);
 
-               
-               
-               
+                       /*ID the global system toolkit*/
+                       plugin->toolkit = 
entropy_plugin_helper_toolkit_get(plugin);
+
+                       /*Set this as the default toolkit/plugin type*/
+               } else {
+                       return 1;
+               }
         } else if (type == ENTROPY_PLUGIN_GUI_COMPONENT) {
                /* TODO Get the subtype */
 
                gui_event_callback = dlsym(plugin->dl_ref, 
"gui_event_callback");
                plugin->gui_event_callback_p = gui_event_callback;
+               plugin->toolkit = entropy_plugin_helper_toolkit_get(plugin);
 
                //printf("Setting components event callback to %p\n", 
gui_event_callback);
                
@@ -672,6 +709,11 @@
 }
 
 
+char* entropy_layout_global_toolkit_get() {
+       return core_core->layout_plugin->toolkit;
+}
+
+
 entropy_plugin* create_plugin_object(char* filename) {
         entropy_plugin* plugin = entropy_malloc(sizeof(entropy_plugin));
         strncpy(plugin->filename, filename, 254);
@@ -796,6 +838,7 @@
        
        /*First, make a new hash of event types for this new layout component, 
this will be the event hash*/
        if (comp) {
+               printf("Registered layout: %p\n", comp);
                hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
                ecore_hash_set(core->layout_gui_events, comp, hash);
 
@@ -841,14 +884,13 @@
        entropy_gui_component_instance* iter;
        Ecore_List* el; 
        Ecore_Hash* lay_hash;
+       entropy_gui_component_instance* layout = NULL;
 
        if (!instance) {
                printf("entropy_core_layout_notify_event: instance was 
NULL\n");        
                return;
        }
        
-
-       entropy_gui_component_instance* layout = NULL;
        if (event_type == ENTROPY_EVENT_LOCAL) {
 
                //If layout_parent is null, assume passed object *is* a layout. 
 FIXME bad - we should probably set a prop to layout
@@ -860,15 +902,10 @@
        } else if (event_type == ENTROPY_EVENT_GLOBAL) {
                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);
-
-
-
        if (!lay_hash) {
-               printf("Error: Attempted to raise event for unregistered layout 
container\n");
+               printf("Error: Attempted to raise event for unregistered layout 
container (%p)\n", layout);
                entropy_free(event);
                return;
        }
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- main.c      3 Jan 2006 10:48:23 -0000       1.3
+++ main.c      20 Feb 2006 06:48:35 -0000      1.4
@@ -38,7 +38,7 @@
 }
 
 
-int main() {
+int main(int argc, char** argv) {
        entropy_alert_init(NULL);
        
        struct sigaction action;
@@ -49,7 +49,7 @@
        sigaction(SIGSEGV, &action, NULL);
 
        
-       entropy_core_init();
+       entropy_core_init(argc,argv);
 
        return 0;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugin_helper.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- plugin_helper.c     2 Jan 2006 09:05:41 -0000       1.4
+++ plugin_helper.c     20 Feb 2006 06:48:35 -0000      1.5
@@ -16,6 +16,19 @@
 
 }
 
+char* entropy_plugin_helper_toolkit_get(entropy_plugin* plugin) {
+       char* (*_entropy_plugin_toolkit_get)(); 
+       char* res;
+       _entropy_plugin_toolkit_get = dlsym(plugin->dl_ref, 
"entropy_plugin_toolkit_get");
+
+       if (_entropy_plugin_toolkit_get) {
+               res = (*_entropy_plugin_toolkit_get)();
+               return res;
+       } else {
+               return NULL;
+       }
+}
+
 
 
 int entropy_core_plugin_type_get(entropy_plugin* plugin) {
@@ -54,7 +67,10 @@
         ecore_list_goto_first(plugins);
         while ( (list_item = ecore_list_next(plugins)) ) {
                /*printf("Scanning '%s' for first\n", list_item->filename);*/
-                if (list_item->type == type && (subtype == 
ENTROPY_PLUGIN_SUB_TYPE_ALL || subtype == list_item->subtype)) {
+                if (list_item->type == type && (subtype == 
ENTROPY_PLUGIN_SUB_TYPE_ALL || subtype == list_item->subtype)
+                && (type != ENTROPY_PLUGIN_GUI_COMPONENT || 
+               (type == ENTROPY_PLUGIN_GUI_COMPONENT && 
+                !strcmp(list_item->toolkit, 
entropy_layout_global_toolkit_get())))) {
                        return list_item;
                 }
         }
@@ -87,7 +103,10 @@
        while ( (list_item = ecore_list_next(plugins)) ) {
                /*printf("Scanning plugin: %s\n", list_item->filename);*/
                if (list_item->type == type && 
-                  (subtype == ENTROPY_PLUGIN_SUB_TYPE_ALL || subtype == 
list_item->subtype)) {
+                  (subtype == ENTROPY_PLUGIN_SUB_TYPE_ALL || subtype == 
list_item->subtype)
+                  && (type != ENTROPY_PLUGIN_GUI_COMPONENT || 
+               (type == ENTROPY_PLUGIN_GUI_COMPONENT && 
+                !strcmp(list_item->toolkit, 
entropy_layout_global_toolkit_get())))) {
                        ecore_list_append(plugin_list, list_item);
                }
        }




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to