Ticket #1210: 0001-Correctly-store-and-restore-the-sort_column_id.patch

File 0001-Correctly-store-and-restore-the-sort_column_id.patch, 1.3 KB (added by squisher, 14 years ago)

Patch to correctly check the return values of get_sort_column_id(). Not tested, sorry.

  • deluge/ui/gtkui/files_tab.py

    From 6aa925a8edc5b3e9038ec5a74086c94ac87781ce Mon Sep 17 00:00:00 2001
    From: David Mohr <david@mcbf.net>
    Date: Wed, 31 Mar 2010 22:45:57 -0600
    Subject: [PATCH] Correctly store and restore the sort_column_id
    
    ---
     deluge/ui/gtkui/files_tab.py |    6 +++---
     1 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
    index f81820b..bc1bdcd 100644
    a b def save_state(self): 
    230230        # Setup state dict 
    231231        state = { 
    232232            "columns": {}, 
    233             "sort_id": column_id, 
    234             "sort_order": int(sort_order) if sort_order else None 
     233            "sort_id": int(column_id) if column_id >= 0 else None, 
     234            "sort_order": int(sort_order) if sort_order >= 0 else None 
    235235        } 
    236236 
    237237        for index, column in enumerate(self.listview.get_columns()): 
    def load_state(self): 
    268268        if state == None: 
    269269            return 
    270270 
    271         if state["sort_id"] and state["sort_order"] is not None: 
     271        if state["sort_id"] is not None and state["sort_order"] is not None: 
    272272            self.treestore.set_sort_column_id(state["sort_id"], state["sort_order"]) 
    273273 
    274274        for (index, column) in enumerate(self.listview.get_columns()):