Advertisement
Guest User

Patch for gnome-music xdg-not-created bug draft

a guest
Jul 25th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.21 KB | None | 0 0
  1. From e60d491a28837988c06bc6af52d443ec2f81b938 Mon Sep 17 00:00:00 2001
  2. From: Pranav Ganorkar <pranavg189@gmail.com>
  3. Date: Fri, 25 Jul 2014 03:45:14 +0000
  4. Subject: [PATCH] fixed a bug for gnome-music failing to start if xdg default
  5.  directories are not created Now, It starts the application and shows the
  6.  proper message to the user instead of the technical error...
  7.  
  8. ---
  9.  gnomemusic/query.py  | 17 ++++++++++-------
  10.  gnomemusic/view.py   |  6 +++++-
  11.  2 files changed, 15 insertions(+), 8 deletions(-)
  12.  
  13. diff --git a/gnomemusic/query.py b/gnomemusic/query.py
  14. index 0e33119..217fdb7 100644
  15. --- a/gnomemusic/query.py
  16. +++ b/gnomemusic/query.py
  17. @@ -27,14 +27,17 @@
  18.  
  19.  from gi.repository import GLib, Tracker
  20.  
  21. -
  22.  class Query():
  23. -    MUSIC_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(
  24. -        GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)
  25. -    ))
  26. -    DOWNLOAD_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(
  27. -        GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)
  28. -    ))
  29. +
  30. +    try:
  31. +        
  32. +        MUSIC_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)))
  33. +    
  34. +        DOWNLOAD_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)))
  35. +
  36. +    except TypeError:
  37. +        MUSIC_DIR = None
  38. +        DOWNLOAD_DIR = None
  39.  
  40.      @staticmethod
  41.      def all_albums():
  42. diff --git a/gnomemusic/view.py b/gnomemusic/view.py
  43. index 2441ba9..70c6f2c 100644
  44. --- a/gnomemusic/view.py
  45. +++ b/gnomemusic/view.py
  46. @@ -337,7 +337,11 @@ class Empty(Gtk.Stack):
  47.          music_folder_path = GLib.get_user_special_dir(GLib.USER_DIRECTORY_MUSIC)
  48.          widget = builder.get_object('container')
  49.          label = builder.get_object('label1')
  50. -        label.set_label(_("No Music found!\n Put some files into the folder %s") % music_folder_path)
  51. +        if Query.MUSIC_DIR == None:
  52. +            label.set_label(_('Your Environment is not Configured Properly'))
  53. +        else:
  54. +            label.set_label(_("No Music found!\n Put some files into the folder %s") % music_folder_path)
  55. +
  56.          self.add(widget)
  57.          self.show_all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement