! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Desktop menu entry: sort/order icons
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfdesktop
Component:
General

Comments

Description Dieter Plaetinck 2007-02-08 20:19:28 CET
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20070207 BonEcho/2.0.0.1
Build Identifier: 

An entry in the desktop menu for sorting the icons on the desktop.
(some options would be neat too: order by date, filetype, size, filename,..)

Reproducible: Always
Comment 1 joseph.bylund+bugzilla@gmail.com 2011-10-19 16:08:29 CEST
Second this, looks like it would be in xfdesktop-file-icon-manager.c.  I wrote a perl script that accomplishes this (though it assumes the user wants to hide .files and files~, backup files for various programs, and also that they want folders before files).  

Perhaps it would be better to just add a second that looks for a menu in the users .config directory, that way the average user could edit these menus more easily (also apologies if I'm resurrecting a dead and gone bug, but it's still something I'd like to see). 

Can be found here: http://www.columbia.edu/~jhb2147/my_alphabetize.pl
Comment 2 joseph.bylund+bugzilla@gmail.com 2011-10-19 16:10:27 CEST
Created attachment 3907 
Alphabetizes desktop icons in xfce, folders before files and does not show backup files.

Attaching script to alphabetize desktop icons.  I realize this is probably not how we would want to get the alphabetization done.
Comment 3 Eric Koegel editbugs 2012-01-13 19:42:01 CET
Created attachment 4101 
Adds a root menu option to arrange icons

This patch adds a menu option to arrange the desktop icons. First,
it sorts and adds all the special icons such as the trash, home
folder, and any volumes. Next, it sorts and adds all the regular
file icons.
Comment 4 Nick Schermer editbugs 2012-01-16 08:16:16 CET
It is better to write the sort function like this:

+static gint
+xfdesktop_icon_view_compare_icons(gconstpointer *a,
+                                  gconstpointer *b)
+{
+    const gchar *a_str, *b_str;
+
+    a_str = xfdesktop_icon_peek_label(XFDESKTOP_ICON(a));
+    b_str = xfdesktop_icon_peek_label(XFDESKTOP_ICON(b));
+
+    if(a_str == NULL)
+        a_str = "";
+    if(b_str == NULL)
+        b_str = "";
+
+    return g_utf8_collate(a_str, b_str);
+}

I'm not familiar with the other xfdesktop functions used here, but it looks ok-ish.
Comment 5 Eric Koegel editbugs 2012-01-19 07:45:20 CET
Created attachment 4109 
[PATCH] Adds a root menu option to arrange icons.

That's a lot better than what I had, thanks! I've also added a list to hold folder icons so the order would be special icons/volumes, then folders, then files. I also added a helper function to remove some code duplication.
Comment 6 Eric Koegel editbugs 2012-02-11 13:08:15 CET
Created attachment 4184 
[PATCH] Arrange icons on the desktop

- Added an --arrange command line option so it can be invoked via
a keybinding. This only appears if file icons were enabled when it
was compiled.
- Added some checks to ensure it works if file icons were disabled
at compile time. 
- Moved the arrange desktop icons menu item above the desktop settings
entry and only have it show up when the settings entry does as well
(it didn't make much sense to arrange icons when pulling up an item's
property).
Comment 7 Nick Schermer editbugs 2012-02-19 17:21:43 CET
Looks ok now.

Bug #2883

Reported by:
Dieter Plaetinck
Reported on: 2007-02-08
Last modified on: 2012-03-07

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
3 users

Version

Attachments

Additional information