Fix #2146 : Missing translations in View|Tabs submenu

Also fixed small bug when hiding Status tab
This commit is contained in:
Calum Lind 2012-11-27 01:29:33 +00:00
parent d48d3c9c2f
commit 4f59a48f57
1 changed files with 15 additions and 4 deletions

View File

@ -113,6 +113,15 @@ class TorrentDetails(component.Component):
("Options", True) ("Options", True)
] ]
self.translate_tabs = {
"All" : _("_All"),
"Status" : _("_Status"),
"Details" : _("_Details"),
"Files" : _("_Files"),
"Peers" : _("_Peers"),
"Options" : _("_Options")
}
# Get the state from saved file # Get the state from saved file
state = self.load_state() state = self.load_state()
@ -242,8 +251,8 @@ class TorrentDetails(component.Component):
def hide_tab(self, tab_name): def hide_tab(self, tab_name):
"""Hides tab by name""" """Hides tab by name"""
self.notebook.remove_page(self.tabs[tab_name].position)
self.tabs[tab_name].is_visible = False self.tabs[tab_name].is_visible = False
self.notebook.remove_page(self.tabs[tab_name].position)
self.regenerate_positions() self.regenerate_positions()
self.generate_menu() self.generate_menu()
@ -275,7 +284,8 @@ class TorrentDetails(component.Component):
"""Generates the checklist menu for all the tabs and attaches it""" """Generates the checklist menu for all the tabs and attaches it"""
menu = gtk.Menu() menu = gtk.Menu()
# Create 'All' menuitem and a separator # Create 'All' menuitem and a separator
menuitem = gtk.CheckMenuItem("All") menuitem = gtk.CheckMenuItem(self.translate_tabs["All"], True)
menuitem.set_name("All")
all_tabs = True all_tabs = True
for key in self.tabs: for key in self.tabs:
@ -297,7 +307,8 @@ class TorrentDetails(component.Component):
menuitem_list.sort() menuitem_list.sort()
for pos, name in menuitem_list: for pos, name in menuitem_list:
menuitem = gtk.CheckMenuItem(name) menuitem = gtk.CheckMenuItem(self.translate_tabs[name], True)
menuitem.set_name(name)
menuitem.set_active(self.tabs[name].is_visible) menuitem.set_active(self.tabs[name].is_visible)
menuitem.connect("toggled", self._on_menuitem_toggled) menuitem.connect("toggled", self._on_menuitem_toggled)
menu.append(menuitem) menu.append(menuitem)
@ -386,7 +397,7 @@ class TorrentDetails(component.Component):
def _on_menuitem_toggled(self, widget): def _on_menuitem_toggled(self, widget):
# Get the tab name # Get the tab name
name = widget.get_child().get_text() name = widget.get_name()
if name == "All": if name == "All":
if widget.get_active(): if widget.get_active():
self.show_all_tabs() self.show_all_tabs()