[gnome-builder] help: update editor page docs



commit f2f99f7d6121334a1bdb5a68e7adbc349a7e3f73
Author: Christian Hergert <chergert redhat com>
Date:   Tue Mar 12 16:53:17 2019 -0700

    help: update editor page docs

 doc/help/plugins/editor/diagnostics.rst        | 20 ++++++------
 doc/help/plugins/editor/index.rst              |  2 +-
 doc/help/plugins/editor/{view.rst => page.rst} | 43 ++++++++++++--------------
 3 files changed, 32 insertions(+), 33 deletions(-)
---
diff --git a/doc/help/plugins/editor/diagnostics.rst b/doc/help/plugins/editor/diagnostics.rst
index 7adfc1974..1bf1b2073 100644
--- a/doc/help/plugins/editor/diagnostics.rst
+++ b/doc/help/plugins/editor/diagnostics.rst
@@ -12,16 +12,17 @@ The ``do_diagnose_async`` is an asynchronous method that will be called with a c
     # my_plugin.py
     
     import gi
-    gi.require_version('Ide', '1.0')
-    from gi.repository import (
-        Ide,
-        Gio,
-        GLib
-    )
-    
+
+    from gi.repository import GLib, Gio, Ide
     
     class MyDiagnosticProvider(Ide.Object, Ide.DiagnosticProvider):
-        def do_diagnose_async(self, file: Ide.File, buffer: Ide.Buffer, cancellable, callback, user_data):
+        def do_diagnose_async(self,
+                              file: Ide.File,
+                              contents: bytes,
+                              lang_id: str,
+                              cancellable: Gio.Cancellable,
+                              callback: Gio.AsyncReadyCallback,
+                              user_data):
             task = Gio.Task.new(self, cancellable, callback)
             task.diagnostics_list = []
     
@@ -55,4 +56,5 @@ For example, a C diagnostic plugin will have a plugin file that look similar to
     Authors=Author Name <authorname mailprovider com>
     Copyright=Copyright © 2017 Author Name <authorname mailprovider com>
     X-Diagnostic-Provider-Languages=c
-    X-Diagnostic-Provider-Languages-Priority=100
\ No newline at end of file
+    X-Diagnostic-Provider-Languages-Priority=100
+    X-Builder-ABI=3.32
diff --git a/doc/help/plugins/editor/index.rst b/doc/help/plugins/editor/index.rst
index 7ee3ae9ac..ea2e48ad5 100644
--- a/doc/help/plugins/editor/index.rst
+++ b/doc/help/plugins/editor/index.rst
@@ -6,7 +6,7 @@ Extending the Editor
    :maxdepth: 1
    :titlesonly:
 
-   view
+   page
    buffers
    highlighting
    diagnostics
diff --git a/doc/help/plugins/editor/view.rst b/doc/help/plugins/editor/page.rst
similarity index 60%
rename from doc/help/plugins/editor/view.rst
rename to doc/help/plugins/editor/page.rst
index a1e00df29..4d3e0a868 100644
--- a/doc/help/plugins/editor/view.rst
+++ b/doc/help/plugins/editor/page.rst
@@ -1,12 +1,12 @@
 #########################
-Extending the Editor View
+Extending the Editor Page
 #########################
 
 You might want to add additional widgets or perform various operations on the view as the user interacts 
with the code-editor.
-One way to do this is to create an ``Ide.EditorViewAddin`` in your plugin.
+One way to do this is to create an ``Ide.EditorPageAddin`` in your plugin.
 Implementing this interface allows you to be notified whenever a new view is created as well as when the 
current language changes.
 
-Additionally, if you only want your plugin to be enabled when certain languages are active, you can set the 
``X-Editor-View-Languages=c,cplusplus`` keyword in your ``.plugin`` file.
+Additionally, if you only want your plugin to be enabled when certain languages are active, you can set the 
``X-Editor-Page-Languages=c,cplusplus`` keyword in your ``.plugin`` file.
 In the example provided, the plugin interface would be enabled for ``C`` and ``C++`` files.
 
 .. code-block:: python3
@@ -15,51 +15,48 @@ In the example provided, the plugin interface would be enabled for ``C`` and ``C
 
    import gi
 
-   from gi.repository import GObject
-   from gi.repository import Gtk
-   from gi.repository import GtkSource
-   from gi.repository import Ide
+   from gi.repository import GObject, Gtk, GtkSource, Ide
 
-   class MyEditorViewAddin(GObject.Object, Ide.EditorViewAddin):
+   class MyEditorPageAddin(GObject.Object, Ide.EditorPageAddin):
 
-       def do_load(self, view):
+       def do_load(self, page: Ide.EditorPage):
            """
-           @view is an Ide.EditorView which contains the buffer and sourceview.
+           @page: an Ide.EditorPage which contains the buffer and sourceview.
            """
 
            # You get get the Ide.Buffer using
-           buffer = view.get_buffer()
+           buffer = page.get_buffer()
 
-           # Or the Ide.SourceView widget
-           source_view = view.get_view()
+           # Or the Ide.SourcePage widget
+           source_view = page.get_view()
 
            # Toggle the overview map
-           view.set_show_map(True)
-           view.set_auto_hide_map(True)
+           page.set_show_map(True)
+           page.set_auto_hide_map(True)
 
            # Scroll to a given line
-           view.scroll_to_line(100)
+           page.scroll_to_line(100)
 
            # Change the language
            lang = GtkSource.LanguageManager.get_default().get_language('c')
-           view.set_language(lang)
+           page.set_language(lang)
 
            # Jump to the next error
-           view.move_next_error()
+           page.move_next_error()
 
            # Jump to the next search result
-           view.move_next_search_result()
+           page.move_next_search_result()
 
-       def do_unload(self, view):
+       def do_unload(self, page: Ide.EditorPage):
            """
            This should undo anything you setup when loading the addin.
            """
 
-       def do_language_changed(self, lang_id):
+       def do_language_changed(self, lang_id: str):
            print("language was changed to", lang_id)
 
-       def do_stack_set(self, stack):
-           print("View was moved to document stack", stack)
+       def do_stack_set(self, stack: Ide.Frame):
+           print("Page was moved to document stack", stack)
 
            # If you have an Ide.LayoutStackAddin, you might want to coordinate
            # between them. To locate your stack addin, you can fetch it like


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