Tidy up some focus grabbing on new Terminal creation. Closes LP #558376

This commit is contained in:
Chris Jones 2010-04-09 12:58:46 +01:00
parent 71e6acd6e4
commit 68da0b24b3
2 changed files with 6 additions and 2 deletions

View File

@ -125,6 +125,7 @@ class Notebook(Container, gtk.Notebook):
self.set_current_page(page_num)
self.show_all()
terminal.grab_focus()
def add(self, widget):
"""Add a widget to the container"""
@ -196,7 +197,9 @@ class Notebook(Container, gtk.Notebook):
gtk.PACK_START)
self.set_current_page(-1)
widget.grab_focus()
self.show_all()
if maker.isinstance(widget, 'Terminal'):
widget.grab_focus()
def wrapcloseterm(self, widget):
"""A child terminal has closed"""

View File

@ -925,7 +925,8 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
def grab_focus(self):
"""Steal focus for this terminal"""
self.vte.grab_focus()
if not self.vte.has_focus():
self.vte.grab_focus()
def on_vte_focus(self, _widget):
"""Update our UI when we get focus"""