[latexila] FileBrowser: fix sensitivity problem for the jump button



commit 2df59d1fa48468cf7782df4ec9b8097a2b127dd5
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Aug 12 16:22:26 2017 +0200

    FileBrowser: fix sensitivity problem for the jump button
    
    Make the button always sensitive, the code to update the sensitivity was
    not well implemented, it's a bit more complicated to implement it
    correctly, and it doesn't worth it because I anyway plan to implement a
    file browser widget in Tepl.

 src/file_browser.vala |   26 +++-----------------------
 1 files changed, 3 insertions(+), 23 deletions(-)
---
diff --git a/src/file_browser.vala b/src/file_browser.vala
index b4d96fc..4039e06 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -251,24 +251,10 @@ public class FileBrowser : Grid
 
         jump_button.clicked.connect (() =>
         {
-            return_if_fail (_main_window.active_tab != null);
-            return_if_fail (_main_window.active_document.location != null);
-
-            set_directory (_main_window.active_document.location.get_parent ());
-        });
-
-        // sensitivity
-        _main_window.notify["active-document"].connect (() =>
-        {
-            update_jump_button_sensitivity (jump_button);
-
-            // update when location changes
-            if (_main_window.active_document != null)
+            if (_main_window.active_document != null &&
+                _main_window.active_document.location != null)
             {
-                _main_window.active_document.notify["location"].connect (() =>
-                {
-                    update_jump_button_sensitivity (jump_button);
-                });
+                set_directory (_main_window.active_document.location.get_parent ());
             }
         });
 
@@ -627,12 +613,6 @@ public class FileBrowser : Grid
         monitor_directory ();
     }
 
-    private void update_jump_button_sensitivity (ToolButton jump_button)
-    {
-        jump_button.sensitive = _main_window.active_tab != null
-            && _main_window.active_document.location != null;
-    }
-
     private int on_sort (TreeModel model, TreeIter a, TreeIter b)
     {
         bool a_is_dir, b_is_dir;


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