[gnome-builder] file: add _ide_file_get_content_type()



commit 1a9e7e229213c58f70c0f47f1ae943f69e32786c
Author: Christian Hergert <christian hergert me>
Date:   Tue Apr 7 23:55:23 2015 -0700

    file: add _ide_file_get_content_type()
    
    We track content-type internally, and it can be useful to extract it in
    a few places.

 libide/ide-file.c     |   11 +++++++++++
 libide/ide-internal.h |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-file.c b/libide/ide-file.c
index a58841b..7662b64 100644
--- a/libide/ide-file.c
+++ b/libide/ide-file.c
@@ -52,6 +52,17 @@ G_DEFINE_TYPE (IdeFile, ide_file, IDE_TYPE_OBJECT)
 
 static GParamSpec *gParamSpecs [LAST_PROP];
 
+const gchar *
+_ide_file_get_content_type (IdeFile *self)
+{
+  g_return_val_if_fail (IDE_IS_FILE (self), NULL);
+
+  if (self->content_type != NULL)
+    return self->content_type;
+
+  return "text/plain";
+}
+
 void
 _ide_file_set_content_type (IdeFile     *self,
                             const gchar *content_type)
diff --git a/libide/ide-internal.h b/libide/ide-internal.h
index 0d089b2..dce6f68 100644
--- a/libide/ide-internal.h
+++ b/libide/ide-internal.h
@@ -76,6 +76,7 @@ void                _ide_diagnostician_add_provider    (IdeDiagnostician      *s
 void                _ide_diagnostician_remove_provider (IdeDiagnostician      *self,
                                                         IdeDiagnosticProvider *provider);
 IdeDiagnostics     *_ide_diagnostics_new               (GPtrArray             *ar);
+const gchar        *_ide_file_get_content_type         (IdeFile               *self);
 GtkSourceFile      *_ide_file_set_content_type         (IdeFile               *self,
                                                         const gchar           *content_type);
 GtkSourceFile      *_ide_file_get_source_file          (IdeFile               *self);


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