Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : proto
Dir : e17/proto/entropy/src
Modified Files:
entropy_config.c entropy_core.c
Log Message:
* Make the addition (and saving) of new mime types and descriptions possible
again
* Cleanups in ewl list viewer
* More generic config work
* Cleanup in etk location add dialog
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_config.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- entropy_config.c 18 Mar 2006 08:04:10 -0000 1.10
+++ entropy_config.c 19 Mar 2006 00:35:26 -0000 1.11
@@ -97,8 +97,13 @@
Entropy_Config* entropy_config_init(entropy_core* core) {
struct stat config_dir_stat;
+ struct stat eetstat;
int i;
Eet_File* conf_file;
+ char* data;
+ int size_ret;
+ int ok;
+
Entropy_Config_Mime* mimes = calloc(1,sizeof(Entropy_Config_Mime));
@@ -169,6 +174,8 @@
EET_DATA_DESCRIPTOR_ADD_BASIC(_entropy_config_mime_binding_edd,
Entropy_Config_Mime_Binding,
"mime_type", mime_type, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_entropy_config_mime_binding_edd,
Entropy_Config_Mime_Binding,
+ "description", desc, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_LIST(_entropy_config_mime_binding_edd,
Entropy_Config_Mime_Binding, "actions", actions,
_entropy_config_mime_binding_action_edd);
@@ -192,106 +199,108 @@
+ /*Check for existence of eet file*/
+ //Does the config dir exist?
+ if (stat(_Entropy_Config->config_dir_and_file_eet, &eetstat)) {
+ //Make the dir..
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("image/jpeg",
+
entropy_config_binding_action_new("Exhibit (Single File)", "exhibit", "\%pf"),
+
entropy_config_binding_action_new("Exhibit (Directory)", "exhibit", "\%p"),
+ NULL
+ ));
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("image/png",
+
entropy_config_binding_action_new("Exhibit (Single File)", "exhibit", "\%pf"),
+
entropy_config_binding_action_new("Exhibit (Directory)", "exhibit", "\%p"),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("image/gif",
+
entropy_config_binding_action_new("Exhibit (Single File)", "exhibit", "\%pf"),
+
entropy_config_binding_action_new("Exhibit (Directory)", "exhibit", "\%p"),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("text/csrc",
+
entropy_config_binding_action_new("Gvim", "gvim", "\%pf"),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("text/html",
+
entropy_config_binding_action_new("Firefox", "firefox", "\%pf"),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("audio/x-mp3",
+
entropy_config_binding_action_new("Xmms", "xmms", "\%pf"),
+
entropy_config_binding_action_new("Mpg123 (via eVFS)", "evfscat \"%u\" | mpg123
-", ""),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("video/x-ms-wmv",
+
entropy_config_binding_action_new("MPlayer", "mplayer", "\%pf"),
+
entropy_config_binding_action_new("MPlayer (via evfs)", "evfscat \"%u\" |
mplayer -cache 4096 -", ""),
+
entropy_config_binding_action_new("Xine", "xine", "%pf"),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("video/mpeg",
+
entropy_config_binding_action_new("MPlayer", "mplayer", "\%pf"),
+
entropy_config_binding_action_new("MPlayer (via evfs)", "evfscat \"%u\" |
mplayer -cache 4096 -", ""),
+
entropy_config_binding_action_new("Xine", "xine", "%pf"),
+ NULL
+ ));
+
+ mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
+ entropy_config_binding_new("video/x-msvideo",
+
entropy_config_binding_action_new("MPlayer", "mplayer", "\%pf"),
+
entropy_config_binding_action_new("MPlayer (via evfs)", "evfscat \"%u\" |
mplayer -cache 4096 -", ""),
+
entropy_config_binding_action_new("Xine", "xine", "%pf"),
+ NULL
+ ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("image/jpeg",
- entropy_config_binding_action_new("Exhibit
(Single File)", "exhibit", "\%pf"),
- entropy_config_binding_action_new("Exhibit
(Directory)", "exhibit", "\%p"),
- NULL
- ));
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("image/png",
- entropy_config_binding_action_new("Exhibit
(Single File)", "exhibit", "\%pf"),
- entropy_config_binding_action_new("Exhibit
(Directory)", "exhibit", "\%p"),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("image/gif",
- entropy_config_binding_action_new("Exhibit
(Single File)", "exhibit", "\%pf"),
- entropy_config_binding_action_new("Exhibit
(Directory)", "exhibit", "\%p"),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("text/csrc",
- entropy_config_binding_action_new("Gvim",
"gvim", "\%pf"),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("text/html",
- entropy_config_binding_action_new("Firefox",
"firefox", "\%pf"),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("audio/x-mp3",
- entropy_config_binding_action_new("Xmms",
"xmms", "\%pf"),
- entropy_config_binding_action_new("Mpg123 (via
eVFS)", "evfscat \"%u\" | mpg123 -", ""),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("video/x-ms-wmv",
- entropy_config_binding_action_new("MPlayer",
"mplayer", "\%pf"),
- entropy_config_binding_action_new("MPlayer (via
evfs)", "evfscat \"%u\" | mplayer -cache 4096 -", ""),
- entropy_config_binding_action_new("Xine",
"xine", "%pf"),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("video/mpeg",
- entropy_config_binding_action_new("MPlayer",
"mplayer", "\%pf"),
- entropy_config_binding_action_new("MPlayer (via
evfs)", "evfscat \"%u\" | mplayer -cache 4096 -", ""),
- entropy_config_binding_action_new("Xine",
"xine", "%pf"),
- NULL
- ));
-
- mimes->mime_bindings = evas_list_append(mimes->mime_bindings,
- entropy_config_binding_new("video/x-msvideo",
- entropy_config_binding_action_new("MPlayer",
"mplayer", "\%pf"),
- entropy_config_binding_action_new("MPlayer (via
evfs)", "evfscat \"%u\" | mplayer -cache 4096 -", ""),
- entropy_config_binding_action_new("Xine",
"xine", "%pf"),
- NULL
- ));
-
- /*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,
"application/msword:abiword");
+ ecore_list_append(mime_type_actions,
"application/vnd.ms-excel:gnumeric");*/
- conf_file = eet_open(_Entropy_Config->config_dir_and_file_eet,
EET_FILE_MODE_WRITE);
- if (conf_file) {
- char* data;
- int size_ret;
- int ok;
+
+ conf_file = eet_open(_Entropy_Config->config_dir_and_file_eet,
EET_FILE_MODE_WRITE);
+ if (conf_file) {
+ printf("Conf file loaded to: %p\n", conf_file);
+
+ data =
eet_data_descriptor_encode(_entropy_config_mimes_edd, mimes, &size_ret);
- printf("Conf file loaded to: %p\n", conf_file);
-
- data =
- eet_data_descriptor_encode(_entropy_config_mimes_edd, mimes,
&size_ret);
-
- printf("Write data: %p\n", data);
-
- if ( !(ok = eet_write(conf_file, "/config_action", data,
- size_ret, 0))) {
- printf("Error writing data!\n");
+ printf("Write data: %p\n", data);
- }
+ if ( !(ok = eet_write(conf_file, "/config_action",
data,
+ size_ret, 0))) {
+ printf("Error writing data!\n");
+
+ }
- free(data);
- eet_close(conf_file);
+ free(data);
+ eet_close(conf_file);
+ }
+ }
+
- conf_file = eet_open(_Entropy_Config->config_dir_and_file_eet,
EET_FILE_MODE_READ);
-
+
+ /*Load the eet config*/
+ conf_file = eet_open(_Entropy_Config->config_dir_and_file_eet,
EET_FILE_MODE_READ);
+ if (conf_file) {
data = eet_read(conf_file, "/config_action", &size_ret);
- printf("Data is %p\n", data);
-
_Entropy_Config->Config_Mimes =
eet_data_descriptor_decode(_entropy_config_mimes_edd, data, size_ret);
-
}
+ /*------*/
+
+
/*Print them out..*/
entropy_config_mimes_print(_Entropy_Config->Config_Mimes);
@@ -352,12 +361,37 @@
}
+void entropy_config_eet_config_save()
+{
+ Eet_File* conf_file;
+ char* data;
+ int size_ret;
+ int ok;
+ Entropy_Config* config;
-void entropy_config_destroy(Entropy_Config* config) {
- //printf("Saving config to '%s'\n", config->config_dir_and_file);
- ecore_config_file_save(config->config_dir_and_file);
+ config = entropy_core_get_core()->config;
- //printf("STUB\n");
+
+ conf_file = eet_open(config->config_dir_and_file_eet,
EET_FILE_MODE_WRITE);
+ if (conf_file) {
+ data = eet_data_descriptor_encode(_entropy_config_mimes_edd,
config->Config_Mimes, &size_ret);
+ if ( !(ok = eet_write(conf_file, "/config_action", data,
+ size_ret, 0))) {
+ printf("Error writing data!\n");
+
+ }
+ free(data);
+ eet_close(conf_file);
+ }
+}
+
+
+void entropy_config_destroy(Entropy_Config* config)
+{
+ entropy_config_eet_config_save();
+
+ ecore_config_file_save(config->config_dir_and_file);
+
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_core.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- entropy_core.c 18 Mar 2006 08:04:10 -0000 1.59
+++ entropy_core.c 19 Mar 2006 00:35:26 -0000 1.60
@@ -334,8 +334,13 @@
return core;
}
-void entropy_core_mime_action_add(char* mime_type, char* action) {
- entropy_mime_action* action_o;
+void entropy_core_mime_action_add(char* mime_type, char* desc)
+{
+ Entropy_Config_Mime_Binding* binding;
+ Evas_List* l;
+ int found = 0;
+
+ /*entropy_mime_action* action_o;
if ( ! (action_o = ecore_hash_get (core_core->mime_action_hint,
mime_type))) {
action_o = entropy_malloc(sizeof(entropy_mime_action));
@@ -344,10 +349,34 @@
} else {
free(action_o->executable);
action_o->executable = strdup(action);
+ }*/
+
+ for (l = core_core->config->Config_Mimes->mime_bindings; l; ) {
+ binding = l->data;
+
+ /*If this exists, change the desc to whatever they say*/
+ if (!strcmp(binding->mime_type, mime_type)) {
+ found = 1;
+ binding->desc = strdup(desc);
+ }
+
+ l = l->next;
}
+
+ /*IF not found, make a new one*/
+ if (!found) {
+ binding = calloc(1,sizeof(Entropy_Config_Mime_Binding));
+ binding->mime_type = strdup(mime_type);
+ binding->desc = strdup(desc);
+ core_core->config->Config_Mimes->mime_bindings =
+
evas_list_append(core_core->config->Config_Mimes->mime_bindings, binding);
+ }
+
+
}
-void entropy_core_config_load() {
+void entropy_core_config_load()
+{
int count, new_count;
Ecore_List* mime_type_actions;
char* key;
@@ -509,6 +538,10 @@
char* key;
//printf("Destroying config subsystem...\n");
+ /*Save the config*/
+ entropy_core_config_save();
+
+ entropy_config_destroy(core->config);
/*Destroy the notification engines*/
@@ -564,12 +597,6 @@
/*Destroy the plugins*/
/*Destroy the eLists/eHashes*/
-
- /*Save the config*/
- entropy_core_config_save();
-
- entropy_config_destroy(core->config);
-
}
void entropy_layout_run(entropy_core* core) {
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs