[gnome-maps/wip/mlundblad/always-show-transit-button] sidebar: Grey-out transit switch when not available




commit ceb41d65e9bd2e84a787a36c8d80c27eb09e0e97
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Apr 21 23:16:44 2021 +0200

    sidebar: Grey-out transit switch when not available
    
    Due to a bug in GTK where setting visible false on a linked
    button not working properly, we used to call destroy()
    on this button when transit providers where not available.
    Since calling destroy() on widgets will not be supported
    in GTK 4 and we could instead dim the button in this case
    as this feature has now been exposed by default for a while.
    And originally it was hidden since the feature where itself
    hidden.

 src/sidebar.js | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/sidebar.js b/src/sidebar.js
index e623d4bf..3e97e3dc 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -97,13 +97,9 @@ var Sidebar = GObject.registerClass({
         this._switchRoutingMode(Application.routeQuery.transportation);
         /* Enable/disable transit mode switch based on the presence of
          * public transit providers.
-         * For some reason, setting visible to false in the UI file and
-         * dynamically setting visible false here doesn't work, maybe because
-         * it's part of a radio group? As a workaround, just remove the button
-         * instead.
          */
-        if (!Application.routingDelegator.transitRouter.enabled)
-            this._modeTransitToggle.destroy();
+        this._modeTransitToggle.sensitive =
+            Application.routingDelegator.transitRouter.enabled;
     }
 
     _initTransportationToggles(pedestrian, bike, car, transit) {


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