GNOME Bugzilla – Bug 762501
preferences: add preference to disable mining projects at startup
Last modified: 2016-03-01 07:16:00 UTC
Some users may not like having their directories mined for projects on their system, so we should add a GSetting to disable scanning directories at startup. A switch should be added to preferences as well. This should probably go in org.gnome.builder gsettings with a new boolean key like: "enable-miners" which defaults to true.
Created attachment 322520 [details] [review] added new GSetting
Review of attachment 322520 [details] [review]: ::: libide/ide-application.c @@ -531,2 +531,3 @@ ide_application_get_recent_projects (IdeApplication *self) { + GSettings *settings; You are leaking the GSettings instance. Use: g_autoptr(GSettings) settings = NULL; @@ -536,2 +539,4 @@ return NULL; + settings = g_settings_new ("org.gnome.builder"); + value = g_settings_get_value (settings, "enable-project-miners"); Use g_settings_get_boolean(), that way you also don't leak the GVariant.
Created attachment 322578 [details] [review] fixed memory leaks.
Review of attachment 322578 [details] [review]: ::: libide/ide-application.c @@ -536,2 +538,5 @@ return NULL; + settings = g_settings_new ("org.gnome.builder"); + + if (!g_settings_get_boolean (settings, "enable-project-miners")) This isn't correct. We still wan't to return an IdeRecentProjects when this is disabled, we just don't want to mine the hard drive for projects they haven't yet been opened. Instead, move this lower and only skip the _discover_async() call. You can also move the GSettings instantiation into the block below so that we only create the GSettings instance when necessary. (ie: after we know self->recent_projects == NULL)
Created attachment 322654 [details] [review] only skip discover_async.
Thanks! I didn't realize we were also parsing the "recent-projects.xbel" file in discover_async(). To allow that to keep working, I've added a followup commit adding a new parameter "recent_only" and use that so that we still see previously opened projects.