[gnome-text-editor] page: notify 'is-modified' when externally modified changes



commit f4e497bdd0f5eb507d352cb4891f3bf3e842bf6b
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 26 16:11:00 2021 -0700

    page: notify 'is-modified' when externally modified changes
    
    Just piggyback on this property so we can update the window status.

 src/editor-page.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/editor-page.c b/src/editor-page.c
index 672a69f..1a23d73 100644
--- a/src/editor-page.c
+++ b/src/editor-page.c
@@ -83,6 +83,17 @@ editor_page_document_notify_title_cb (EditorPage     *self,
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TITLE]);
 }
 
+static void
+editor_page_document_notify_externally_modified_cb (EditorPage     *self,
+                                                    GParamSpec     *pspec,
+                                                    EditorDocument *document)
+{
+  g_assert (EDITOR_IS_PAGE (self));
+  g_assert (EDITOR_IS_DOCUMENT (document));
+
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IS_MODIFIED]);
+}
+
 static void
 editor_page_document_notify_busy_cb (EditorPage     *self,
                                      GParamSpec     *pspec,
@@ -190,6 +201,11 @@ editor_page_set_document (EditorPage     *self,
                                G_CALLBACK (editor_page_document_notify_title_cb),
                                self,
                                G_CONNECT_SWAPPED);
+      g_signal_connect_object (document,
+                               "notify::externally-modified",
+                               G_CALLBACK (editor_page_document_notify_externally_modified_cb),
+                               self,
+                               G_CONNECT_SWAPPED);
       g_signal_connect_object (document,
                                "modified-changed",
                                G_CALLBACK (editor_page_document_modified_changed_cb),


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