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 138930 - nautilus has no option to not show Volumes on the desktop
nautilus has no option to not show Volumes on the desktop
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Desktop
0.x.x [obsolete]
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 62736 74636 139056 140571 143378 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-04-03 04:57 UTC by Danielle Madeley
Modified: 2006-03-21 23:26 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
preliminary patch (5.55 KB, patch)
2004-04-03 05:00 UTC, Danielle Madeley
none Details | Review
an improved patch (6.20 KB, patch)
2004-04-04 11:24 UTC, Danielle Madeley
needs-work Details | Review
even more improved patch (5.57 KB, patch)
2004-04-07 15:07 UTC, Danielle Madeley
needs-work Details | Review
further improvements to previous patch (5.21 KB, patch)
2004-05-06 06:43 UTC, Danielle Madeley
none Details | Review

Description Danielle Madeley 2004-04-03 04:57:32 UTC
There are options to show Home, Computer and Trash, but
not Volumes. For those of us who like really empty desktops. I think this it's
only fair.
Comment 1 Danielle Madeley 2004-04-03 05:00:49 UTC
Created attachment 26277 [details] [review]
preliminary patch

This is the preliminary patch, it likes to break (or even do nothing) when you
call desktop_volumes_visible_changed() but it's a start.
It will work if you start nautilus with the setting set (I know that's not the
gconf way).
Comment 2 Danielle Madeley 2004-04-04 11:24:01 UTC
Created attachment 26307 [details] [review]
an improved patch

This patch seems to basically work, however it will SEGV if you toggle the
gconf key too much (I think I'm forgetting to clean something up).

It also seems to SEGV if you make volumes visible, open a folder for the
volume, make volumes hidden and unmount the volume, I suspect I'm not quite
dealing with the possibility of the list containing null-references.
Comment 3 Martin Wehner 2004-04-04 23:38:04 UTC
*** Bug 139056 has been marked as a duplicate of this bug. ***
Comment 4 Martin Wehner 2004-04-04 23:52:28 UTC
Confirming & Adding PATCH keyword.
Davyd, it would be best to send the patch to nautilus-list too - when you feel
confident enough about it.
A small thing I noticed:
"NautilusDesktopLink *link = NULL;" violates the Nautilus Style Guide ("We do
not initialize local variables in their declarations.")
Comment 5 Danielle Madeley 2004-04-05 03:13:41 UTC
I mailed the nautilus-list, however I am waiting for moderation.

If you don't initialize with the declaration, is it ok to initilize a little
further down? ie:
NautilusDesktopLink *link;
SomeType *somepointer;
...

*link = NULL;

After all, if the variable isn't initialized, it will throw a warning and stop
the compile.
Comment 6 Alexander Larsson 2004-04-07 11:26:16 UTC
This patch introduces a new string, and we're still in string freeze for HEAD. I
don't want to branch for 2.8 yet, since there are still a few important bugs we
have to fix. 

Comment on the patch:

+
+	GnomeVFSVolumeMonitor *volume_monitor;

No need to store this. This is a global object.

+	NautilusDesktopLink *link = NULL;
+

No initialization in declaration accordint to the coding style.

+		if (l && l->data) {

The items in the list should always be non-NULL.  Why is this added?

+	/*
+	 * this method allows us to dynamically show and unshow the
+	 * mounted volumes on the desktop.
+	 */

Function comments before the function, not inside it. Although this comment
doesn't look that useful overall.

+	NautilusDesktopLinkMonitor *monitor;
+	monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data);
+
+	GList *l, *volumes;

No code before declarations in ansi C.

+	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE)) {

We might have been called before with the same value.
At least check (monitor->details->volume_links == NULL) before creating new ones.

+		g_list_foreach (monitor->details->volume_links, (GFunc)g_object_unref, NULL);

Leaves the list with dangling pointers.
You need to free the list and set volume_links to NULL.

+	/*
+	 * added to allow people to dynamically show and unshow volumes
+	 */

Comments like these aren't really needed. The reason for the next line is obvious
from the code itself. We can't have a comment in from of each line stating what
the line does. Comments are useful when the code does something complicated,
unusual or mentions something that the code doesn't say.
Comment 7 Danielle Madeley 2004-04-07 15:07:02 UTC
Created attachment 26435 [details] [review]
even more improved patch

This addresses the issues of the previous patch (as raised by Alex and others).


I have fixed the coding style mistakes. Removed one or two weird lines of code
and the comments (which I should have removed, they were just my placeholders).

Have fixed the two bugs I knew about. Should also now be freeing things
correctly.

Are you sure that volume_monitor is global? Perhaps I did something stupid...
Comment 8 Dave Camp 2004-04-27 22:11:19 UTC
what he means is that gnome_vfs_get_volume_monitor() returns a singleton object,
so you can just call that func when you need the monitor, rather than storing a
pointer to it.
Comment 9 Matthew Gatto 2004-05-06 06:14:26 UTC
*** Bug 140571 has been marked as a duplicate of this bug. ***
Comment 10 Danielle Madeley 2004-05-06 06:43:18 UTC
Created attachment 27416 [details] [review]
further improvements to previous patch

Ok, no more storing volume_manager in the struct. Also fixed a grammatical
mistake I noticed in the schema.

I don't think I've done anything else strange.
Comment 11 Tim Herold 2004-05-08 17:39:05 UTC
*** Bug 62736 has been marked as a duplicate of this bug. ***
Comment 12 Alexander Larsson 2004-05-14 09:34:19 UTC
Commited to HEAD.
Comment 13 Matthew Gatto 2004-05-14 23:41:41 UTC
*** Bug 74636 has been marked as a duplicate of this bug. ***
Comment 14 Martin Wehner 2004-05-30 11:00:21 UTC
*** Bug 143378 has been marked as a duplicate of this bug. ***
Comment 15 Sergej Kotliar 2006-03-21 23:26:11 UTC
Perhaps these options should be made user-visible?
Now that the Places menu and the mount applet are so widely user, maybe that'd be a good idea!