[gnome-boxes/wip/image-import: 3/9] util: Add is_mime_type()
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/image-import: 3/9] util: Add is_mime_type()
- Date: Wed, 5 Jun 2013 01:37:56 +0000 (UTC)
commit ca84e82332ca4fd8b02a396bcb786deba21ee383
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Jun 5 04:02:33 2013 +0300
util: Add is_mime_type()
Add utility function to determine if given file is on given mimetype.
src/util-app.vala | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/util-app.vala b/src/util-app.vala
index 0370b0c..836c153 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -529,6 +529,13 @@ namespace Boxes {
return tokens[1];
}
+ public bool is_mime_type (string filename, string mime_type) {
+ var file_type = ContentType.guess (filename, null, null);
+ var supertype = ContentType.from_mime_type (mime_type);
+
+ return ContentType.is_a (file_type, supertype);
+ }
+
namespace UUID {
[CCode (cname = "uuid_generate", cheader_filename = "uuid/uuid.h")]
internal extern static void generate ([CCode (array_length = false)] uchar[] uuid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]