[nautilus] toolbar: adjust animation colors



commit 610c991ca79ad53a77effb32e67eb79341160b2b
Author: Jakub Steiner <jimmac gmail com>
Date:   Wed Aug 26 13:12:41 2015 +0200

    toolbar: adjust animation colors
    
    Make the highlight more apparent
    
    - it seems we can't do animation-direction so I've made the
      highlight last longer by using two keyframes, since we cannot
      do the classic ping-pong animation and adjusting the ease-out
    
    - button gradient colors are still mostly hardcoded as no
      color ops available in css. :(
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753728

 src/Adwaita.css        |   12 +++++++-----
 src/nautilus-toolbar.c |   37 +++----------------------------------
 2 files changed, 10 insertions(+), 39 deletions(-)
---
diff --git a/src/Adwaita.css b/src/Adwaita.css
index c03d4e6..4abe735 100644
--- a/src/Adwaita.css
+++ b/src/Adwaita.css
@@ -45,15 +45,17 @@
 /* Here we use the .button background-image colors from Adwaita, but ligthen them,
  * since is not possible to use lighten () in common css. */
 @keyframes needs_attention_keyframes {
-    0% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%,  #e0e0e0)}
-    50% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%,  #f9f9f9)}
-    100% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%,  #e0e0e0)}
+    0% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%,  #e0e0e0); border-color: 
@borders; }
+    /* can't do animation-direction, so holding the color on two keyframes */
+    30% {background-image: linear-gradient(to bottom, @theme_base_color); border-color: @theme_fg_color; } 
+    90% {background-image: linear-gradient(to bottom, @theme_base_color); border-color: @theme_fg_color; }
+    100% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%,  #e0e0e0); border-color: 
@borders; }
 }
 .nautilus-operations-button-needs-attention {
-  animation: needs_attention_keyframes 1s ease-in;
+  animation: needs_attention_keyframes 2s ease-in-out;
 }
 .nautilus-operations-button-needs-attention-multiple {
-  animation: needs_attention_keyframes 1s ease-in;
+  animation: needs_attention_keyframes 3s ease-in-out;
   animation-iteration-count: 3;
 }
 
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 1874446..b3660d1 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -40,8 +40,7 @@
 #include <math.h>
 
 #define OPERATION_MINIMUM_TIME 2 //s
-#define NEEDS_ATTENTION_ANIMATION_TIMEOUT 1000 //ms
-#define NEEDS_ATTENTION_ANIMATION_MULTIPLE_TIMEOUT 3000 //ms
+#define NEEDS_ATTENTION_ANIMATION_TIMEOUT 2000 //ms
 #define REMOVE_FINISHED_OPERATIONS_TIEMOUT 3 //s
 
 typedef enum {
@@ -430,19 +429,6 @@ schedule_remove_finished_operations (NautilusToolbar *self)
 }
 
 static gboolean
-remove_operations_button_attention_style_multiple (NautilusToolbar *self)
-{
-        GtkStyleContext *style_context;
-
-        style_context = gtk_widget_get_style_context (self->priv->operations_button);
-        gtk_style_context_remove_class (style_context,
-                                        "nautilus-operations-button-needs-attention-multiple");
-        self->priv->operations_button_attention_timeout_id = 0;
-
-        return G_SOURCE_REMOVE;
-}
-
-static gboolean
 remove_operations_button_attention_style (NautilusToolbar *self)
 {
         GtkStyleContext *style_context;
@@ -463,7 +449,7 @@ add_operations_button_attention_style (NautilusToolbar *self)
         style_context = gtk_widget_get_style_context (self->priv->operations_button);
 
         remove_operations_button_attention_style (self);
-        remove_operations_button_attention_style_multiple (self);
+        remove_operations_button_attention_style (self);
 
         gtk_style_context_add_class (style_context,
                                      "nautilus-operations-button-needs-attention");
@@ -473,23 +459,6 @@ add_operations_button_attention_style (NautilusToolbar *self)
 }
 
 static void
-add_operations_button_attention_multiple_style (NautilusToolbar *self)
-{
-        GtkStyleContext *style_context;
-
-        style_context = gtk_widget_get_style_context (self->priv->operations_button);
-
-        remove_operations_button_attention_style (self);
-        remove_operations_button_attention_style_multiple (self);
-
-        gtk_style_context_add_class (style_context,
-                                     "nautilus-operations-button-needs-attention-multiple");
-        self->priv->operations_button_attention_timeout_id = g_timeout_add 
(NEEDS_ATTENTION_ANIMATION_MULTIPLE_TIMEOUT,
-                                                                            (GSourceFunc) 
remove_operations_button_attention_style_multiple,
-                                                                            self);
-}
-
-static void
 on_progress_info_cancelled (NautilusToolbar *self)
 {
         /* Update the pie chart progress */
@@ -593,7 +562,7 @@ update_operations (NautilusToolbar *self)
          */
         if (total_remaining_time > OPERATION_MINIMUM_TIME &&
             !gtk_revealer_get_reveal_child (GTK_REVEALER (self->priv->operations_revealer))) {
-                add_operations_button_attention_multiple_style (self);
+                add_operations_button_attention_style (self);
                 gtk_revealer_set_reveal_child (GTK_REVEALER (self->priv->operations_revealer),
                                                TRUE);
                 gtk_widget_queue_draw (self->priv->operations_icon);


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