Add shortcut (no default) to edit window title.

This commit is contained in:
Stephen Boddy 2012-06-26 20:29:54 +02:00
parent 1e68ae9107
commit e5eda24a21
3 changed files with 35 additions and 2 deletions

View File

@ -161,7 +161,8 @@ DEFAULTS = {
'new_terminator' : '<Super>i',
'broadcast_off' : '',
'broadcast_group' : '',
'broadcast_all' : ''
'broadcast_all' : '',
'edit_window_title': ''
},
'profiles': {
'default': {

View File

@ -126,7 +126,8 @@ class PrefsEditor:
'new_terminator' : 'Spawn a new Terminator process',
'broadcast_off' : 'Don\'t broadcast key presses',
'broadcast_group' : 'Broadcast key presses to group',
'broadcast_all' : 'Broadcast key events to all'
'broadcast_all' : 'Broadcast key events to all',
'edit_window_title': 'Edit window title'
}
def __init__ (self, term):

View File

@ -1634,6 +1634,37 @@ class Terminal(gtk.VBox):
def key_broadcast_all(self):
self.set_groupsend(None, self.terminator.groupsend_type['all'])
def key_edit_window_title(self):
window = self.get_toplevel()
dialog = gtk.Dialog(_('Rename Window'), window,
gtk.DIALOG_MODAL,
( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT ))
dialog.set_default_response(gtk.RESPONSE_ACCEPT)
dialog.set_has_separator(False)
dialog.set_resizable(False)
dialog.set_border_width(8)
label = gtk.Label(_('Enter a new title for the Terminator window...'))
name = gtk.Entry()
name.set_activates_default(True)
if window.title.text != self.vte.get_window_title():
name.set_text(self.get_toplevel().title.text)
dialog.vbox.pack_start(label, False, False, 6)
dialog.vbox.pack_start(name, False, False, 6)
dialog.show_all()
res = dialog.run()
if res == gtk.RESPONSE_ACCEPT:
if name.get_text():
window.title.force_title(None)
window.title.force_title(name.get_text())
else:
window.title.force_title(None)
dialog.destroy()
return
# End key events
gobject.type_register(Terminal)