[gnome-builder/wip/chergert/langserv] buffer: add ide_buffer_get_uri()



commit caf32eca631ed314aa09cddaa40d723eb2a54bbb
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 21 04:00:58 2016 -0700

    buffer: add ide_buffer_get_uri()
    
    This is a helper to simply get the URI of the underlying GFile.

 libide/buffers/ide-buffer.c |   14 ++++++++++++++
 libide/buffers/ide-buffer.h |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libide/buffers/ide-buffer.c b/libide/buffers/ide-buffer.c
index 625ee47..9fd356f 100644
--- a/libide/buffers/ide-buffer.c
+++ b/libide/buffers/ide-buffer.c
@@ -2694,3 +2694,17 @@ ide_buffer_get_change_count (IdeBuffer *self)
 
   return priv->change_count;
 }
+
+gchar *
+ide_buffer_get_uri (IdeBuffer *self)
+{
+  IdeFile *file;
+  GFile *gfile;
+
+  g_return_val_if_fail (IDE_IS_BUFFER (self), NULL);
+
+  file = ide_buffer_get_file (self);
+  gfile = ide_file_get_file (file);
+
+  return g_file_get_uri (gfile);
+}
diff --git a/libide/buffers/ide-buffer.h b/libide/buffers/ide-buffer.h
index 7dc40f6..88a33a1 100644
--- a/libide/buffers/ide-buffer.h
+++ b/libide/buffers/ide-buffer.h
@@ -74,6 +74,7 @@ gboolean            ide_buffer_get_read_only                 (IdeBuffer
 gboolean            ide_buffer_get_highlight_diagnostics     (IdeBuffer            *self);
 const gchar        *ide_buffer_get_style_scheme_name         (IdeBuffer            *self);
 const gchar        *ide_buffer_get_title                     (IdeBuffer            *self);
+gchar              *ide_buffer_get_uri                       (IdeBuffer            *self);
 void                ide_buffer_set_file                      (IdeBuffer            *self,
                                                               IdeFile              *file);
 void                ide_buffer_set_highlight_diagnostics     (IdeBuffer            *self,


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