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

View File

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

View File

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