[gedit] GeditDocument: bind GtkSourceFile and TeplFile :location properties



commit 6b6a6e59586dda7e55a392c9ba0f28976ae4e00c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Nov 14 14:53:36 2020 +0100

    GeditDocument: bind GtkSourceFile and TeplFile :location properties
    
    To be able to use some TeplFile and TeplBuffer APIs.

 gedit/gedit-document.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 35659bbce..3e247c06b 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -719,14 +719,12 @@ static void
 gedit_document_init (GeditDocument *doc)
 {
        GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
+       TeplFile *tepl_file;
        GeditSettings *settings;
        GSettings *editor_settings;
 
        gedit_debug (DEBUG_DOCUMENT);
 
-       settings = _gedit_settings_get_singleton ();
-       editor_settings = _gedit_settings_peek_editor_settings (settings);
-
        priv->untitled_number = get_untitled_number ();
        priv->content_type = get_default_content_type ();
        priv->language_set_by_user = FALSE;
@@ -735,6 +733,12 @@ gedit_document_init (GeditDocument *doc)
        update_time_of_last_save_or_load (doc);
 
        priv->file = gtk_source_file_new ();
+       tepl_file = tepl_buffer_get_file (TEPL_BUFFER (doc));
+
+       g_object_bind_property (priv->file, "location",
+                               tepl_file, "location",
+                               G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+
        priv->metadata = tepl_metadata_new ();
 
        g_signal_connect_object (priv->file,
@@ -743,6 +747,9 @@ gedit_document_init (GeditDocument *doc)
                                 doc,
                                 0);
 
+       settings = _gedit_settings_get_singleton ();
+       editor_settings = _gedit_settings_peek_editor_settings (settings);
+
        g_settings_bind (editor_settings, GEDIT_SETTINGS_MAX_UNDO_ACTIONS,
                         doc, "max-undo-levels",
                         G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);


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