[gitg/wip/albfan/diff-images-as-text: 14/14] Allow to diff images as text if its mime type supports it
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/albfan/diff-images-as-text: 14/14] Allow to diff images as text if its mime type supports it
- Date: Fri, 12 Nov 2021 06:25:19 +0000 (UTC)
commit 231bc4b56b39c9ccd0a9528aae7d34e065921555
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Wed Oct 16 14:34:23 2019 +0200
Allow to diff images as text if its mime type supports it
libgitg/gitg-diff-view.vala | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/libgitg/gitg-diff-view.vala b/libgitg/gitg-diff-view.vala
index 2ec9c031..5b8e273d 100644
--- a/libgitg/gitg-diff-view.vala
+++ b/libgitg/gitg-diff-view.vala
@@ -823,7 +823,14 @@ public class Gitg.DiffView : Gtk.Grid
mime_type_for_image =
ContentType.get_mime_type(info.new_file_content_type);
}
- if (mime_type_for_image != null &&
s_image_mime_types.contains(mime_type_for_image))
+ //TODO: this bool come from the user selection. A button that only
appears if
+ //image can be seen as text too.
+ bool image_diff_selected = false;
+ bool can_diff_as_text = ContentType.is_mime_type(mime_type_for_image,
"text/plain");
+
+ if (mime_type_for_image != null
+ && s_image_mime_types.contains(mime_type_for_image)
+ && (!can_diff_as_text || image_diff_selected))
{
current_file = new Gitg.DiffViewFile.image(repository, delta);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]