[libadwaita/wip/exalm/flat-switcher: 2/2] view-switcher: Use .flat buttons




commit 48680af11872bd5b2b917d5fdb78126a7075891b
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Apr 28 18:02:25 2021 +0500

    view-switcher: Use .flat buttons
    
    Don't reinvent styles and just use the defaults.

 src/adw-view-switcher-button.ui            |  3 ++
 src/stylesheet/widgets/_view-switcher.scss | 65 ------------------------------
 2 files changed, 3 insertions(+), 65 deletions(-)
---
diff --git a/src/adw-view-switcher-button.ui b/src/adw-view-switcher-button.ui
index 79418a2..2836954 100644
--- a/src/adw-view-switcher-button.ui
+++ b/src/adw-view-switcher-button.ui
@@ -3,6 +3,9 @@
   <requires lib="gtk" version="4.0"/>
   <template class="AdwViewSwitcherButton" parent="GtkToggleButton">
     <signal name="notify::active" handler="active_changed_cb" after="yes"/>
+    <style>
+      <class name="flat"/>
+    </style>
     <child>
       <object class="GtkStack" id="stack">
         <property name="hhomogeneous">False</property>
diff --git a/src/stylesheet/widgets/_view-switcher.scss b/src/stylesheet/widgets/_view-switcher.scss
index a0c67aa..5bc1c8e 100644
--- a/src/stylesheet/widgets/_view-switcher.scss
+++ b/src/stylesheet/widgets/_view-switcher.scss
@@ -6,73 +6,8 @@ viewswitcher {
 
   button {
     border-radius: 0;
-    border-top: 0;
-    border-bottom: 0;
-    box-shadow: none;
     font-size: 1rem;
 
-    &:not(:checked):not(:hover) {
-      background: transparent;
-    }
-
-    &:not(:only-child):not(:last-child) {
-      border-right-width: 0px;
-    }
-
-    &:not(only-child):first-child:not(:checked):not(:hover),
-    &:not(:checked):not(:hover) + button:not(:checked):not(:hover) {
-      border-left-color: transparent;
-    }
-
-    &:not(only-child):last-child:not(:checked):not(:hover) {
-      border-right-color: transparent;
-    }
-
-    &:not(:checked):hover:not(:backdrop) {
-      background-image: image(lighter($bg_color));
-    }
-
-    &:not(only-child):first-child:not(:checked):hover,
-    &:not(:checked):hover + button:not(:checked):not(:hover),
-    &:not(:checked):not(:hover) + button:not(:checked):hover {
-      border-left-color: shade($borders_color, 1.15);
-    }
-
-    &:not(only-child):last-child:not(:checked):hover {
-      border-right-color: shade($borders_color, 1.15);
-    }
-
-    &:not(:checked):hover:backdrop {
-      background-image: image($bg_color);
-    }
-
-    // View switcher in a header bar
-    headerbar &:not(:checked) {
-      &:hover:not(:backdrop) {
-        // Reimplementation of $button_fill from Adwaita. The colors are made
-        // only 70% visible to avoid the highlight to be too strong.
-        $c: transparentize($bg_color, 0.3);
-        $button_fill: if($variant == 'light', linear-gradient(to top, shade($c, 0.96) 2px, $c),
-                                              linear-gradient(to top, shade($c, 0.99) 2px, $c));
-        background-image: $button_fill;
-      }
-
-      &:not(only-child):first-child:hover,
-      &:hover + button:not(:checked):not(:hover),
-      &:not(:hover) + button:not(:checked):hover {
-        border-left-color: $borders_color;
-      }
-
-      &:not(only-child):last-child:hover {
-        border-right-color: $borders_color;
-      }
-
-      &:hover:backdrop {
-        background-image: image($bg_color);
-      }
-    }
-
-    // View switcher button
     > stack > box {
       &.narrow {
         font-size: 0.75rem;


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