Enlightenment CVS committal Author : devilhorns Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_int_config_modules.c Log Message: More Formatting...man this was a mess =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_config_modules.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_int_config_modules.c 20 Dec 2005 00:32:21 -0000 1.2 +++ e_int_config_modules.c 20 Dec 2005 00:44:42 -0000 1.3 @@ -2,7 +2,7 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ #include "e.h" - + /* PROTOTYPES - same all the time */ typedef struct _CFData CFData; typedef struct _E_Cfg_Mod_Data E_Cfg_Mod_Data; @@ -30,10 +30,9 @@ Evas_Object *mod_name; struct { - Evas_Object *configure, *enable, *disable; - Evas_Object *load, *unload, *loaded, *unloaded; - } - gui; + Evas_Object *configure, *enable, *disable; + Evas_Object *load, *unload, *loaded, *unloaded; + } gui; }; struct _E_Cfg_Mod_Data @@ -50,7 +49,7 @@ { E_Config_Dialog *cfd; E_Config_Dialog_View v; - + /* methods */ v.create_cfdata = _create_data; v.free_cfdata = _free_data; @@ -60,40 +59,40 @@ v.advanced.create_widgets = _advanced_create_widgets; /* create config diaolg for NULL object/data */ cfd = e_config_dialog_new(con, _("Modules Settings"), NULL, 0, &v, NULL); - return cfd; + return cfd; } /* FIXME : redo this to setup list of loaded and unloaded modules in one pass (easy):)*/ -void +void _e_config_module_list(Evas_List **b,char *dir,int loaded) { - Evas_List *l; - l = *b; + Evas_List *l; + l = *b; char fullpath[PATH_MAX]; if ((ecore_file_exists(dir)) && (ecore_file_is_dir(dir))) - { - Ecore_List *mods; - mods = ecore_file_ls(dir); - if (mods) + { + Ecore_List *mods; + mods = ecore_file_ls(dir); + if (mods) + { + char *mod; + int i = 0; + while ((mod = ecore_list_next(mods))) + { + snprintf(fullpath, sizeof(fullpath), "%s/%s", dir, mod); + if (ecore_file_is_dir(fullpath)) { - char *mod; - int i = 0; - while ((mod = ecore_list_next(mods))) - { - snprintf(fullpath, sizeof(fullpath), "%s/%s", dir, mod); - if (ecore_file_is_dir(fullpath)) - { - E_Module *m; - m = e_module_find(mod); - - if(!m && !loaded) - l = evas_list_append(l,mod); - else if(m && loaded) - l = evas_list_append(l,m); - } - } + E_Module *m; + m = e_module_find(mod); + + if(!m && !loaded) + l = evas_list_append(l,mod); + else if(m && loaded) + l = evas_list_append(l,m); } - } + } + } + } *b=l; } @@ -104,45 +103,45 @@ E_Config_Dialog *cfd; CFData *cfdata; E_Module *m; - + d = data; cfd = d->cfd; cfdata = cfd->cfdata; - + if(cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC) - { - m = d->mod; - cfd->data=m; - if(m->enabled) - { - e_widget_disabled_set(cfdata->gui.enable, 1); - e_widget_disabled_set(cfdata->gui.disable, 0); - if(m->func.config) - e_widget_disabled_set(cfdata->gui.configure, 0); - else - e_widget_disabled_set(cfdata->gui.configure, 1); - } - else - { - e_widget_disabled_set(cfdata->gui.configure, 1); - e_widget_disabled_set(cfdata->gui.enable, 0); - e_widget_disabled_set(cfdata->gui.disable, 1); - } + { + m = d->mod; + cfd->data=m; + if(m->enabled) + { + e_widget_disabled_set( cfdata->gui.enable, 1); + e_widget_disabled_set( cfdata->gui.disable, 0); + if(m->func.config) + e_widget_disabled_set( cfdata->gui.configure, 0); + else + e_widget_disabled_set( cfdata->gui.configure, 1); + } + else + { + e_widget_disabled_set( cfdata->gui.configure, 1); + e_widget_disabled_set( cfdata->gui.enable, 0); + e_widget_disabled_set( cfdata->gui.disable, 1); + } } else /* Load / Unload menu */ { if(!d->loaded)/* unloaded module was clicked */ { cfd->data=d->mod_name; - e_widget_disabled_set(cfdata->gui.load,0); - e_widget_disabled_set(cfdata->gui.unload,1); - e_widget_disabled_set(cfdata->gui.loaded,1); + e_widget_disabled_set(cfdata->gui.load, 0); + e_widget_disabled_set(cfdata->gui.unload, 1); + e_widget_disabled_set(cfdata->gui.loaded, 1); } else /* this is a loaded module */ { cfd->data=d->mod; - e_widget_disabled_set(cfdata->gui.load,1); - e_widget_disabled_set(cfdata->gui.unload,0); + e_widget_disabled_set(cfdata->gui.load, 1); + e_widget_disabled_set(cfdata->gui.unload, 0); } } } @@ -155,10 +154,10 @@ CFData *cfdata; Evas_Object *ob; - cfd = data; + cfd = data; cfdata = cfd->cfdata; e_module_new(cfd->data); - + cfd->view_dirty=1; } @@ -168,11 +167,11 @@ E_Module *m; E_Config_Dialog *cfd; CFData *cfdata; - + cfd = data; m = cfd->data; cfdata = cfd->cfdata; - + e_module_disable(m); e_object_del(E_OBJECT(m)); e_config_save_queue(); @@ -186,7 +185,7 @@ CFData *cfdata; E_Module *m; E_Cfg_Mod_Data *d; - + cfd = data; m = cfd->data; @@ -194,19 +193,19 @@ { e_module_save(m); e_module_disable(m); - - e_widget_disabled_set(cfdata->gui.configure, 1); - e_widget_disabled_set(cfdata->gui.enable, 0); - e_widget_disabled_set(cfdata->gui.disable, 1); + + e_widget_disabled_set( cfdata->gui.configure, 1); + e_widget_disabled_set( cfdata->gui.enable, 0); + e_widget_disabled_set( cfdata->gui.disable, 1); } else { e_module_enable(m); - + if(m->func.config) - e_widget_disabled_set(cfdata->gui.configure, 0); - e_widget_disabled_set(cfdata->gui.enable, 1); - e_widget_disabled_set(cfdata->gui.disable, 0); + e_widget_disabled_set( cfdata->gui.configure, 0); + e_widget_disabled_set( cfdata->gui.enable, 1); + e_widget_disabled_set( cfdata->gui.disable, 0); } } @@ -216,45 +215,47 @@ E_Config_Dialog *cfd; CFData *cfdata; E_Module *m; - + cfd = data; m = cfd->data; cfdata = cfd->cfdata; if(m->func.config) - { - m->func.config(m); - } - else - printf("Can't run config no module!!!\n");// Debug!! + { + m->func.config(m); + } + else + printf("Can't run config no module!!!\n");// Debug!! } + + /**--CREATE--**/ static void _fill_data(CFData *cfdata) { - char buf[4096]; - char fullpath[PATH_MAX]; - Evas_List *l=NULL; - - cfdata->umods = NULL; - - cfdata->mods= NULL; + char buf[4096]; + char fullpath[PATH_MAX]; + Evas_List *l=NULL; + + cfdata->umods = NULL; + + cfdata->mods= NULL; //e_module_list(); - + /* We could use e_module_list() but this method gives us alphabetical order */ - for(l = e_path_dir_list_get(path_modules);l;l = l->next) - { - E_Path_Dir *epd; - epd = l->data; - _e_config_module_list(&(cfdata->mods),epd->dir,1); - } - - for(l = e_path_dir_list_get(path_modules);l;l = l->next) - { - E_Path_Dir *epd; - epd = l->data; - _e_config_module_list(&(cfdata->umods),epd->dir,0); - } + for(l = e_path_dir_list_get(path_modules);l;l = l->next) + { + E_Path_Dir *epd; + epd = l->data; + _e_config_module_list(&(cfdata->mods),epd->dir,1); + } + + for(l = e_path_dir_list_get(path_modules);l;l = l->next) + { + E_Path_Dir *epd; + epd = l->data; + _e_config_module_list(&(cfdata->umods),epd->dir,0); + } } static void * @@ -265,10 +266,10 @@ * the running systems/config in the apply methods */ CFData *cfdata; - + cfdata = E_NEW(CFData, 1); _fill_data(cfdata); - + return cfdata; } @@ -283,14 +284,13 @@ static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata) { - return 1; /* Apply was OK */ + return 1; /* Apply was OK */ } static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata) { - - return 1; /* Apply was OK */ + return 1; /* Apply was OK */ } /**--GUI--**/ @@ -302,12 +302,12 @@ E_Radio_Group *rg; Evas_List *l; E_Module *m; - + _fill_data(cfdata); cfd->hide_buttons = 1; - + o = e_widget_list_add(evas, 0, 1); - of = e_widget_framelist_add(evas, "Modules", 1); + of = e_widget_framelist_add(evas, "Modules", 1); ob = e_widget_ilist_add(evas,16,16,NULL); for(l = cfdata->mods;l;l = l->next) { @@ -329,19 +329,19 @@ e_widget_ilist_go(ob); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - + of = e_widget_frametable_add(evas, "Actions", 1); - + ob = e_widget_button_add(evas, "Enable", NULL, _module_enable, cfd, NULL); cfdata->gui.enable = ob; e_widget_disabled_set(ob, 1); e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 32, 32, 1, 1); - + ob = e_widget_button_add(evas, "Disable", NULL, _module_enable, cfd, NULL); cfdata->gui.disable = ob; e_widget_disabled_set(ob, 1); e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 32, 32, 1, 1); - + ob = e_widget_button_add(evas, "Configure", NULL, _module_configure, cfd, NULL); cfdata->gui.configure=ob; e_widget_disabled_set(ob, 1); @@ -359,27 +359,27 @@ E_Radio_Group *rg; Evas_List *l; E_Module *m; - + _fill_data(cfdata); cfd->hide_buttons = 1; - + o = e_widget_list_add(evas, 0, 1); - + of = e_widget_framelist_add(evas, "Loaded", 1); ob = e_widget_ilist_add(evas,16,16,NULL); for(l = cfdata->mods;l;l = l->next) - { - E_Cfg_Mod_Data *cb_data; - m = l->data; - sob = e_icon_add(evas); - if (m->icon_file) - e_icon_file_set(sob,m->icon_file); - cb_data = E_NEW(E_Cfg_Mod_Data, 1); - cb_data->cfd = cfd; - cb_data->loaded = 1; - cb_data->mod = m; - e_widget_ilist_append(ob, sob, m->name, _e_config_mod_cb_standard, cb_data, m->name); - } + { + E_Cfg_Mod_Data *cb_data; + m = l->data; + sob = e_icon_add(evas); + if (m->icon_file) + e_icon_file_set(sob,m->icon_file); + cb_data = E_NEW(E_Cfg_Mod_Data, 1); + cb_data->cfd = cfd; + cb_data->loaded = 1; + cb_data->mod = m; + e_widget_ilist_append(ob, sob, m->name, _e_config_mod_cb_standard, cb_data, m->name); + } cfdata->gui.loaded = ob; e_widget_ilist_go(ob); e_widget_min_size_set(ob, 120, 120); @@ -391,33 +391,33 @@ cfdata->gui.load = ob; e_widget_disabled_set(ob, 1); e_widget_list_object_append(of, ob, 1, 1, 0.5); - - ob = e_widget_button_add(evas, "Unload", NULL, _module_unload, cfd, NULL); + + ob = e_widget_button_add(evas, "Unload", NULL, _module_unload, cfd, NULL); cfdata->gui.unload = ob; e_widget_disabled_set(ob, 1); e_widget_list_object_append(of, ob, 1, 1, 0.5); - e_widget_list_object_append(o, of, 1, 1, 0.5); + e_widget_list_object_append(o, of, 1, 1, 0.5); of = e_widget_framelist_add(evas, "Unloaded", 1); ob = e_widget_ilist_add(evas,16,16,NULL); for(l = cfdata->umods;l;l = l->next) - { - char *mod; - char *icon; - char buf[PATH_MAX]; - E_Cfg_Mod_Data *cb_data; - - mod = l->data; - sob = e_icon_add(evas); - snprintf(buf, sizeof(buf), "%s/module_icon.png", mod); - icon = e_path_find(path_modules, buf); - e_icon_file_set(sob,icon); - cb_data = E_NEW(CFData,1); - cb_data->cfd = cfd; - cb_data->loaded = 0; - cb_data->mod_name = strdup(mod); - e_widget_ilist_append(ob, sob, mod, _e_config_mod_cb_standard, cb_data, mod); - } + { + char *mod; + char *icon; + char buf[PATH_MAX]; + E_Cfg_Mod_Data *cb_data; + + mod = l->data; + sob = e_icon_add(evas); + snprintf(buf, sizeof(buf), "%s/module_icon.png", mod); + icon = e_path_find(path_modules, buf); + e_icon_file_set(sob,icon); + cb_data = E_NEW(CFData,1); + cb_data->cfd = cfd; + cb_data->loaded = 0; + cb_data->mod_name = strdup(mod); + e_widget_ilist_append(ob, sob, mod, _e_config_mod_cb_standard, cb_data, mod); + } cfdata->gui.unloaded = ob; e_widget_ilist_go(ob); e_widget_min_size_set(ob, 120, 120); ------------------------------------------------------- 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