22import sys
33import logging
44import tempfile
5- import ctags
5+ from . import ctags
66from gi .repository import GObject , GdkPixbuf , Gedit , Gtk , PeasGtk , Gio
77
8+ import gi
9+ gi .require_version ('Tepl' , '6' )
10+ from gi .repository import Tepl
11+
812logging .basicConfig ()
913LOG_LEVEL = logging .WARN
1014SETTINGS_SCHEMA = "org.gnome.gedit.plugins.sourcecodebrowser"
@@ -330,7 +334,7 @@ def do_activate(self):
330334 self ._sourcetree .expand_rows = self .expand_rows
331335 self ._sourcetree .sort_list = self .sort_list
332336 panel = self .window .get_side_panel ()
333- panel .add_item (self ._sourcetree , "SymbolBrowserPlugin" , "Source Code" , self . icon )
337+ panel .add_titled (self ._sourcetree , "SymbolBrowserPlugin" , "Source Code" )
334338 self ._handlers = []
335339 hid = self ._sourcetree .connect ("focus" , self .on_sourcetree_focus )
336340 self ._handlers .append ((self ._sourcetree , hid ))
@@ -353,7 +357,7 @@ def do_deactivate(self):
353357 obj .disconnect (hid )
354358 self ._handlers = None
355359 pane = self .window .get_side_panel ()
356- pane .remove_item (self ._sourcetree )
360+ pane .remove (self ._sourcetree )
357361 self ._sourcetree = None
358362
359363 def _has_settings_schema (self ):
@@ -393,12 +397,12 @@ def _load_active_document_symbols(self):
393397 self ._is_loaded = False
394398 # do not load if not the active tab in the panel
395399 panel = self .window .get_side_panel ()
396- if not panel .item_is_active ( self ._sourcetree ) :
400+ if panel .get_visible_child () != self ._sourcetree :
397401 return
398402
399403 document = self .window .get_active_document ()
400404 if document :
401- location = document .get_location ()
405+ location = document .get_file (). get_location ()
402406 if location :
403407 uri = location .get_uri ()
404408 self ._log .debug ("Loading %s..." , uri )
@@ -470,8 +474,8 @@ def on_tag_activated(self, sourcetree, location, data=None):
470474 document = self .window .get_active_document ()
471475 view = self .window .get_active_view ()
472476 line = int (line ) - 1 # lines start from 0
473- document . goto_line ( line )
474- view . scroll_to_cursor ( )
477+
478+ Tepl . View . goto_line ( view , line )
475479
476480 def _version_check (self ):
477481 """ Make sure the exhuberant ctags is installed. """
@@ -481,4 +485,4 @@ def _version_check(self):
481485 (self .ctags_executable ))
482486
483487
484-
488+
0 commit comments