[banshee] [AddinView] Update model when a checkbox is toggled



commit ac7975a59eeafe57ce347e0598166bd9f80e84ed
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sun Apr 11 15:55:09 2010 +0200

    [AddinView] Update model when a checkbox is toggled
    
    Any addins that depend on the one that is disabled are disabled
    automatically, so we need to update the tree view to make that visible.
    We just add a call to update_model () in the Toggled handler, but that
    means the code block has to be moved after the update_model declaration.

 .../Banshee.Addins.Gui/AddinView.cs                |   31 ++++++++++---------
 1 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs b/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs
index a921718..22e1a3d 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs
@@ -89,21 +89,6 @@ namespace Banshee.Addins.Gui
                 Model = model
             };
 
-            var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
-            tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);
-
-            var check_cell = new CellRendererToggle () { Activatable = true };
-            tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
-            check_cell.Toggled += (o, a) => {
-                TreeIter iter;
-                if (model.GetIter (out iter, new TreePath (a.Path))) {
-                    var addin = model.GetValue (iter, 3) as Addin;
-                    bool enabled = (bool) model.GetValue (iter, 1);
-                    addin.Enabled = !enabled;
-                    model.SetValue (iter, 1, addin.Enabled);
-                }
-            };
-
             var update_model = new System.Action (() => {
                 string search = search_entry.Query;
                 bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
@@ -132,6 +117,22 @@ namespace Banshee.Addins.Gui
                 tree_view.ExpandAll ();
             });
 
+            var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
+            tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);
+
+            var check_cell = new CellRendererToggle () { Activatable = true };
+            tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
+            check_cell.Toggled += (o, a) => {
+                TreeIter iter;
+                if (model.GetIter (out iter, new TreePath (a.Path))) {
+                    var addin = model.GetValue (iter, 3) as Addin;
+                    bool enabled = (bool) model.GetValue (iter, 1);
+                    addin.Enabled = !enabled;
+                    model.SetValue (iter, 1, addin.Enabled);
+                    update_model ();
+                }
+            };
+
             update_model ();
             search_entry.Changed += (o, a) => update_model ();
             filter_combo.Changed += (o, a) => update_model ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]