Use localized/xdg Desktop folder automatically

Bug #471462 reported by Francesco Marella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kupfer
Fix Released
Wishlist
Unassigned

Bug Description

Kupfer can't find my Desktop folder because it's named differently based on locale settings.
Lazy users may expect that Kupfer is smart enough to detect it automatically.
The method you suggested on bug report LP: #462332 works for me.

Error [kupfer.data] SourceController: Loading Desktop raised an exception:
Traceback (most recent call last):
  File "/usr/share/kupfer/kupfer/data.py", line 449, in _checked_rescan_source
    source.get_leaves()
  File "/usr/share/kupfer/kupfer/objects.py", line 788, in get_leaves
    self.cached_items = cache_type(sort_func(self.get_items()))
  File "/usr/share/kupfer/kupfer/utils.py", line 66, in locale_sort
    seq = seq if isinstance(seq, list) else list(seq)
  File "/usr/share/kupfer/kupfer/objects.py", line 876, in get_items
    for fname in os.listdir(self.directory):
OSError: [Errno 2] Nessun file o directory: '/home/francesco/Desktop'
Error [kupfer.data] SourceController: This error is probably a bug in Desktop
Error [kupfer.data] SourceController: Please file a bug report

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

This is a bug in the default configuration rather than in Kupfer's, so my boring maintainer answer is: we'll change the default configuration for next release and make the default directories just the home directory (that would be a minimal assumption).

After that we can add code to read the special user settings, and add USER_DIRECTORY_DESKTOP to the defaults.

The output there that you are pasting is part of a change so that Kupfer will detect errors early, and disable the malfunctioning parts -- you should be able to continue using Kupfer, but "Desktop" won't be visible. Did it work, could you continue using kupfer?

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

Sorry I'm not really Shakespeare and it might be hard to understand what I mean. I mean: It is a bug in Kupfer's default configuration.

Revision history for this message
Francesco Marella (francesco-marella) wrote :

I can continue using Kupfer and Desktop it's not visible.
Thanks for the quick response!

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

I have committed 512e64f5ae0e1e64646972cf2307c7c8fc2a9e54 to catch this error earlier and spill less exception tracebacks to the user. It is still an error though, and the user should update the catalogs in the preferences dialog and start kufper again.

Detecting the desktop folder's name/location automatically Wishlisted, to be implemented later.

http://git.gnome.org/cgit/kupfer/commit/?id=512e64f5ae0e1e64646972cf2307c7c8fc2a9e54

summary: - Error loading Desktop folder
+ Use localized/xdg Desktop folder automatically
Changed in kupfer:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Francesco Marella (francesco-marella) wrote :

Ulrik,
templates plugin has a similar problem. The path to templates folder is hard-coded to "~/Templates".
It should be detected via xdg (XDG_TEMPLATES_DIR) instead.

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

Thanks for the reminder Francesco. This should fix it:

http://git.gnome.org/cgit/kupfer/commit/?id=7b5f8c09053623130e0e4cb2662697ba210c5311

(I don't have xdg user dirs here, so it returns None here. But it's documented to do the right thing.. which is really convenient for Kupfer when things are like that.)

Revision history for this message
Francesco Marella (francesco-marella) wrote :

Ulrik, testing the templates plugin shipped with kupfer c18 I get the following exception:
 > UnboundLocalError: local variable 'tmpl_var' referenced before assignment

ps. I'm not opening a new bug report for it, unless you tell me otherwise.

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

:-( that's a mistake I did.. I was too clever and renamed a variable but only partially. This breaks the plugin whenever USER_DIRECTORY_TEMPLATES is defined (it is not on my machine..) Fixed in git.

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

This is fixed by http://git.gnome.org/cgit/kupfer/commit/?id=f0501ae98dbbd332f7b8a128f36e0d1fbfe6abfd and preceding commits.

Kupfer's default configuration is now to add the user's home folder and the xdg-configured desktop folder to the catalog by default. Desktop folder falls back to ~/Desktop automatically.

This change will take effect for existing users when upgrading if they haven't changed catalog directories from the default settings.

Changed in kupfer:
assignee: nobody → Ulrik Sverdrup (ulrik-sverdrup)
status: Confirmed → Fix Committed
Changed in kupfer:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.