[gnome-themes-standard] notebook: use adwaita-border-gradient to render the active tab gradient



commit a08d1485cb7e1bee3156e78c8d4a8158deb2436d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 14 18:45:16 2011 -0400

    notebook: use adwaita-border-gradient to render the active tab gradient

 src/adwaita_engine.c           |   25 +++----------------------
 themes/Adwaita/gtk-3.0/gtk.css |    7 +++++--
 2 files changed, 8 insertions(+), 24 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 5d31910..ba6ff08 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -595,7 +595,7 @@ render_notebook_extension (GtkThemingEngine *engine,
 			   GtkPositionType   gap_side)
 {
 	gint tab_curvature;
-	GdkRGBA *color, *notebook_border_color, border_color, background_color;
+	GdkRGBA *color, border_color, background_color;
 	GtkStateFlags state;
 	gdouble angle = 0;
 	cairo_pattern_t *pattern = NULL, *background_pattern = NULL;
@@ -609,7 +609,7 @@ render_notebook_extension (GtkThemingEngine *engine,
 	gtk_theming_engine_get_border_color (engine, state, &border_color);
 	gtk_theming_engine_get (engine, state,
 				"-adwaita-selected-tab-color", &color,
-				"-adwaita-notebook-border-color", &notebook_border_color,
+				"-adwaita-border-gradient", &pattern,
 				"background-image", &background_pattern,
 				NULL);
 
@@ -659,20 +659,7 @@ render_notebook_extension (GtkThemingEngine *engine,
 	draw_tab_shape_active (cr, tab_curvature, 0, 0, width, height);
 
 	if (state & GTK_STATE_FLAG_ACTIVE) {
-		pattern = cairo_pattern_create_linear (0, height, 0, 0);
-		cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-		cairo_pattern_add_color_stop_rgba (pattern, 0.0,
-						   notebook_border_color->red,
-						   notebook_border_color->green,
-						   notebook_border_color->blue,
-						   notebook_border_color->alpha);
-
-		cairo_pattern_add_color_stop_rgba (pattern, 1.0,
-						   border_color.red,
-						   border_color.green,
-						   border_color.blue,
-						   border_color.alpha);
-
+		style_pattern_set_matrix (pattern, width, height - 6.0);
 		cairo_set_source (cr, pattern);
 	} else {
 		gdk_cairo_set_source_rgba (cr, &border_color);
@@ -681,7 +668,6 @@ render_notebook_extension (GtkThemingEngine *engine,
 	cairo_stroke (cr);
 
 	gdk_rgba_free (color);
-	gdk_rgba_free (notebook_border_color);
 
 	if (pattern != NULL) {
 		cairo_pattern_destroy (pattern);
@@ -1686,11 +1672,6 @@ adwaita_engine_class_init (AdwaitaEngineClass *klass)
 								  "Selected tab color",
 								  GDK_TYPE_RGBA, 0));
 	gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
-					      g_param_spec_boxed ("notebook-border-color",
-								  "Notebook border color",
-								  "Notebook border color",
-								  GDK_TYPE_RGBA, 0));
-	gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
 					      g_param_spec_boxed ("border-gradient",
 								  "Border gradient",
 								  "Border gradient",
diff --git a/themes/Adwaita/gtk-3.0/gtk.css b/themes/Adwaita/gtk-3.0/gtk.css
index 095eb83..516b8d8 100644
--- a/themes/Adwaita/gtk-3.0/gtk.css
+++ b/themes/Adwaita/gtk-3.0/gtk.css
@@ -369,11 +369,14 @@ GtkCalendar {
 }
 
 .notebook tab:active {
-    border-color: @notebook_active_tab_border;
     border-width: 1;
 
+    -adwaita-border-gradient: -gtk-gradient (linear,
+                                             left top, left bottom,
+                                             from (@notebook_active_tab_border),
+                                             to (@notebook_border));
+
     -adwaita-selected-tab-color: #8dc0f3;
-    -adwaita-notebook-border-color: @notebook_border;
     background-color: @theme_base_color;
     background-image: none;
 }



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