[meld] melddoc: Assume that unknown content types are text



commit f167416d2354c2e155419eb0b51e3b57a0670b2c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Dec 15 08:38:20 2018 +1000

    melddoc: Assume that unknown content types are text
    
    This seems wild... and it kind of is... but it also removes a
    platform-specific check and handles situations like e.g., opening an
    unsaved buffer.

 meld/melddoc.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/meld/melddoc.py b/meld/melddoc.py
index 4268f10d..0207940e 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -146,8 +146,9 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
             elif file_type == Gio.FileType.REGULAR:
                 content_type = info.get_content_type()
                 # FIXME: Content types are broken on Windows with current gio
-                if Gio.content_type_is_a(content_type, "text/plain") or \
-                        sys.platform == "win32":
+                # If we can't access a content type, assume it's text.
+                if not content_type or Gio.content_type_is_a(
+                        content_type, "text/plain"):
                     if settings.get_boolean('use-system-editor'):
                         gfile = Gio.File.new_for_path(path)
                         if sys.platform == "win32":


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]