Clean up the patch from David Caro

This commit is contained in:
Stephen Boddy 2013-07-16 19:56:14 +02:00
parent 15c92c09a0
commit f4cc83c1e6
1 changed files with 25 additions and 22 deletions

View File

@ -55,7 +55,6 @@ class CustomCommandsMenu(plugin.MenuItem):
for cmd in noord_cmds: for cmd in noord_cmds:
self.cmd_list[len(self.cmd_list)] = cmd self.cmd_list[len(self.cmd_list)] = cmd
def callback(self, menuitems, menu, terminal): def callback(self, menuitems, menu, terminal):
"""Add our menu items to the menu""" """Add our menu items to the menu"""
item = gtk.MenuItem(_('Custom Commands')) item = gtk.MenuItem(_('Custom Commands'))
@ -195,10 +194,11 @@ class CustomCommandsMenu(plugin.MenuItem):
button.set_sensitive(False) button.set_sensitive(False)
ui['button_delete'] = button ui['button_delete'] = button
hbox.pack_start(button_box) hbox.pack_start(button_box)
dbox.show_all() dbox.show_all()
res = dbox.run() res = dbox.run()
if res == gtk.RESPONSE_ACCEPT: if res == gtk.RESPONSE_ACCEPT:
self.update_cmd_list(store) self.update_cmd_list(store)
self._save_config() self._save_config()
@ -387,14 +387,17 @@ class CustomCommandsMenu(plugin.MenuItem):
(store, iter) = selection.get_selected() (store, iter) = selection.get_selected()
if iter: if iter:
store.remove(iter) store.remove(iter)
return return
def on_edit(self, button, data): def on_edit(self, button, data):
treeview = data['treeview'] treeview = data['treeview']
selection = treeview.get_selection() selection = treeview.get_selection()
(store, iter) = selection.get_selected() (store, iter) = selection.get_selected()
if not iter: if not iter:
return return
(dialog,enabled,name,command) = self._create_command_dialog( (dialog,enabled,name,command) = self._create_command_dialog(
enabled_var = store.get_value(iter, CC_COL_ENABLED), enabled_var = store.get_value(iter, CC_COL_ENABLED),
name_var = store.get_value(iter, CC_COL_NAME), name_var = store.get_value(iter, CC_COL_NAME),