GNOME Bugzilla – Bug 513951
Centralize where Evolution's user data directory is defined
Last modified: 2008-03-13 14:57:49 UTC
Just some light refactoring work for something that was bothering me today. There should be exactly one place in the code where we define where to put user data (currently $HOME/.evolution), so I added a new e-util function to provide that location: const gchar * e_get_user_data_dir (void) [1] I also changed the various xxx_component_peek_base_directory() functions to return a more useful result. Whereas before they all returned the same as e_get_user_data_dir(), now they return a component-specific base directory: addressbook_component_peek_base_directory() : "$HOME/.evolution/addressbook" calendar_component_peek_base_directory() : "$HOME/.evolution/calendar" mail_component_peek_base_directory() : "$HOME/.evolution/mail" memos_component_peek_base_directory() : "$HOME/.evolution/memos" tasks_component_peek_base_directory() : "$HOME/.evolution/tasks" The rest of the code has been adapted appropriately. [1] cf. g_get_user_data_dir() http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-get-user-data-dir
Created attachment 104274 [details] [review] Proposed patch
Target for 2.24. Looks fine otherwise.
also see bug 519767 - would this fix bug 519767?
I don't think it will solve bug #519767 outright, but it might make the patch to fix it a little cleaner.
Muelli correctly pointed out that the 'dirname' variable in my e_get_user_data_dir() function should be static. Good catch!
:) So I cooked up a patch where the dirname is static. Also there is additional GConf error checking which has been in my working copy for long. I hope I didn't mess up other things ;-)
Created attachment 106384 [details] [review] Patch based on Matthews, but with a static dirname and additional GConf Error checking
Remove the g_assert() statements, but looks fine otherwise.
I removed g_assert() from calendar/gui/migration.c and composer/e-msg-composer.c, so here comes the new patch.
Created attachment 106389 [details] [review] Patch w/o g_assert()s
Great, thanks. I noticed you moved the 'dirname' variable outside of e_get_user_data_dir(), which isn't necessary. Static variables can live happily inside functions; their values persist across calls. In this case it would be slightly better for the variable to live inside the function just to ensure that e_get_user_data_dir() is the only way to get the value. But not a big deal, I'm just nitpicking. Approved for post-2.22.0 release.
Bumping version to a stable release.
Committed to trunk (revision #35175).
This commit leads to a segfault on my station : Program received signal SIGSEGV, Segmentation fault.
+ Trace 192198
Thread 3061462848 (LWP 3730)
No symbol table info available. reverting to 35173 fix it. Regards Alban
right, see bug #521959
Fixed mail regressions in revision 35179.
Should also get rid of these: em-folder-tree.c: In function 'em_folder_tree_new': em-folder-tree.c:569: warning: implicit declaration of function 'e_get_user_data_dir' em-folder-tree.c:569: warning: passing argument 1 of 'em_folder_tree_model_new' makes pointer from integer without a cast em-format-html.c: In function 'em_format_html_get_type': em-format-html.c:257: warning: implicit declaration of function 'e_get_user_data_dir' em-format-html.c:257: warning: initialization makes pointer from integer without a cast
Yes, good catch. Feel free to commit a fix.
Fixed in revision 35186.