Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src/plugins Modified Files: etk_list_viewer.c etk_structure_viewer.c layout_etk_simple.c layout_ewl_simple.c remote_thumbnailer.c Log Message: * Centralise structure/location config. * Make ETK and EWL layout plugins read from central location config * Fix bug in remote thumbnailer (it was luck that it ever worked) * Various other bug fixes =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/etk_list_viewer.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- etk_list_viewer.c 22 Feb 2006 13:09:47 -0000 1.16 +++ etk_list_viewer.c 22 Feb 2006 14:25:54 -0000 1.17 @@ -4,6 +4,7 @@ #include <limits.h> #include <time.h> #include <Etk.h> +#include "etk_progress_dialog.h" static int etk_callback_setup = 0; static Ecore_Hash* row_hash; @@ -352,6 +353,7 @@ break; case ENTROPY_NOTIFY_THUMBNAIL_REQUEST:{ + /*Only bother if we have a thumbnail, and a component */ if (el && comp) { gui_file *obj; @@ -373,9 +375,6 @@ etk_tree_thaw(ETK_TREE(viewer->tree)); - /*ewl_image_file_set (EWL_IMAGE (image), - obj->thumbnail->thumbnail_filename, 0);*/ - } else { printf ("ERR: Couldn't find a hash reference for this file!\n"); } @@ -458,9 +457,6 @@ entropy_core_component_event_register (instance, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS_EXTERNAL)); - entropy_core_component_event_register (instance, - entropy_core_gui_event_get - (ENTROPY_GUI_EVENT_FILE_REMOVE_DIRECTORY)); /*Register our interest in receiving file mod/create/delete notifications */ entropy_core_component_event_register (instance, @@ -489,6 +485,17 @@ entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_PROGRESS)); + /*We want to know if the backend needs feedback */ + entropy_core_component_event_register (instance, + entropy_core_gui_event_get + (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT)); + + /*We want to know about thumbnail available events */ + entropy_core_component_event_register (instance, + entropy_core_gui_event_get + (ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE)); + + if (!etk_callback_setup) { etk_callback_setup = 1; row_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/etk_structure_viewer.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- etk_structure_viewer.c 22 Feb 2006 13:09:48 -0000 1.8 +++ etk_structure_viewer.c 22 Feb 2006 14:25:54 -0000 1.9 @@ -6,7 +6,7 @@ #include "etk_progress_dialog.h" static int etk_callback_setup = 0; -static Ecore_Hash* instance_map_hash; +static Ecore_Hash* instance_map_hash = NULL; typedef struct entropy_etk_file_structure_viewer entropy_etk_file_structure_viewer; struct entropy_etk_file_structure_viewer =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_etk_simple.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- layout_etk_simple.c 21 Feb 2006 12:07:34 -0000 1.12 +++ layout_etk_simple.c 22 Feb 2006 14:25:54 -0000 1.13 @@ -73,67 +73,6 @@ return menu_item; } - -/*------------------------------------------------*/ -/*Config handlers*/ - - -Ecore_Hash * -layout_ewl_simple_parse_config (entropy_gui_component_instance * instance, - char *config) -{ - Ecore_Hash *ret = ecore_hash_new (ecore_str_hash, ecore_str_compare); - char *last; - - if (!strstr (config, "|")) { - char *name; - char *uri; - - printf ("Simple case - only one object...\n"); - - name = strtok (config, ";"); - uri = strtok (NULL, ";"); - - printf ("Name/uri is %s %s\n", name, uri); - - /*Cut the obj up by semicolon; */ - - } - else { - Ecore_List *objects = ecore_list_new (); - char *object; - char *name; - char *uri; - - printf ("Complex case, multiple objects...\n"); - - object = strtok (config, "|"); - ecore_list_append (objects, strdup (object)); - while ((object = strtok (NULL, "|"))) { - ecore_list_append (objects, strdup (object)); - } - - ecore_list_goto_first (objects); - while ((object = ecore_list_next (objects))) { - name = strtok (object, ";"); - uri = strtok (NULL, ";"); - - printf ("Name/uri is %s %s\n", name, uri); - - free (object); - } - ecore_list_destroy (objects); - - - - } - - return ret; -} - -/*------------------------------------------------*/ - - void entropy_plugin_init (entropy_core * core) { @@ -167,6 +106,54 @@ etk_main (); } +void layout_etk_simple_add_header(entropy_gui_component_instance* instance, char* name, char* uri) +{ + void *(*entropy_plugin_init) (entropy_core * core, + entropy_gui_component_instance *); + void *(*structure_plugin_init) (entropy_core * core, + entropy_gui_component_instance *, + void* parent_visual, + void *data); + + void *(*local_plugin_init) (entropy_core * core, + entropy_gui_component_instance *, + void *data); + + entropy_plugin *plugin; + entropy_plugin *structure; + entropy_plugin *local; + entropy_generic_file* file; + Etk_Tree_Row* row; + Etk_Tree_Col* col; + entropy_layout_gui* gui = instance->data; + + + + col = etk_tree_nth_col_get(ETK_TREE(gui->tree), 0); + + etk_tree_freeze(ETK_TREE(gui->tree)); + row = etk_tree_append(ETK_TREE(gui->tree), col, + etk_theme_icon_theme_get(), "places/start-here_16", _(name), NULL); + etk_tree_thaw(ETK_TREE(gui->tree)); + + + structure = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW); + structure_plugin_init = + dlsym (structure->dl_ref, "entropy_plugin_init"); + + file = entropy_core_parse_uri (uri); + /*We shouldn't really assume it's a folder - but it bootstraps us for + * now- FIXME*/ + strcpy(file->mime_type, "file/folder"); + + if (!strlen (file->mime_type)) { + entropy_mime_file_identify (instance->core->mime_plugins, file); + } + + instance = (*structure_plugin_init)(instance->core, instance, row,file); + instance->plugin = structure; +} + entropy_gui_component_instance * entropy_plugin_layout_create (entropy_core * core) { @@ -191,7 +178,6 @@ entropy_plugin *plugin; entropy_plugin *structure; entropy_plugin *local; - entropy_generic_file* file; Etk_Tree_Col* col; Etk_Tree_Row* row; Etk_Widget* vbox; @@ -203,6 +189,10 @@ char* md5; entropy_file_listener* listener; + Ecore_Hash* config_hash; + Ecore_List* config_hash_keys; + char *tmp,*key; + /*Entropy related init */ layout = entropy_malloc (sizeof (entropy_gui_component_instance)); /*Create a component instance */ gui = entropy_malloc (sizeof (entropy_layout_gui)); @@ -284,72 +274,36 @@ etk_widget_size_request_set(gui->tree, 180, 600); - /*Add test row */ - etk_tree_freeze(ETK_TREE(gui->tree)); - row = etk_tree_append(ETK_TREE(gui->tree), col, - etk_theme_icon_theme_get(), "places/start-here_16", _("Home Directory"), NULL); - etk_tree_thaw(ETK_TREE(gui->tree)); - - - structure = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW); - structure_plugin_init = - dlsym (structure->dl_ref, "entropy_plugin_init"); - - file = entropy_generic_file_new(); - - pos = strrchr(home, '/'); - *pos = '\0'; - pos++; - - strcpy(file->path, home); - strcpy(file->filename, pos); - strcpy(file->uri_base, "file"); - strcpy(file->mime_type, "file/folder"); - - listener = entropy_malloc(sizeof(entropy_file_listener)); - file->md5 = md5_entropy_path_file(file->uri_base, file->path, file->filename); - listener->file = file; - listener->count = 1; - entropy_core_file_cache_add(file->md5, listener); - - instance = (*structure_plugin_init)(core, layout, row,file); - instance->plugin = structure; - /*-----------------------*/ + /*Config load*/ + if (!(tmp = entropy_config_str_get ("layout_ewl_simple", "structure_bar"))) { + //layout_ewl_simple_config_create (core); + tmp = entropy_config_str_get ("layout_ewl_simple", "structure_bar"); + } - /*Add test row */ - etk_tree_freeze(ETK_TREE(gui->tree)); - row = etk_tree_append(ETK_TREE(gui->tree), col, - etk_theme_icon_theme_get(), "places/start-here_16", _("Filesystem Root"), NULL); - etk_tree_thaw(ETK_TREE(gui->tree)); + printf ("Config for layout is: '%s' (%d)\n", tmp, strlen (tmp)); + + config_hash = entropy_config_standard_structures_parse (layout, tmp); + config_hash_keys = ecore_hash_keys(config_hash); + while ( (key = ecore_list_remove_first(config_hash_keys))) { + char* uri = ecore_hash_get(config_hash, key); + layout_etk_simple_add_header (layout, key, uri); + + ecore_hash_remove(config_hash, key); + free(key); + free(uri); + } + ecore_list_destroy(config_hash_keys); + ecore_hash_destroy(config_hash); + entropy_free (tmp); - structure = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW); - structure_plugin_init = - dlsym (structure->dl_ref, "entropy_plugin_init"); - - file = entropy_generic_file_new(); - - strcpy(file->path, "/"); - strcpy(file->filename, "/"); - strcpy(file->uri_base, "file"); - strcpy(file->mime_type, "file/folder"); - - listener = entropy_malloc(sizeof(entropy_file_listener)); - file->md5 = md5_entropy_path_file(file->uri_base, file->path, file->filename); - listener->file = file; - listener->count = 1; - entropy_core_file_cache_add(file->md5, listener); - - - instance = (*structure_plugin_init)(core, layout, row,file); - instance->plugin = structure; - /*-----------------------*/ + /*Initialise the list view*/ local = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,ENTROPY_PLUGIN_GUI_COMPONENT_LOCAL_VIEW); local_plugin_init = dlsym (local->dl_ref, "entropy_plugin_init"); - instance = (*local_plugin_init)(core, layout,file); + instance = (*local_plugin_init)(core, layout,NULL); instance->plugin = local; etk_paned_add2(ETK_PANED(gui->paned), instance->gui_object, ETK_TRUE); =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- layout_ewl_simple.c 21 Feb 2006 12:02:55 -0000 1.45 +++ layout_ewl_simple.c 22 Feb 2006 14:25:54 -0000 1.46 @@ -32,8 +32,6 @@ char *name, char *uri); void layout_ewl_simple_add_config_location (entropy_gui_component_instance * instance, char *name, char *uri); -Ecore_Hash *layout_ewl_simple_parse_config (entropy_gui_component_instance * - instance, char *config); void __destroy_main_window (Ewl_Widget * main_win, void *ev_data, void *user_data); void contract_cb (Ewl_Widget * main_win, void *ev_data, void *user_data); @@ -595,63 +593,6 @@ } } -Ecore_Hash * -layout_ewl_simple_parse_config (entropy_gui_component_instance * instance, - char *config) -{ - Ecore_Hash *ret = ecore_hash_new (ecore_str_hash, ecore_str_compare); - - if (!strstr (config, "|")) { - char *name; - char *uri; - - //printf("Simple case - only one object...\n"); - - name = strtok (config, ";"); - uri = strtok (NULL, ";"); - - //printf("Name/uri is %s %s\n", name,uri); - - layout_ewl_simple_add_header (instance, name, uri); - - - - /*Cut the obj up by semicolon; */ - - } - else { - Ecore_List *objects = ecore_list_new (); - char *object; - char *name; - char *uri; - - //printf("Complex case, multiple objects...\n"); - - object = strtok (config, "|"); - ecore_list_append (objects, strdup (object)); - while ((object = strtok (NULL, "|"))) { - ecore_list_append (objects, strdup (object)); - } - - ecore_list_goto_first (objects); - while ((object = ecore_list_next (objects))) { - name = strtok (object, ";"); - uri = strtok (NULL, ";"); - - //printf("Name/uri is %s %s\n", name,uri); - - layout_ewl_simple_add_header (instance, name, uri); - - free (object); - } - ecore_list_destroy (objects); - - } - - return ret; -} - - void __destroy_main_window (Ewl_Widget * main_win, void *ev_data, void *user_data) { @@ -830,6 +771,11 @@ Ewl_Widget *menubar; Ewl_Widget *menu; Ewl_Widget *item; + + Ecore_Hash *config_hash; + Ecore_List *config_hash_keys; + char* key; + Ecore_List *local_plugins; entropy_gui_component_instance *instance; @@ -1075,7 +1021,20 @@ } printf ("Config for layout is: '%s' (%d)\n", tmp, strlen (tmp)); - layout_ewl_simple_parse_config (layout, tmp); + + config_hash = entropy_config_standard_structures_parse (layout, tmp); + config_hash_keys = ecore_hash_keys(config_hash); + while ( (key = ecore_list_remove_first(config_hash_keys))) { + char* uri = ecore_hash_get(config_hash, key); + layout_ewl_simple_add_header (layout, key, uri); + + ecore_hash_remove(config_hash, key); + free(key); + free(uri); + } + ecore_list_destroy(config_hash_keys); + ecore_hash_destroy(config_hash); + entropy_free (tmp); ewl_widget_show (box); =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/remote_thumbnailer.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- remote_thumbnailer.c 21 Feb 2006 10:45:18 -0000 1.7 +++ remote_thumbnailer.c 22 Feb 2006 14:25:54 -0000 1.8 @@ -110,6 +110,7 @@ gui_event_callback (entropy_notify_event * eevent, void *requestor, void *obj, entropy_gui_component_instance * comp) { + entropy_file_progress *progress; switch (eevent->event_type) { case ENTROPY_NOTIFY_USER_INTERACTION_YES_NO_ABORT: { @@ -125,8 +126,10 @@ (*operation_func)( id, ENTROPY_USER_INTERACTION_RESPONSE_YES ); } + break; + case ENTROPY_NOTIFY_FILE_PROGRESS:{ - entropy_file_progress *progress = obj; + progress = obj; if (progress->type == TYPE_END) { entropy_file_listener *listener; @@ -171,6 +174,7 @@ ENTROPY_EVENT_LOCAL); //printf("Removing reference to '%s'\n", listener->file->md5); + // entropy_core_file_cache_remove_reference (listener->file->md5); /*Remove the d/led image */ ------------------------------------------------------- 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