@@ 485,6 485,24 @@ impl AppWindow {
Some(model)
} else if let Some(network) = self.network() {
let new_model = DebtRequestsModel::new(network).ok();
+
+ if let Some(new_model) = new_model.as_ref() {
+ // restore sort settings
+ let tree_store = new_model.tree_store();
+ if_chain! {
+ if let Some(sort_column) = self.preferences.debt_requests_sort_column();
+ if let Some(sort_type) = self.preferences.debt_requests_sort_type();
+ then {
+ tree_store.set_sort_column_id(gtk::SortColumn::Index(sort_column), sort_type);
+ }
+ }
+
+ // connect sort signal
+ tree_store.connect_sort_column_changed(clone!(@strong self.self_tx as tx => move |_| {
+ dispatch_msg!(tx, Message::DebtRequestsSortColumnChanged);
+ }));
+ }
+
self.debt_requests_model = new_model;
self.debt_requests_model.as_mut()
} else {
@@ 493,21 511,6 @@ impl AppWindow {
};
if let Some(model) = model {
- // restore sort settings
- let tree_store = model.tree_store();
- if_chain! {
- if let Some(sort_column) = self.preferences.debt_requests_sort_column();
- if let Some(sort_type) = self.preferences.debt_requests_sort_type();
- then {
- tree_store.set_sort_column_id(gtk::SortColumn::Index(sort_column), sort_type);
- }
- }
-
- // connect sort signal
- tree_store.connect_sort_column_changed(clone!(@strong self.self_tx as tx => move |_| {
- dispatch_msg!(tx, Message::DebtRequestsSortColumnChanged);
- }));
-
// set the model on the tree view.
self.debt_requests_tree_view.set_octahedron_model(model);