change the multiple filters to be configurable, deprecating the show trackers with zero torrents option

This commit is contained in:
Damien Churchill 2010-04-28 14:15:50 +01:00
parent 67905b6f5b
commit fd122db7b7
3 changed files with 25 additions and 11 deletions

View File

@ -77,6 +77,11 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
panel.on('selectionchange', function(view, nodes) {
deluge.ui.update();
});
panel.on('show', function() {
if (!deluge.config.sidebar_multiple_filters) {
deluge.ui.update();
}
});
this.add(panel);
this.doLayout();
@ -94,12 +99,21 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
getFilterStates: function() {
var states = {}
// Grab the filters from each of the filter panels
this.items.each(function(panel) {
var state = panel.getState();
if (!state == null) return;
states[panel.filterType] = state;
}, this);
if (deluge.config.sidebar_multiple_filters) {
// Grab the filters from each of the filter panels
this.items.each(function(panel) {
var state = panel.getState();
if (!state == null) return;
states[panel.filterType] = state;
}, this);
} else {
var panel = this.getLayout().activeItem;
if (panel) {
var state = panel.getState();
if (!state == null) return;
states[panel.filterType] = state;
}
}
return states;
},

View File

@ -74,12 +74,12 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '',
boxLabel: _('Show filters with zero torrents')
}));
optMan.bind('sidebar_show_trackers', fieldset.add({
name: 'sidebar_show_trackers',
optMan.bind('sidebar_multiple_filters', fieldset.add({
name: 'sidebar_multiple_filters',
height: 22,
fieldLabel: '',
labelSeparator: '',
boxLabel: _('Show trackers with zero torrents')
boxLabel: _('Allow the use of multiple filters at once')
}));
fieldset = this.add({

View File

@ -99,7 +99,7 @@ CONFIG_DEFAULTS = {
# UI Settings
"sidebar_show_zero": False,
"sidebar_show_trackers": False,
"sidebar_multiple_filters": True,
"show_session_speed": False,
"show_sidebar": True,
"theme": "gray",
@ -114,7 +114,7 @@ CONFIG_DEFAULTS = {
}
UI_CONFIG_KEYS = (
"theme", "sidebar_show_zero", "sidebar_show_trackers",
"theme", "sidebar_show_zero", "sidebar_multiple_filters",
"show_session_speed", "base", "first_login"
)