Merge a branch from Stephen J Boddy to add a keyboard shortcut for changing the window title
This commit is contained in:
commit
3dd931e19a
|
@ -163,7 +163,8 @@ DEFAULTS = {
|
|||
'broadcast_group' : '',
|
||||
'broadcast_all' : '',
|
||||
'insert_number' : '',
|
||||
'insert_padded' : ''
|
||||
'insert_padded' : '',
|
||||
'edit_window_title': ''
|
||||
},
|
||||
'profiles': {
|
||||
'default': {
|
||||
|
|
|
@ -128,7 +128,8 @@ class PrefsEditor:
|
|||
'broadcast_group' : 'Broadcast key presses to group',
|
||||
'broadcast_all' : 'Broadcast key events to all',
|
||||
'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):
|
||||
|
|
|
@ -1640,6 +1640,37 @@ class Terminal(gtk.VBox):
|
|||
def key_insert_padded(self):
|
||||
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
|
||||
|
||||
gobject.type_register(Terminal)
|
||||
|
|
Loading…
Reference in New Issue