[gnome-blog] Port gnomevfs to gio
- From: Olav Vitters <ovitters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-blog] Port gnomevfs to gio
- Date: Sat, 25 Feb 2012 18:54:16 +0000 (UTC)
commit db1ee8251ba3c22fa5bc8712debf1464fd168ce4
Author: GyÃrgy Ballà <ballogy freestart hu>
Date: Sat Feb 25 19:53:42 2012 +0100
Port gnomevfs to gio
Fixes bug #612630
rich_entry.py | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/rich_entry.py b/rich_entry.py
index 89e2f69..d4cca42 100644
--- a/rich_entry.py
+++ b/rich_entry.py
@@ -3,7 +3,7 @@ import gtk.gdk
import pango
import gobject
import gnome
-import gnomevfs
+import gio
import gettext
_ = gettext.gettext
@@ -138,9 +138,11 @@ class RichEntry(gtk.TextView):
loader = gtk.gdk.PixbufLoader()
try:
- file_info = gnomevfs.get_file_info(uri, gnomevfs.FILE_INFO_GET_MIME_TYPE)
- file_contents = gnomevfs.read_entire_file(uri)
- except gnomevfs.Error, e:
+ myfile = gio.File(uri=uri)
+ file_info = myfile.query_info(gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
+ content_type = file_info.get_content_type()
+ file_contents, length, etag = myfile.load_contents()
+ except gio.Error, e:
hig_alert.reportError(_("Could not load dragged in image"),
_("Error loading %s was: %s") % (hig_alert.italic(uri), e))
loader.write(file_contents)
@@ -160,7 +162,7 @@ class RichEntry(gtk.TextView):
image_tag.file_contents = file_contents
paths = uri.split('/')
image_tag.name = paths[len(paths) - 1]
- image_tag.mime_type = file_info.mime_type
+ image_tag.mime_type = content_type
self.images.append(image_tag)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]