Merge a branch from Stephen J Boddy to add a keyboard shortcut for changing the window title

This commit is contained in:
Chris Jones 2012-07-10 19:41:26 +01:00
commit 3dd931e19a
3 changed files with 35 additions and 2 deletions

View File

@ -163,7 +163,8 @@ DEFAULTS = {
'broadcast_group' : '', 'broadcast_group' : '',
'broadcast_all' : '', 'broadcast_all' : '',
'insert_number' : '', 'insert_number' : '',
'insert_padded' : '' 'insert_padded' : '',
'edit_window_title': ''
}, },
'profiles': { 'profiles': {
'default': { 'default': {

View File

@ -128,7 +128,8 @@ class PrefsEditor:
'broadcast_group' : 'Broadcast key presses to group', 'broadcast_group' : 'Broadcast key presses to group',
'broadcast_all' : 'Broadcast key events to all', 'broadcast_all' : 'Broadcast key events to all',
'insert_number' : 'Insert terminal number', 'insert_number' : 'Insert terminal number',
'insert_padded' : 'Insert zero padded terminal number' 'insert_padded' : 'Insert zero padded terminal number',
'edit_window_title': 'Edit window title'
} }
def __init__ (self, term): def __init__ (self, term):

View File

@ -1640,6 +1640,37 @@ class Terminal(gtk.VBox):
def key_insert_padded(self): def key_insert_padded(self):
self.emit('enumerate', True) self.emit('enumerate', True)
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 # End key events
gobject.type_register(Terminal) gobject.type_register(Terminal)