[latexila] Hack: resize IconView containing the symbols



commit 317ba24fadec829d4d6789ff77e75bb322b702c4
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Fri Apr 13 21:32:53 2012 +0200

    Hack: resize IconView containing the symbols
    
    It's a workaround due to a bug in GTK+ 3.4 that seems will not be fixed
    this cycle :(

 src/main_window.vala |    5 +++++
 src/symbols.vala     |   23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 7679d26..f5216c0 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -478,6 +478,11 @@ public class MainWindow : Window
         main_vgrid.add (main_hpaned);
         main_hpaned.show ();
 
+        main_hpaned.notify["position"].connect (() =>
+        {
+            this.symbols.resize_iconview ();
+        });
+
         // vgrid source view: documents panel, goto line, search and replace
         Grid vgrid_source_view = new Grid ();
         vgrid_source_view.orientation = Orientation.VERTICAL;
diff --git a/src/symbols.vala b/src/symbols.vala
index 09df126..a31007a 100644
--- a/src/symbols.vala
+++ b/src/symbols.vala
@@ -713,6 +713,8 @@ public class Symbols : Grid
     private IconView symbol_view;
     private Button _clear_button;
 
+    private uint _timeout_id = 0;
+
     public Symbols (MainWindow main_window)
     {
         this.main_window = main_window;
@@ -726,6 +728,27 @@ public class Symbols : Grid
 
         show_all ();
         _clear_button.hide ();
+
+        show.connect (() => resize_iconview ());
+    }
+
+    // HACK the IconView is not resized with GTK+ 3.4, see:
+    // https://bugzilla.gnome.org/show_bug.cgi?id=673326
+    // TODO when the IconView is fixed, remove this hack.
+    public void resize_iconview ()
+    {
+        if (_timeout_id > 0)
+            return;
+
+        // Resize every 100ms.
+        _timeout_id = Timeout.add (100, () =>
+        {
+            TreeModel model = this.symbol_view.get_model ();
+            this.symbol_view.set_model (null);
+            this.symbol_view.set_model (model);
+            _timeout_id = 0;
+            return false;
+        });
     }
 
     private void init_stores ()



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