Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src Modified Files: entropy_core.c notification_engine.c Log Message: * Work on the MIME engine =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_core.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- entropy_core.c 21 Nov 2005 11:50:54 -0000 1.24 +++ entropy_core.c 24 Nov 2005 04:03:13 -0000 1.25 @@ -147,6 +147,10 @@ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, ipc_client_data,core); + /*Initialize the mime hint hash*/ + core->mime_action_hint = ecore_hash_new(ecore_str_hash, ecore_str_compare); + + //printf ("Initialising the file cache..\n"); core->file_interest_list = ecore_hash_new(ecore_str_hash, ecore_str_compare); @@ -160,6 +164,10 @@ //Initialise the config system core->config = entropy_config_init(core); + + /*Load any config related core stuff*/ + entropy_core_config_load(); + /*Initialise epsilon thumbnailer*/ epsilon_init(); @@ -250,6 +258,8 @@ //printf("--------------- Running main\n"); + + printf("Going to main..\n"); (*entropy_plugin_layout_main)(); @@ -262,6 +272,88 @@ return core; } +void entropy_core_config_load() { + int count, new_count; + Ecore_List* mime_type_actions; + char* key; + int i=0; + char type[50]; + char* pos; + entropy_mime_action* action; + + printf("Loading core config...\n"); + + /*Set some defaults*/ + mime_type_actions = ecore_list_new(); + ecore_list_append(mime_type_actions, "image/jpeg:entice"); + ecore_list_append(mime_type_actions, "image/png:entice"); + ecore_list_append(mime_type_actions, "image/gif:entice"); + ecore_list_append(mime_type_actions, "text/html:/usr/bin/firefox"); + ecore_list_append(mime_type_actions, "text/csrc:gvim"); + ecore_list_append(mime_type_actions, "audio/x-mp3:xmms"); + ecore_list_append(mime_type_actions, "video/x-ms-wmv:mplayer"); + ecore_list_append(mime_type_actions, "video/mpeg:mplayer"); + ecore_list_append(mime_type_actions, "application/msword:abiword"); + ecore_list_append(mime_type_actions, "application/vnd.ms-excel:gnumeric"); + ecore_list_append(mime_type_actions, "video/x-msvideo:mplayer"); + + new_count = ecore_list_nodes(mime_type_actions); + + if ( (!(count = entropy_config_int_get("core","mime_type_count"))) || count < new_count || 1 ) { + + + entropy_config_int_set("core", "mime_type_count", new_count); + printf("Setting up initial mime types, writing %d (old was %d)..\n", new_count,count); + + while ( (key = ecore_list_remove_first(mime_type_actions))) { + snprintf(type,50,"mimetype_action.%d", i); + + entropy_config_str_set("core", type, key); + printf("Wrote '%s' \n", key); + + i++; + } + + ecore_list_destroy(mime_type_actions); + } + + + count = entropy_config_int_get("core","mime_type_count"); + printf("Have to load %d mime entries..\n", count); + + new_count=0; + while (new_count < count) { + snprintf(type,50,"mimetype_action.%d", new_count); + key = entropy_config_str_get("core", type); + pos = strrchr(key, ':'); + + + + if (pos >= 0) { + *pos = '\0'; + printf("Loading '%s', is '%s' -> '%s'\n", type, key, pos+1); + + action = entropy_malloc(sizeof(entropy_mime_action)); + action->executable = strdup(pos+1); + + ecore_hash_set(core_core->mime_action_hint, strdup(key), action); + + } + free(key); + + new_count++; + } + + + + + +} + +entropy_mime_action* entropy_core_mime_hint_get(char* mime_type) { + return ecore_hash_get(core_core->mime_action_hint, mime_type); +} + void entropy_core_destroy(entropy_core* core) { entropy_plugin* plugin; =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/notification_engine.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- notification_engine.c 27 Oct 2005 12:12:22 -0000 1.3 +++ notification_engine.c 24 Nov 2005 04:03:13 -0000 1.4 @@ -153,7 +153,7 @@ } - usleep(50); /*Allow the CPU to have a rest*/ + usleep(500); /*Allow the CPU to have a rest*/ } pthread_mutex_unlock(¬ify->loop_mutex); ------------------------------------------------------- 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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs