[gnome-builder] GbEditorDocument: track readonly documents in title



commit a3133a4aaba65d0a031a37171421d45ac3bb128c
Author: Christian Hergert <christian hergert me>
Date:   Wed Dec 17 20:45:57 2014 -0800

    GbEditorDocument: track readonly documents in title

 src/editor/gb-editor-document.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/editor/gb-editor-document.c b/src/editor/gb-editor-document.c
index 90bad26..ab49101 100644
--- a/src/editor/gb-editor-document.c
+++ b/src/editor/gb-editor-document.c
@@ -71,8 +71,8 @@ enum {
   LAST_SIGNAL
 };
 
-static void
-gb_editor_document_init_document (GbDocumentInterface *iface);
+static void gb_editor_document_init_document (GbDocumentInterface *iface);
+static void gb_editor_document_update_title  (GbEditorDocument *document);
 
 G_DEFINE_TYPE_EXTENDED (GbEditorDocument,
                         gb_editor_document,
@@ -149,6 +149,7 @@ gb_editor_document_set_read_only (GbEditorDocument *document,
     {
       document->priv->read_only = read_only;
       g_object_notify (G_OBJECT (document), "read-only");
+      gb_editor_document_update_title (document);
     }
 
   EXIT;
@@ -653,7 +654,16 @@ gb_editor_document_update_title (GbEditorDocument *document)
   location = gtk_source_file_get_location (priv->file);
 
   if (location)
-    priv->title = g_file_get_basename (location);
+    {
+      priv->title = g_file_get_basename (location);
+
+      if (document->priv->read_only)
+        {
+          gchar *tmp = priv->title;
+          priv->title = g_strdup_printf (_("%s (Read Only)"), tmp);
+          g_free (tmp);
+        }
+    }
   else
     priv->title = g_strdup_printf (_("untitled document %u"), priv->doc_seq_id);
 


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