[gnome-clocks] Stopwatch and timer buttons - use standard CSS styles



commit ced3c807d4aca88c5985ca81ef09a358604f46f7
Author: Allan Day <allanpday gmail com>
Date:   Tue Aug 20 12:19:12 2013 +0100

    Stopwatch and timer buttons - use standard CSS styles
    
    This is more efficient and makes theming easier.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706381

 data/css/button-border-go-active.svg   |  136 --------------------------------
 data/css/button-border-go.svg          |  134 -------------------------------
 data/css/button-border-stop-active.svg |  136 --------------------------------
 data/css/button-border-stop.svg        |  134 -------------------------------
 data/css/gnome-clocks.css              |   91 +---------------------
 data/gnome-clocks.gresource.xml        |    4 -
 data/ui/stopwatch.ui                   |    2 +-
 data/ui/timer.ui                       |    1 +
 src/stopwatch.vala                     |    8 +-
 src/timer.vala                         |    8 +-
 10 files changed, 11 insertions(+), 643 deletions(-)
---
diff --git a/data/css/gnome-clocks.css b/data/css/gnome-clocks.css
index 5f15209..f6df4fc 100644
--- a/data/css/gnome-clocks.css
+++ b/data/css/gnome-clocks.css
@@ -1,8 +1,3 @@
- define-color clocks_go_color_a #7fc141;
- define-color clocks_go_color_b #8fc95d;
- define-color clocks_stop_color_a #f44848;
- define-color clocks_stop_color_b #ff6565;
-
 .clocks-digital-renderer {
     background-color: transparent;
 }
@@ -124,90 +119,6 @@
     font-size: 48px;
 }
 
-.clocks-go {
-    background-image: linear-gradient(to bottom,
-                                      @clocks_go_color_a,
-                                      darker(@clocks_go_color_a) 70%
-                                      );
-    color: #ffffff;
-    border-image: url("button-border-go.svg") 3 3 4 3 / 3 3 4 3 stretch;
-    border-radius: 3px;
-    border-width: 1px 1px 2px 1px;
-    border-style: solid;
-    border-color: transparent;
-}
-
-.clocks-go:hover {
-    background-image: linear-gradient(to bottom,
-                                      @clocks_go_color_b,
-                                      darker(@clocks_go_color_b) 70%
-                                      );
-}
-
-.clocks-go:active {
-    background-image: linear-gradient(to bottom,
-                                      darker(@clocks_go_color_a),
-                                      @clocks_go_color_a
-                                      );
-    border-image: url("button-border-go-active.svg") 3 3 4 3 / 3 3 4 3 stretch;
-}
-
-.clocks-stop {
-    background-image: linear-gradient(to bottom,
-                                      @clocks_stop_color_a,
-                                      darker(@clocks_stop_color_a) 70%
-                                      );
-    color: #ffffff;
-    border-image: url("button-border-stop.svg") 3 3 4 3 / 3 3 4 3 stretch;
-    border-radius: 3px;
-    border-width: 1px 1px 2px 1px;
-    border-style: solid;
-    border-color: transparent;
-}
-
-.clocks-stop:hover {
-    background-image: linear-gradient(to bottom,
-                                      @clocks_stop_color_b,
-                                      darker(@clocks_stop_color_b) 70%
-                                      );
-}
-
-.clocks-stop:active {
-    background-image: linear-gradient(to bottom,
-                                      darker(@clocks_stop_color_a),
-                                      @clocks_stop_color_a
-                                      );
-    border-image: url("button-border-stop-active.svg") 3 3 4 3 / 3 3 4 3 stretch;
-}
-
-.linked .clocks-go:first-child,
-.linked .clocks-stop:first-child,
-.linked .clocks-go:active:first-child,
-.linked .clocks-stop:active:first-child,
-.linked .clocks-go:active:hover:first-child,
-.linked .clocks-stop:active:hover:first-child,
-.linked .clocks-go:insensitive:first-child,
-.linked .clocks-stop:insensitive:first-child {
-    border-right-width: 0;
-    border-image-width: 3px 0 4px 3px;
-    border-bottom-right-radius: 0;
-    border-top-right-radius: 0;
-}
-
-.linked .clocks-go:last-child,
-.linked .clocks-stop:last-child,
-.linked .clocks-go:active:last-child,
-.linked .clocks-stop:active:last-child,
-.linked .clocks-go:active:hover:last-child,
-.linked .clocks-stop:active:hover:last-child,
-.linked .clocks-go:insensitive:last-child,
-.linked .clocks-stop:insensitive:last-child {
-    border-left-width: 0;
-    border-image-width: 3px 3px 4px 0;
-    border-bottom-left-radius: 0;
-    border-top-left-radius: 0;
-}
-
 .clocks-selection-bar {
     border-width: 1px 0 0;
     border-style: solid;
@@ -246,7 +157,7 @@
 }
 
 .clocks-stopwatch-laps-row {
-    font-size: larger;
+    font-size: 14px;
     border-width: 0 0 1px 0;
     border-style: solid;
     border-color: #d3d7cf;
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index 231fc14..711a735 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -2,10 +2,6 @@
 <gresources>
   <gresource prefix="/org/gnome/clocks">
     <file>css/gnome-clocks.css</file>
-    <file preprocess="xml-stripblanks">css/button-border-go.svg</file>
-    <file preprocess="xml-stripblanks">css/button-border-go-active.svg</file>
-    <file preprocess="xml-stripblanks">css/button-border-stop.svg</file>
-    <file preprocess="xml-stripblanks">css/button-border-stop-active.svg</file>
     <file preprocess="xml-stripblanks">ui/menu.ui</file>
     <file preprocess="xml-stripblanks">ui/window.ui</file>
     <file preprocess="xml-stripblanks">ui/worldlocationdialog.ui</file>
diff --git a/data/ui/stopwatch.ui b/data/ui/stopwatch.ui
index a98ca84..934dca5 100644
--- a/data/ui/stopwatch.ui
+++ b/data/ui/stopwatch.ui
@@ -47,6 +47,7 @@
                     <property name="hexpand">True</property>
                     <property name="homogeneous">True</property>
                     <property name="spacing">16</property>
+                    <property name="height_request">40</property>
                     <child>
                       <object class="GtkButton" id="left_button">
                         <property name="label" translatable="yes">Start</property>
@@ -57,7 +58,6 @@
                         <signal name="clicked" handler="on_left_button_clicked" swapped="no"/>
                         <style>
                           <class name="clocks-button"/>
-                          <class name="clocks-go"/>
                         </style>
                       </object>
                       <packing>
diff --git a/data/ui/timer.ui b/data/ui/timer.ui
index cd2a564..16ae5bf 100644
--- a/data/ui/timer.ui
+++ b/data/ui/timer.ui
@@ -188,6 +188,7 @@
               <object class="GtkButton" id="start_button">
                 <property name="label" translatable="yes">Start</property>
                 <property name="width_request">280</property>
+                <property name="height_request">40</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
diff --git a/src/stopwatch.vala b/src/stopwatch.vala
index 28d620d..9ea3cfb 100644
--- a/src/stopwatch.vala
+++ b/src/stopwatch.vala
@@ -185,7 +185,7 @@ public class MainPanel : Gtk.Box, Clocks.Clock {
         state = State.RUNNING;
         add_tick ();
         left_button.set_label (_("Stop"));
-        left_button.get_style_context ().add_class ("clocks-stop");
+        left_button.get_style_context ().add_class ("destructive-action");
         right_button.set_sensitive (true);
         right_button.set_label (_("Lap"));
     }
@@ -195,8 +195,8 @@ public class MainPanel : Gtk.Box, Clocks.Clock {
         state = State.STOPPED;
         remove_tick ();
         left_button.set_label (_("Continue"));
-        left_button.get_style_context ().remove_class ("clocks-stop");
-        left_button.get_style_context ().add_class ("clocks-go");
+        left_button.get_style_context ().remove_class ("destructive-action");
+        left_button.get_style_context ().add_class ("suggested-action");
         right_button.set_sensitive (true);
         right_button.set_label (_("Reset"));
     }
@@ -207,7 +207,7 @@ public class MainPanel : Gtk.Box, Clocks.Clock {
         remove_tick ();
         update_time_label ();
         left_button.set_label (_("Start"));
-        left_button.get_style_context ().add_class ("clocks-go");
+        left_button.get_style_context ().add_class ("suggested-action");
         right_button.set_sensitive (false);
         current_lap = 0;
         last_lap_time = 0;
diff --git a/src/timer.vala b/src/timer.vala
index 78c037b..77d5186 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -136,10 +136,10 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
 
         if (h != 0 || m != 0 || s != 0) {
             start_button.set_sensitive (true);
-            start_button.get_style_context ().add_class ("clocks-go");
+            start_button.get_style_context ().add_class ("suggested-action");
         } else {
             start_button.set_sensitive (false);
-            start_button.get_style_context ().remove_class ("clocks-go");
+            start_button.get_style_context ().remove_class ("suggested-action");
         }
     }
 
@@ -154,12 +154,12 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
         case State.RUNNING:
             pause ();
             left_button.set_label (_("Continue"));
-            left_button.get_style_context ().add_class ("clocks-go");
+            left_button.get_style_context ().add_class ("suggested-action");
             break;
         case State.PAUSED:
             restart ();
             left_button.set_label (_("Pause"));
-            left_button.get_style_context ().remove_class("clocks-go");
+            left_button.get_style_context ().remove_class("suggested-action");
             break;
         default:
             assert_not_reached ();


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