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 301615 - Have ability to "lock" individual desktop icon positions
Have ability to "lock" individual desktop icon positions
Status: RESOLVED OBSOLETE
Product: nautilus
Classification: Core
Component: Desktop
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 312335 327949 473712 670305 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-04-22 18:02 UTC by Ben Davis
Modified: 2018-01-02 18:48 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Implements locked desktop icons (22.61 KB, patch)
2005-06-05 02:39 UTC, Ben Davis
needs-work Details | Review
Implements locked desktop icons (nautilus-2.18.1) (23.58 KB, patch)
2007-09-12 14:56 UTC, Ben Davis
none Details | Review
eel patch (required for nautilus locked icons patch) (375 bytes, patch)
2007-09-12 14:57 UTC, Ben Davis
rejected Details | Review
Updated Patch (22.23 KB, patch)
2008-03-02 12:17 UTC, Christopher Roy Bratusek
none Details | Review
updated patch for nautilus-2.22.5.1 (22.86 KB, patch)
2008-10-16 18:28 UTC, Ben Davis
none Details | Review

Description Ben Davis 2005-04-22 18:02:44 UTC
I was thinking it would be nice to be able to "lock" certain desktop icons to
their position so that they could not be moved, for instance, when doing a clean
up or when drawing a select box and moving multiple icons.  This would allow
users to have their "special" icons in another portion of the desktop, for
instance, if I wanted my trash icon to always stay at the bottom right, or my
home icon to always stay at the top right.

This would work similar to how we can lock panel applets. Just right-click and
select "Lock icon position".
Comment 1 Sebastien Bacher 2005-05-18 07:36:52 UTC
thanks for the bug
Comment 2 Ben Davis 2005-06-05 02:39:30 UTC
Created attachment 47250 [details] [review]
Implements locked desktop icons

I took a little time myself to hack around nautilus-2.10.1 to see how difficult
it would be.  I have a patch that implements the basic idea of this concept,
however, I don't know how many people would actually be interested in having
this feature implemented.  This patch implements the following:

* Ability to set the locked status of an icon or a selection of icons
* When cleaning up, skip positioning on locked icons
* Cannot drag, repoisition, or stretch a locked icon.

Currently, auto-layout of unlocked icons occurs as if no other icons are there,
so if you have a locked icon in the upper-left corner, it will overlap with
another icon. I'm not aware of an easy way to have unlocked icons position
themselves with regard to locked icon positions to avoid overlapping.

This is my first attempt at patching something, so if it's completely messy or
full of errors, you'll know why :)   This patch is agains nautilus-2.10.1 (I
didn't bother w/ CVS yet, if someone can verify that it patches against CVS
that would be great...)
Comment 3 Christian Neumair 2005-06-05 08:44:01 UTC
Thanks for your efforts! This looks really promising :).

+    for (slist = gtk_action_get_proxies (action); slist != NULL; slist =
slist->next) {
+        proxy = slist->data;
+        if (GTK_IS_CHECK_MENU_ITEM (proxy)) {
+            lock_menu_item  = GTK_CHECK_MENU_ITEM(proxy);
+			lock_menu_item->active = nautilus_icon_container_is_locked (icon_container);
+			lock_menu_item->inconsistent =
nautilus_icon_container_is_locked_inconsistent (icon_container);
+        }
+    }

You should rather use gtk_toggle_action_set_active. GtkCheckActions don't seem
to support the inconsistent property, so feel free to use your for loop for that.

Also, I think nautilus_icon_container_set_locked is a bit odd, since it seems to
make all selected locked icons unlocked and vice versa. You should rather move
its loop to action_lock_callback, add an additional NautilusIcon * parameter to
nautilus_icon_container_set_locked and just have the signal emission as function
body.
Comment 4 Christian Neumair 2005-06-05 08:48:45 UTC
> Also, I think nautilus_icon_container_set_locked is a bit odd, since it seems to
> make all selected locked icons unlocked and vice versa. You should rather move
> its loop to action_lock_callback, add an additional NautilusIcon * parameter to
> nautilus_icon_container_set_locked and just have the signal emission as function
> body.
This suggestions implies that you use gtk_toggle_action_get_active to determine
the desired locking state of all selected items.

nautilus_icon_container_is_locked should IMHO be called
nautilus_icon_container_selection_is_locked, same for
nautilus_icon_container_is_locked_inconsistent. On the other hand, you could
also merge them to _selection_is_locked and have an additional gboolean *
locked_inconsistent parameter.
Comment 5 Ben Davis 2005-06-06 19:57:29 UTC
> You should rather use gtk_toggle_action_set_active. GtkCheckActions don't seem
> to support the inconsistent property, so feel free to use your for loop for that.

when I use gtk_toggle_action_set_active(),  I get undesired results, ie, the
checkbox just keeps checking/unchecking itself. I'm guessing this is because
calling gtk_toggle_action_set_active triggers something that in effect
re-triggers itself (for lack of a better explanation).

> Also, I think nautilus_icon_container_set_locked is a bit odd, since it seems to
> make all selected locked icons unlocked and vice versa. You should rather move
> its loop to action_lock_callback, add an additional NautilusIcon * parameter to
> nautilus_icon_container_set_locked and just have the signal emission as function
> body.

The reason nautilus_icon_container_set_locked looks the way it does is bacuase I
was attempting to keep consistent with the current coding style. There necessary
headers aren't available in fm-icon-view to deal with NautilusIcon, ie, anything
that deals with NautilusIcon is in nautilus-icon-container.   But, you're right
when you say the function looks confusing. I could either change
"nautilus_icon_container_set_locked" to "nautilus_icon_container_toggle_locked"
or I could give it a gboolean param telling it whether to lock or unlock.

> This suggestions implies that you use gtk_toggle_action_get_active to determine
> the desired locking state of all selected items.

The way I determine the locking state of an icon is simply by checking its
is_locked property.

> nautilus_icon_container_is_locked should IMHO be called
> nautilus_icon_container_selection_is_locked, same for
> nautilus_icon_container_is_locked_inconsistent. On the other hand, you could
> also merge them to _selection_is_locked and have an additional gboolean *
> locked_inconsistent parameter.

The reason I named the _is_locked function that way is because I was attempting
to keep in line with _is_stretched, which returns true if _any_ of the icons are
stretched.  (You're right, however, that it makes more sense to call it
_selection_is_locked).
Comment 6 Ben Davis 2005-06-06 20:11:39 UTC
I also thought of a couple of usability questions while making this:

* Should we be able to drag locked icons to other places, such as trash, other
folders, programs, etc?

* Should unlocked icons "respect" the positions of locked icons when
auto-laying-out, or should they just completely ignore locked icons?  I might
see a situation where someone wants to lock some icons in a place where
auto-layout might overlap them with unlocked icons. 
Comment 7 Christian Neumair 2005-08-02 11:30:14 UTC
*** Bug 312335 has been marked as a duplicate of this bug. ***
Comment 8 Teppo Turtiainen 2006-03-22 20:52:30 UTC
*** Bug 327949 has been marked as a duplicate of this bug. ***
Comment 9 David Prieto 2007-01-04 11:49:53 UTC
Has there been any progress on this, a year and a half after the patch was submitted?

"Should we be able to drag locked icons to other places, such as trash, other
folders, programs, etc?" I don't think so. If you lock something it should stay there until you unlock it.

"Should unlocked icons "respect" the positions of locked icons when
auto-laying-out, or should they just completely ignore locked icons?" I'm pretty sure they should respect their position, to avoid overlapping.
Comment 10 Ben Davis 2007-01-04 14:23:24 UTC
The Nautilus code has changed quite a bit since that patch, and I haven't had much time to take a look at it.  If you're skilled and willing, you're more than welcome to write your own patch.  Ideally, we need to have a patch against current development version, so that they might add it into the final release.
Comment 11 David Prieto 2007-01-04 14:28:10 UTC
I'd love to, but I can't code at all. Sorry Ben.
Comment 12 Ben Davis 2007-09-12 14:56:51 UTC
Created attachment 95454 [details] [review]
Implements locked desktop icons (nautilus-2.18.1)

Here's an updated patch for 2.18.1.  You'll also need the eel patch which I forgot to include last time :).   There is still a bug that occurs when "Clean Up by Name" is used..  it positions icons over the locked icons, so I will still need to figure out what is going on there.

Once I get that fixed, I'll try patching against cvs...
Comment 13 Ben Davis 2007-09-12 14:57:31 UTC
Created attachment 95455 [details] [review]
eel patch (required for nautilus locked icons patch)
Comment 14 Christopher Roy Bratusek 2008-03-02 12:17:17 UTC
Created attachment 106373 [details] [review]
Updated Patch

Updated Patch for 2.21.93/rev13861. Can't code at all, so no code change, just updated to apply to the new version.
Comment 15 Cosimo Cecchi 2008-03-02 12:53:50 UTC
Thanks for the updated patch Christopher. Does this patch still has the bug Ben describes in comment #12?
Comment 16 Christopher Roy Bratusek 2008-03-02 12:58:48 UTC
Yes. Like I said I can't develop C, so there's nothing I can do about.
Comment 17 Christopher Roy Bratusek 2008-03-02 19:05:55 UTC
Hmm, I found another issue: Then an Icon is locked it can only be opened by middle-click or context-menu, left-click does not work. Can you have a look at the patch, please?
Comment 18 Cosimo Cecchi 2008-03-29 15:10:48 UTC
I'm working on an updated patch for this.
Comment 19 A. Walton 2008-04-01 09:18:29 UTC
*** Bug 473712 has been marked as a duplicate of this bug. ***
Comment 20 Christopher Roy Bratusek 2008-09-13 10:52:24 UTC
Any news Cosimo?
Comment 21 Ben Davis 2008-10-16 18:28:20 UTC
Created attachment 120734 [details] [review]
updated patch for nautilus-2.22.5.1

updated patch for nautilus-2.22.5.1.  Make sure to also patch eel2 using the eel2 patch also attached to this bug.
Comment 22 Christopher Roy Bratusek 2008-10-16 18:45:41 UTC
could you please make a patch for current trunk? (2.25.1) - it doesn't apply here. and is the bug from comment 12 fixed?
Comment 23 Christopher Roy Bratusek 2008-10-16 18:51:08 UTC
and the one from comment 17 ?
Comment 24 Ben Davis 2008-10-16 21:01:15 UTC
Can't reproduce #17,  and #12 is still an issue.    I'm pretty new to hacking gnome,  and I have no idea how to work with trunk.  Right now I'm just getting the source for my current deb pkg,  applying the patch,  and using dpkg-buildpackage to recompile, then installing the new deb.    If you can point me to a good howoto on how to develop on gnome trunk without messing up my normal envirotment, that'd be great!
Comment 25 Christopher Roy Bratusek 2008-10-17 04:40:35 UTC
That's pretty esay:

grab the source:

svn co http://svn.gnome.org/svn/eel/trunk eel
svn co http://svn.gnome.org/svn/nautilus/trunk nautilus

then use ./autogen.sh instead of ./configure the first time. other from that proceed as normal.

with svn up you can update to the latest trunk
Comment 26 Frederik Hertzum 2008-10-18 10:26:49 UTC
(In reply to comment #6)
> I also thought of a couple of usability questions while making this:
> 
> * Should we be able to drag locked icons to other places, such as trash, other
> folders, programs, etc?
> 
> * Should unlocked icons "respect" the positions of locked icons when
> auto-laying-out, or should they just completely ignore locked icons?  I might
> see a situation where someone wants to lock some icons in a place where
> auto-layout might overlap them with unlocked icons. 

On Q1: Yes. Definetly. Personally I see this as a method for avoiding having automoving icons when cleaning up the desktop -- not as a way to avoid moving them completly.

On Q2: Yes. Absolutely. If not, the whole idea seems pretty useless to me. I see this as a method for making sure that important icons are in the same position, no matter what other clutter is around and when you last cleaned your desktop.

On that note, I'm beginning to have a look at producing a patch myself -- I have to find out how to get around trunk first though. I see this as a pretty simple feature that only requires two types of changes -- first of all it should be possible to set and unset the locked status and second of all the auto-align code needs to change too.
Comment 27 Ben Davis 2008-10-20 13:07:29 UTC
Frederik, not sure if you noticed, but we already have a patch for Nautilus-2.22.5,  but there is a bug with the auto-layout that causes unlocked icons to overlap locked icons.   If you can help with patching this against trunk, fixing the bug, and testing,  perhaps we can work on getting it in officially.
Comment 28 Ben Davis 2008-10-23 14:35:26 UTC
Ok, so apparently I _can_ reproduce the issue where locked icons cannot be opened.  It seems that this happens when nautilus starts up with the icons already locked.  If you unlock and lock again, then the icons can be opened.  

If I get time, I'll look into this,  but anyone else is more than welcome to help debug this feature.
Comment 29 Frederik Hertzum 2008-10-28 13:44:07 UTC
(In reply to comment #27)
> Frederik, not sure if you noticed, but we already have a patch for
> Nautilus-2.22.5,  but there is a bug with the auto-layout that causes unlocked
> icons to overlap locked icons.   If you can help with patching this against
> trunk, fixing the bug, and testing,  perhaps we can work on getting it in
> officially.
> 
Nope, I hadn't noticed that there was one for 2.22.5. I'll take a look at it when time presents itself (sometime later this week). I still haven't quite found my way around trunk though.
Comment 30 Cosimo Cecchi 2009-07-08 11:16:28 UTC
This is obsolete as well now.
Comment 31 Christopher Roy Bratusek 2009-07-19 07:00:26 UTC
I'll see what I can do (...) Don't expect anything before 2.30/3.0
Comment 32 André Klapper 2012-02-17 20:27:08 UTC
*** Bug 670305 has been marked as a duplicate of this bug. ***
Comment 33 António Fernandes 2017-08-17 19:01:06 UTC
Review of attachment 95455 [details] [review]:

eel/eelmarshal.list was removed by commint 75a03a440ebff23ccbf8674ca4a0e9f6475ebbb8

Rejecting pending patch to tie up Bugzilla loose ends before transition to GitLab.
Comment 34 António Fernandes 2018-01-02 18:48:02 UTC
Starting with version 3.28, nautilus will not handle the "files on desktop background" feature. For better alternatives, read this blog post https://csorianognome.wordpress.com/2017/12/21/nautilus-desktop-plans/