On Fri, Mar 5, 2010 at 6:45 PM, Enlightenment SVN <no-re...@enlightenment.org> wrote: > #include <Elementary.h> > #include <Ecore_X.h> > @@ -45,7 +44,6 @@ > extern char * url_post; > extern char * url_friends; > extern int debug; > -extern GConfClient *conf_client;
try to remove these variables shared amongst modules... keep the variables as "static" in their own modules and provide higher level ways to access them from others... you'll avoid lots of programming bugs by doing that. > void toggle_fullscreen(Eina_Bool new_fullscreen) { > - char * fs_icon; > + char * fs_value=NULL; > + int res=0; > > - if(new_fullscreen) > - fs_icon="arrow_down"; > - else > - fs_icon="arrow_up"; > - > elm_win_fullscreen_set(win, new_fullscreen); > > + res = asprintf(&fs_value, "%d", new_fullscreen); > + if(res != -1) > + eet_write(conf, "/options/fullscreen", fs_value, > strlen(fs_value), 0); > + if(fs_value) free(fs_value); no need to init fs_value to NULL, just do the free(fs_value from inside the if. Also, I'd rather use eet data descriptors and avoid such things... this would be much easier and you'd not have to do the parsing/serializing yourself. Just see the monster usage of it in e_config.h/e_config.c or some simpler application such as: http://bazaar.launchpad.net/~launch-lite/launch-lite-proj/netbook-launcher-efl/annotate/head:/src/launcher/conf.c See example at http://trac.enlightenment.org/e/browser/trunk/eet/src/lib/Eet.h#L866 (no idea why this is not getting into generated doxygen :-( ) You'll see that you can use this for caching last tweets as well. ... > + data = eet_read(conf, "/options/max_messages", &size); > + if(data) { > + mm = strtol(data, NULL, 10); > + if(mm > INT_MIN && mm < INT_MAX) > + MAX_MESSAGES = (int)mm; > + free(data); > + data = NULL; > + } same... just' stick everything in your "config" structure, all the options. Then you create your data descriptor for it and just do a simple eet_data_read()... get everything there! Then you can go and validate if the ranges are valid, but that's super easy, no need and go strtol() and friends. Well, it's a pitty that documentation is somehow broken and not listing all the doxygen text (as in Eet.h)... and we really need a simple eet example. If you could help there, just create src/examples/ and add 2 files there basic.c (with things like you did here), and descriptors.c (with thing you can learn from Eet.h). You can learn and test things there, people can review it and others can benefit from it in future. BR, -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel