After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 762501 - preferences: add preference to disable mining projects at startup
preferences: add preference to disable mining projects at startup
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: preferences
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-22 23:06 UTC by Christian Hergert
Modified: 2016-03-01 07:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
added new GSetting (3.31 KB, patch)
2016-02-27 10:18 UTC, Akshaya Kakkilaya
none Details | Review
fixed memory leaks. (3.26 KB, patch)
2016-02-28 14:10 UTC, Akshaya Kakkilaya
none Details | Review
only skip discover_async. (3.27 KB, patch)
2016-02-29 12:37 UTC, Akshaya Kakkilaya
committed Details | Review

Description Christian Hergert 2016-02-22 23:06:09 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.
Comment 1 Akshaya Kakkilaya 2016-02-27 10:18:59 UTC
Created attachment 322520 [details] [review]
added new GSetting
Comment 2 Christian Hergert 2016-02-28 06:24:16 UTC
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.
Comment 3 Akshaya Kakkilaya 2016-02-28 14:10:54 UTC
Created attachment 322578 [details] [review]
fixed memory leaks.
Comment 4 Christian Hergert 2016-02-28 23:36:17 UTC
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)
Comment 5 Akshaya Kakkilaya 2016-02-29 12:37:02 UTC
Created attachment 322654 [details] [review]
only skip discover_async.
Comment 6 Christian Hergert 2016-03-01 07:15:56 UTC
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.