1- import gtk
1+ import gi
2+ gi .require_version ('Gtk' ,'3.0' )
3+ from gi .repository import Gtk
4+ from gi .repository import Gdk
25import urllib
36import terminatorlib .plugin as plugin
47import re
1215# AVAILABLE must contain a list of all the classes that you want exposed
1316AVAILABLE = ['SearchPlugin' ]
1417
18+ gtk = Gtk
19+
1520_spaces = re .compile (" +" )
1621
1722# TODO: move some of the constants into a config object
@@ -25,15 +30,15 @@ def do_search(self, searchMenu):
2530return
2631base_uri = "http://www.google.com/search?q=%s"
2732uri = base_uri % urllib .quote (self .searchstring .encode ("utf-8" ))
28- gtk .show_uri (None ,uri ,gtk . gdk .CURRENT_TIME )
33+ gtk .show_uri (None ,uri ,Gdk .CURRENT_TIME )
2934
3035def callback (self ,menuitems ,menu ,terminal ):
3136"""Add our menu item to the menu"""
3237self .terminal = terminal
3338item = gtk .ImageMenuItem (gtk .STOCK_FIND )
3439item .connect ('activate' ,self .do_search )
3540if terminal .vte .get_has_selection ():
36- clip = gtk .clipboard_get ( gtk . gdk .SELECTION_PRIMARY )
41+ clip = gtk .Clipboard . get ( Gdk .SELECTION_PRIMARY )
3742self .searchstring = clip .wait_for_text ().strip ()
3843self .searchstring = self .searchstring .replace ("\n " ," " )
3944self .searchstring = self .searchstring .replace ("\t " ," " )