[gnome-themes-standard: 18/26] progressbars: theme progress bars according to mockups



commit fe18e6cce50f665f3a54c4807ea3ecc9689a9634
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Mar 3 22:23:08 2011 -0500

    progressbars: theme progress bars according to mockups

 src/adwaita_engine.c           |   50 ++++++++++++++++++++++++++++++++++++-
 themes/Adwaita/gtk-3.0/gtk.css |   52 +++++++++++++++++++++++++--------------
 2 files changed, 81 insertions(+), 21 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 94b2674..2541711 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -855,6 +855,29 @@ adwaita_engine_render_frame (GtkThemingEngine *engine,
 			}
 		}
 
+		if (gtk_widget_path_is_type (path, GTK_TYPE_PROGRESS_BAR) &&
+		    gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH)) {
+			GtkBorder *border_width;
+			gint border_line;
+
+			/* draw the border inside the trough itself, so it will
+			 * be overdrawn by the fill.
+			 */
+			gtk_theming_engine_get (engine, state,
+						"border-width", &border_width,
+						NULL);
+
+			border_line = MIN (MIN (border_width->top, border_width->bottom),
+					   MIN (border_width->left, border_width->right));
+
+			y += border_line;
+			x += border_line;
+			width -= 2 * border_line;
+			height -= 2 * border_line;
+
+			gtk_border_free (border_width);
+		}
+
 		GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_frame (engine, cr, x, y,
 										      width, height);
 	}
@@ -941,6 +964,29 @@ adwaita_engine_render_background (GtkThemingEngine *engine,
 		}
 	}
 
+	if (gtk_widget_path_is_type (path, GTK_TYPE_PROGRESS_BAR) &&
+	    gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH)) {
+		GtkBorder *border_width;
+		gint border_line;
+
+		/* draw the border inside the trough itself, so it will
+		 * be overdrawn by the fill.
+		 */
+		gtk_theming_engine_get (engine, state,
+					"border-width", &border_width,
+					NULL);
+
+		border_line = MIN (MIN (border_width->top, border_width->bottom),
+				   MIN (border_width->left, border_width->right));
+
+		y += border_line;
+		x += border_line;
+		width -= 2 * border_line;
+		height -= 2 * border_line;
+
+		gtk_border_free (border_width);
+	}
+
 	GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_background (engine, cr, x, y,
 										   width, height);
 }
@@ -1033,9 +1079,9 @@ adwaita_engine_render_activity (GtkThemingEngine *engine,
 
 		pattern = cairo_pattern_create_linear (0, 0, 20, 20);
 		cairo_pattern_add_color_stop_rgba (pattern, 0, 0, 0, 0, 0);
-		cairo_pattern_add_color_stop_rgba (pattern, 0.5, 0, 0, 0, 0);
+		cairo_pattern_add_color_stop_rgba (pattern, 0.49, 0, 0, 0, 0);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.5, 0, 0, 0, 0.1);
-		cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0, 0.1);
+		cairo_pattern_add_color_stop_rgba (pattern, 0.99, 0, 0, 0, 0.1);
 
 		cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
 		cairo_rectangle (cr, x, y, width, height);
diff --git a/themes/Adwaita/gtk-3.0/gtk.css b/themes/Adwaita/gtk-3.0/gtk.css
index 9e277ac..724ee90 100644
--- a/themes/Adwaita/gtk-3.0/gtk.css
+++ b/themes/Adwaita/gtk-3.0/gtk.css
@@ -63,6 +63,10 @@
 @define-color selected_row_bg_color_a #1f72c6;
 @define-color selected_row_bg_color_b shade (@theme_selected_bg_color, 1.22);
 
+ define-color progressbar_background_a @selected_row_bg_color_a;
+ define-color progressbar_background_b #76b0ec;
+ define-color progressbar_border #3277bf;
+
 @define-color menu_fg_color #2e87e3;
 @define-color menu_controls_color #555753;
 
@@ -197,6 +201,9 @@
     border-color: shade (@inactive_frame_color, 0.945);
 }
 
+/*****************
+ * GtkSpinButton *
+ *****************/
 GtkSpinButton.button,
 GtkSpinButton.button:insensitive,
 GtkSpinButton.button:prelight,
@@ -208,6 +215,32 @@ GtkSpinButton.button:active {
     padding: 0;
 }
 
+/****************
+ * Progress bar *
+ ****************/
+GtkProgressBar.progressbar {
+    background-image: -gtk-gradient (linear,
+                                     left top, left bottom,
+                                     from (@progressbar_background_a),
+                                     to (@progressbar_background_b));
+
+    border-radius: 3;
+    border-style: solid;
+    border-color: @progressbar_border;
+}
+
+GtkProgressBar.trough {
+    background-image: -gtk-gradient (linear,
+                                     left top, left bottom,
+                                     from (@trough_bg_color_a),
+                                     to (@trough_bg_color_b));
+
+    border-width: 1;
+    border-style: solid;
+    border-radius: 3;
+    border-color: shade (@inactive_frame_color, 0.925);
+}
+
 GtkFrame,
 GtkCalendar,
 GtkScale {
@@ -540,25 +573,6 @@ GtkStatusbar {
     -GtkStatusbar-shadow-type: none;
 }
 
-.trough {
-    border-width: 1;
-    border-style: solid;
-    border-color: shade (@inactive_frame_color, 0.925);
-    background-image: -gtk-gradient (linear,
-                                     left top, left bottom,
-                                     from (@trough_bg_color_a),
-                                     to (@trough_bg_color_b));
-}
-
-.progressbar {
-    padding: 0;
-    border-radius: 3;
-    background-color: @theme_selected_bg_color;
-    border-style: solid;
-    border-color: darker (@theme_selected_bg_color);
-    color: @theme_selected_fg_color;
-}
-
 column-header {
     padding: 1 2;
 }



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