Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From e60d491a28837988c06bc6af52d443ec2f81b938 Mon Sep 17 00:00:00 2001
- From: Pranav Ganorkar <pranavg189@gmail.com>
- Date: Fri, 25 Jul 2014 03:45:14 +0000
- Subject: [PATCH] fixed a bug for gnome-music failing to start if xdg default
- directories are not created Now, It starts the application and shows the
- proper message to the user instead of the technical error...
- ---
- gnomemusic/query.py | 17 ++++++++++-------
- gnomemusic/view.py | 6 +++++-
- 2 files changed, 15 insertions(+), 8 deletions(-)
- diff --git a/gnomemusic/query.py b/gnomemusic/query.py
- index 0e33119..217fdb7 100644
- --- a/gnomemusic/query.py
- +++ b/gnomemusic/query.py
- @@ -27,14 +27,17 @@
- from gi.repository import GLib, Tracker
- -
- class Query():
- - MUSIC_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(
- - GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)
- - ))
- - DOWNLOAD_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(
- - GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)
- - ))
- +
- + try:
- +
- + MUSIC_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)))
- +
- + DOWNLOAD_DIR = Tracker.sparql_escape_string(GLib.filename_to_uri(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)))
- +
- + except TypeError:
- + MUSIC_DIR = None
- + DOWNLOAD_DIR = None
- @staticmethod
- def all_albums():
- diff --git a/gnomemusic/view.py b/gnomemusic/view.py
- index 2441ba9..70c6f2c 100644
- --- a/gnomemusic/view.py
- +++ b/gnomemusic/view.py
- @@ -337,7 +337,11 @@ class Empty(Gtk.Stack):
- music_folder_path = GLib.get_user_special_dir(GLib.USER_DIRECTORY_MUSIC)
- widget = builder.get_object('container')
- label = builder.get_object('label1')
- - label.set_label(_("No Music found!\n Put some files into the folder %s") % music_folder_path)
- + if Query.MUSIC_DIR == None:
- + label.set_label(_('Your Environment is not Configured Properly'))
- + else:
- + label.set_label(_("No Music found!\n Put some files into the folder %s") % music_folder_path)
- +
- self.add(widget)
- self.show_all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement