diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2014-03-04 15:52:32 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2014-03-04 15:52:32 (GMT) |
commit | 03de5af287fa97031d2bfb4563261c1b0c07865d (patch) | |
tree | 62968f2ea3bfa98b7111eb03cd37ba9d3afadb15 | |
parent | b3b037438338b32c47bbe0b826c8782ef80e8520 (diff) |
Use Gio to identify the mime type of transfered files
-rw-r--r-- | readactivity.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/readactivity.py b/readactivity.py index 1aed546..bf5cc6a 100644 --- a/readactivity.py +++ b/readactivity.py @@ -31,6 +31,7 @@ import dbus from gi.repository import GObject from gi.repository import Gtk from gi.repository import Gdk +from gi.repository import Gio GObject.threads_init() @@ -918,7 +919,7 @@ class ReadActivity(activity.Activity): if not os.path.exists(filename) or os.path.getsize(filename) == 0: return if 'mime_type' not in self.metadata or not self.metadata['mime_type']: - mimetype = mime.get_for_file(filepath) + mimetype = Gio.content_type_guess(filepath, None)[0] self.metadata['mime_type'] = mimetype else: mimetype = self.metadata['mime_type'] |