[gedit] GeditDocument: remove the ::cursor-moved signal



commit 8b01acace2a20e441cf8ce3b1f12af8349cee9de
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Nov 14 08:09:46 2020 +0100

    GeditDocument: remove the ::cursor-moved signal

 docs/reference/api-breaks.xml | 13 +++++++
 gedit/gedit-document.c        | 83 -------------------------------------------
 gedit/gedit-document.h        |  1 -
 3 files changed, 13 insertions(+), 84 deletions(-)
---
diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
index b8dba4f79..0ca693d0c 100644
--- a/docs/reference/api-breaks.xml
+++ b/docs/reference/api-breaks.xml
@@ -36,6 +36,19 @@
           instead.
         </para>
       </listitem>
+      <listitem>
+        <para>
+          <link linkend="GeditDocument">GeditDocument</link> is now a subclass
+          of <link linkend="TeplBuffer">TeplBuffer</link>.
+        </para>
+      </listitem>
+      <listitem>
+        <para>
+          The <code>GeditDocument::cursor-moved</code> signal has been removed.
+          You can use the <link linkend="TeplBuffer">TeplBuffer</link> API
+          instead.
+        </para>
+      </listitem>
     </itemizedlist>
   </refsect1>
 
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index f32f4e305..35659bbce 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -86,7 +86,6 @@ static GParamSpec *properties[LAST_PROP];
 
 enum
 {
-       CURSOR_MOVED,
        LOAD,
        LOADED,
        SAVE,
@@ -329,65 +328,6 @@ gedit_document_set_property (GObject      *object,
        }
 }
 
-static void
-gedit_document_begin_user_action (GtkTextBuffer *buffer)
-{
-       GeditDocumentPrivate *priv;
-
-       priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer));
-
-       ++priv->user_action;
-
-       if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->begin_user_action != NULL)
-       {
-               GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->begin_user_action (buffer);
-       }
-}
-
-static void
-gedit_document_end_user_action (GtkTextBuffer *buffer)
-{
-       GeditDocumentPrivate *priv;
-
-       priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer));
-
-       --priv->user_action;
-
-       if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action != NULL)
-       {
-               GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action (buffer);
-       }
-}
-
-static void
-gedit_document_mark_set (GtkTextBuffer     *buffer,
-                         const GtkTextIter *iter,
-                         GtkTextMark       *mark)
-{
-       GeditDocument *doc = GEDIT_DOCUMENT (buffer);
-       GeditDocumentPrivate *priv;
-
-       priv = gedit_document_get_instance_private (doc);
-
-       if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set != NULL)
-       {
-               GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set (buffer, iter, mark);
-       }
-
-       if (mark == gtk_text_buffer_get_insert (buffer) && (priv->user_action == 0))
-       {
-               g_signal_emit (doc, document_signals[CURSOR_MOVED], 0);
-       }
-}
-
-static void
-gedit_document_changed (GtkTextBuffer *buffer)
-{
-       g_signal_emit (GEDIT_DOCUMENT (buffer), document_signals[CURSOR_MOVED], 0);
-
-       GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->changed (buffer);
-}
-
 static void
 gedit_document_constructed (GObject *object)
 {
@@ -410,7 +350,6 @@ static void
 gedit_document_class_init (GeditDocumentClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       GtkTextBufferClass *buf_class = GTK_TEXT_BUFFER_CLASS (klass);
 
        object_class->dispose = gedit_document_dispose;
        object_class->finalize = gedit_document_finalize;
@@ -418,11 +357,6 @@ gedit_document_class_init (GeditDocumentClass *klass)
        object_class->set_property = gedit_document_set_property;
        object_class->constructed = gedit_document_constructed;
 
-       buf_class->begin_user_action = gedit_document_begin_user_action;
-       buf_class->end_user_action = gedit_document_end_user_action;
-       buf_class->mark_set = gedit_document_mark_set;
-       buf_class->changed = gedit_document_changed;
-
        klass->loaded = gedit_document_loaded_real;
        klass->saved = gedit_document_saved_real;
 
@@ -479,23 +413,6 @@ gedit_document_class_init (GeditDocumentClass *klass)
 
        g_object_class_install_properties (object_class, LAST_PROP, properties);
 
-       /* This signal is used to update the cursor position in the statusbar,
-        * it's emitted either when the insert mark is moved explicitely or
-        * when the buffer changes (insert/delete).
-        * FIXME When the replace_all was implemented in gedit, this signal was
-        * not emitted during the replace_all to improve performance. Now the
-        * replace_all is implemented in GtkSourceView, so the signal is
-        * emitted.
-        */
-       document_signals[CURSOR_MOVED] =
-               g_signal_new ("cursor-moved",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (GeditDocumentClass, cursor_moved),
-                             NULL, NULL, NULL,
-                             G_TYPE_NONE,
-                             0);
-
        /**
         * GeditDocument::load:
         * @document: the #GeditDocument.
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index ff661b9c0..faa503f8b 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -37,7 +37,6 @@ struct _GeditDocumentClass
        TeplBufferClass parent_class;
 
        /* Signals */
-       void (* cursor_moved)           (GeditDocument *document);
 
        void (* load)                   (GeditDocument *document);
 


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