[gnome-builder] GbEditorDocument: set title for buffers with no location on constructed



commit 57185740c05378930acc16fa33540e0dcbe204b5
Author: Christian Hergert <christian hergert me>
Date:   Wed Dec 10 17:23:10 2014 -0800

    GbEditorDocument: set title for buffers with no location on constructed
    
    Some of these will have their document sequence id released as soon as
    the file begins loading.

 src/editor/gb-editor-document.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-editor-document.c b/src/editor/gb-editor-document.c
index 715d6da..6059fde 100644
--- a/src/editor/gb-editor-document.c
+++ b/src/editor/gb-editor-document.c
@@ -891,9 +891,11 @@ gb_editor_document_get_modified (GbDocument *document)
 const gchar *
 gb_editor_document_get_title (GbDocument *document)
 {
-  g_return_val_if_fail (GB_IS_EDITOR_DOCUMENT (document), NULL);
+  GbEditorDocument *self = (GbEditorDocument *)document;
+
+  g_return_val_if_fail (GB_IS_EDITOR_DOCUMENT (self), NULL);
 
-  return GB_EDITOR_DOCUMENT (document)->priv->title;
+  return self->priv->title;
 }
 
 static GtkWidget *
@@ -912,6 +914,16 @@ gb_editor_document_create_view (GbDocument *document)
 }
 
 static void
+gb_editor_document_constructed (GObject *object)
+{
+  GbEditorDocument *self = (GbEditorDocument *)object;
+
+  G_OBJECT_CLASS (gb_editor_document_parent_class)->constructed (object);
+
+  gb_editor_document_notify_file_location (self, NULL, self->priv->file);
+}
+
+static void
 gb_editor_document_finalize (GObject *object)
 {
   GbEditorDocumentPrivate *priv = GB_EDITOR_DOCUMENT (object)->priv;
@@ -1002,6 +1014,7 @@ gb_editor_document_class_init (GbEditorDocumentClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkTextBufferClass *text_buffer_class = GTK_TEXT_BUFFER_CLASS (klass);
 
+  object_class->constructed = gb_editor_document_constructed;
   object_class->finalize = gb_editor_document_finalize;
   object_class->get_property = gb_editor_document_get_property;
   object_class->set_property = gb_editor_document_set_property;


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