[gitg/wip/commit] Do not emit signals when clearing the model



commit a72e3f0dac21d506d0dd994cd0fa2d038249cf56
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Jul 3 18:51:11 2013 +0200

    Do not emit signals when clearing the model

 libgitg/gitg-sidebar.vala |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/libgitg/gitg-sidebar.vala b/libgitg/gitg-sidebar.vala
index b5b4ea4..21f284a 100644
--- a/libgitg/gitg-sidebar.vala
+++ b/libgitg/gitg-sidebar.vala
@@ -67,6 +67,7 @@ public class SidebarStore : Gtk.TreeStore
        private uint d_oid;
        private uint d_sections;
        private SList<Gtk.TreeIter?> d_parents;
+       private bool d_clearing;
 
        construct
        {
@@ -167,9 +168,16 @@ public class SidebarStore : Gtk.TreeStore
                ++d_sections;
        }
 
+       public bool clearing
+       {
+               get { return d_clearing; }
+       }
+
        public new void clear()
        {
+               d_clearing = true;
                base.clear();
+               d_clearing = false;
 
                d_oid = 0;
                d_sections = 0;
@@ -399,6 +407,11 @@ public class Sidebar : Gtk.TreeView
                sel.changed.connect((sel) => {
                        Gtk.TreeIter iter;
 
+                       if (model.clearing)
+                       {
+                               return;
+                       }
+
                        if (sel.get_selected(null, out iter))
                        {
                                model.activate(iter, 1);


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