[GTKUI] Implement show ownership option in GTKUI

This commit is contained in:
bendikro 2014-09-08 19:05:36 +02:00 committed by Calum Lind
parent 620a4eb409
commit 6892a00b86
4 changed files with 20 additions and 2 deletions

View File

@ -294,7 +294,9 @@ class FilterTreeView(component.Component):
try:
hide_cat = []
if not self.config["sidebar_show_trackers"]:
hide_cat = ["tracker_host"]
hide_cat.append("tracker_host")
if not self.config["sidebar_show_owners"]:
hide_cat.append("owner")
client.core.get_filter_tree(self.config["sidebar_show_zero"],
hide_cat).addCallback(self.cb_update_filter_tree)
except Exception as ex:

View File

@ -319,6 +319,15 @@
<signal name="toggled" handler="on_menuitem_sidebar_trackers_toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="sidebar_show_owners">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Show _Owners</property>
<property name="active">True</property>
<signal name="toggled" handler="on_menuitem_sidebar_owners_toggled" swapped="no"/>
</object>
</child>
</object>
</child>
</object>

View File

@ -132,6 +132,7 @@ DEFAULT_PREFS = {
"show_statusbar": True,
"sidebar_show_zero": False,
"sidebar_show_trackers": True,
"sidebar_show_owners": True,
"sidebar_position": 170,
"show_rate_in_title": False,
"createtorrent.trackers": [],

View File

@ -108,6 +108,7 @@ class MenuBar(component.Component):
self.main_builder.get_object("menuitem_statusbar").set_active(self.config["show_statusbar"])
self.main_builder.get_object("sidebar_show_zero").set_active(self.config["sidebar_show_zero"])
self.main_builder.get_object("sidebar_show_trackers").set_active(self.config["sidebar_show_trackers"])
self.main_builder.get_object("sidebar_show_owners").set_active(self.config["sidebar_show_owners"])
# Connect main window Signals #
component.get("MainWindow").connect_signals({
@ -132,7 +133,8 @@ class MenuBar(component.Component):
"on_menuitem_community_activate": self.on_menuitem_community_activate,
"on_menuitem_about_activate": self.on_menuitem_about_activate,
"on_menuitem_sidebar_zero_toggled": self.on_menuitem_sidebar_zero_toggled,
"on_menuitem_sidebar_trackers_toggled": self.on_menuitem_sidebar_trackers_toggled
"on_menuitem_sidebar_trackers_toggled": self.on_menuitem_sidebar_trackers_toggled,
"on_menuitem_sidebar_owners_toggled": self.on_menuitem_sidebar_owners_toggled
})
# Connect menubar signals
@ -481,6 +483,10 @@ class MenuBar(component.Component):
self.config["sidebar_show_trackers"] = widget.get_active()
component.get("FilterTreeView").update()
def on_menuitem_sidebar_owners_toggled(self, widget):
self.config["sidebar_show_owners"] = widget.get_active()
component.get("FilterTreeView").update()
def _on_known_accounts(self, known_accounts):
known_accounts_to_log = []
for account in known_accounts: