[gnome-themes-standard] toolbars: fix toolbar theming to match the mockups
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-themes-standard] toolbars: fix toolbar theming to match the mockups
- Date: Mon, 28 Feb 2011 14:53:03 +0000 (UTC)
commit 5e852eb2217a6e48bf9d076138c304a4afb110ca
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Feb 28 00:28:40 2011 -0500
toolbars: fix toolbar theming to match the mockups
src/adwaita_engine.c | 55 ++++++++++++++++++++++++
themes/Adwaita/gtk-3.0/gtk.css | 89 ++++++++++++++++++++++------------------
2 files changed, 104 insertions(+), 40 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 847a85a..f0ca248 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -233,6 +233,60 @@ adwaita_engine_render_check (GtkThemingEngine *engine,
}
static void
+adwaita_engine_render_line (GtkThemingEngine *engine,
+ cairo_t *cr,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GdkRGBA bg_color;
+ gdouble angle;
+ const GtkWidgetPath *path;
+ GtkStateFlags flags;
+ gint len;
+
+ path = gtk_theming_engine_get_path (engine);
+ flags = gtk_theming_engine_get_state (engine);
+
+ if (!(gtk_widget_path_is_type (path, GTK_TYPE_SEPARATOR_TOOL_ITEM) &&
+ gtk_widget_path_has_parent (path, GTK_TYPE_TOOLBAR)))
+ {
+ GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_line (engine,
+ cr,
+ x0, y0,
+ x1, y1);
+ return;
+ }
+
+ gtk_theming_engine_get_background_color (engine, flags, &bg_color);
+
+ cairo_save (cr);
+
+ angle = atan2 (x1 - x0, y1 - y0);
+ angle = (2 * G_PI) - angle;
+ angle += G_PI / 2;
+
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ cairo_set_line_width (cr, 1.0);
+
+ cairo_translate (cr, x0, y0);
+ cairo_rotate (cr, angle);
+
+ x1 -= x0;
+ y1 -= y0;
+
+ len = (gint) sqrt ((x1 * x1) + (y1 * y1));
+
+ gdk_cairo_set_source_rgba (cr, &bg_color);
+ cairo_move_to (cr, 0, -0.5);
+ cairo_line_to (cr, len, -0.5);
+ cairo_stroke (cr);
+
+ cairo_restore (cr);
+}
+
+static void
adwaita_engine_render_option (GtkThemingEngine *engine,
cairo_t *cr,
gdouble x,
@@ -762,6 +816,7 @@ adwaita_engine_class_init (AdwaitaEngineClass *klass)
engine_class->render_arrow = adwaita_engine_render_arrow;
engine_class->render_focus = adwaita_engine_render_focus;
engine_class->render_check = adwaita_engine_render_check;
+ engine_class->render_line = adwaita_engine_render_line;
engine_class->render_option = adwaita_engine_render_option;
engine_class->render_extension = adwaita_engine_render_extension;
engine_class->render_frame = adwaita_engine_render_frame;
diff --git a/themes/Adwaita/gtk-3.0/gtk.css b/themes/Adwaita/gtk-3.0/gtk.css
index 9ea5853..cb4c2f5 100644
--- a/themes/Adwaita/gtk-3.0/gtk.css
+++ b/themes/Adwaita/gtk-3.0/gtk.css
@@ -60,6 +60,11 @@
@define-color notebook_border #918e8a;
+ define-color toolbar_gradient_base #aaaa9e;
+ define-color toolbar_gradient_step1 #bcbcb4;
+ define-color toolbar_gradient_step2 #d9d9d7;
+ define-color toolbar_gradient_final #e5e5e2;
+
* {
engine: adwaita;
padding: 1;
@@ -474,22 +479,23 @@ column-header {
}
/* Top of window toolbars */
-GtkWindow > GtkTable > .toolbar, /* nautilus */
+NautilusToolbar > .toolbar,
GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > .toolbar, /* eog etc */
GtkWindow > GtkVBox > GtkVBox > EggEditableToolbar > GtkHBox > .toolbar, /* epiphany */
GtkWindow > GtkVBox > .toolbar {
background-image: -gtk-gradient (linear,
left top,
left bottom,
- from (shade (@theme_bg_color, 0.6)),
- color-stop (0.02, shade (@theme_bg_color, 0.6)),
- color-stop (0.03, shade (@theme_bg_color, 0.7)),
- color-stop (0.2, shade (@theme_bg_color, 0.75)),
- color-stop (0.8, shade (@theme_bg_color, 0.8)),
- color-stop (0.96, shade (@theme_bg_color, 0.95)),
- color-stop (0.97, shade (@theme_bg_color, 0.8)),
- color-stop (0.98, shade (@theme_bg_color, 1.2)),
- to (shade (@theme_bg_color, 1.2)));
+ from (@toolbar_gradient_base),
+ color-stop (0.01, shade (@theme_bg_color, 0.56)),
+ color-stop (0.02, @toolbar_gradient_base),
+ color-stop (0.16, @toolbar_gradient_step1),
+ color-stop (0.90, @toolbar_gradient_step2),
+ color-stop (0.96, @toolbar_gradient_final),
+ color-stop (0.97, shade (@theme_bg_color, 0.83)),
+ color-stop (0.98, @theme_base_color),
+ to (@theme_base_color));
+
border-radius: 0;
border-style: none;
padding: 4;
@@ -497,58 +503,61 @@ GtkWindow > GtkVBox > .toolbar {
-GtkWidget-window-dragging: true;
}
+NautilusToolbar > GtkToolbar .button,
GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > GtkToolbar .button,
GtkWindow > GtkVBox > GtkToolbar .button {
border-style: none;
border-width: 0;
-
- background-image: -gtk-gradient (linear,
- left top, left bottom,
- from (alpha (shade (@theme_bg_color, 0.75), 0.0)),
- color-stop (0.3, alpha (shade (@theme_bg_color, 0.9), 0.0)),
- color-stop (0.6, alpha (shade (@theme_bg_color, 0.9), 0.0)),
- to (alpha (shade (@theme_bg_color, 0.85), 0.0)));
+ background-image: none;
+ background-color: alpha (@theme_base_color, 0.0);
-GtkWidget-focus-line-width: 0;
}
-/* GtkToolbar .button:focused {
- background-color: red;
-} this pseudo-class doesn't work */
-
+NautilusToolbar > GtkToolbar .button:hover,
GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > GtkToolbar .button:hover,
-GtkWindow > GtkVBox > GtkToolbar .button:hover { /* needs correct colors */
+GtkWindow > GtkVBox > GtkToolbar .button:hover {
+ border-style: none;
+ border-width: 0;
background-image: -gtk-gradient (linear,
left top, left bottom,
- from (shade (@theme_bg_color, 0.75)),
- color-stop (0.3, shade (@theme_bg_color, 0.9)),
- color-stop (0.6, shade (@theme_bg_color, 0.9)),
- to (shade (@theme_bg_color, 0.85)));
+ from (alpha (@theme_base_color, 0.0)),
+ color-stop (0.54, alpha (shade (@theme_base_color, 0.92), 0.49)),
+ to (alpha (@theme_base_color, 0.0)));
}
.toolbar *:insensitive {
color: alpha (@theme_fg_color, 0.6);
}
-GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > GtkToolbar .button:active, GtkToolbar .button:active:prelight,
-GtkWindow > GtkVBox > GtkToolbar .button:active, GtkToolbar .button:active:prelight { /* needs correct colors */
+NautilusToolbar > GtkToolbar .button:active,
+GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > GtkToolbar .button:active,
+GtkWindow > GtkVBox > GtkToolbar .button:active {
border-style: none;
border-width: 0;
background-image: -gtk-gradient (linear,
left top, left bottom,
- from (shade (@theme_bg_color, 0.75)),
- color-stop (0.3, shade (@theme_bg_color, 0.9)),
- color-stop (0.6, shade (@theme_bg_color, 0.9)),
- to (shade (@theme_bg_color, 0.85)));
+ from (alpha (@theme_base_color, 0.0)),
+ color-stop (0.54, alpha (shade (@theme_base_color, 0.92), 0.85)),
+ to (alpha (@theme_base_color, 0.0)));
}
-GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > .toolbar.separator,
-GtkWindow > GtkVBox > .toolbar.separator {
- padding: 1 0;
- background-color: shade (@theme_bg_color, 0.8);
- -GtkVSeparator-vertical-padding: 0;
- -GtkWidget-wide-separators: 1;
- -GtkWidget-separator-width: 7;
- -GtkWidget-separator-height: 1;
+NautilusToolbar > GtkToolbar .button:active:prelight,
+GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > GtkToolbar .button:active:prelight,
+GtkWindow > GtkVBox > GtkToolbar .button:active:prelight {
+ border-style: none;
+ border-width: 0;
+ background-image: -gtk-gradient (linear,
+ left top, left bottom,
+ from (alpha (shade (@toolbar_gradient_base, 0.76), 0.7)),
+ to (alpha (shade (@toolbar_gradient_base, 1.14), 0.0)));
+}
+
+GtkWindow > GtkVBox > EggEditableToolbar > GtkHBox > GtkToolbar > GtkSeparatorToolItem,
+GtkWindow > GtkVBox > GtkToolbar > GtkSeparatorToolItem {
+ background-color: shade (@theme_bg_color, 0.56);
+ background-image: none;
+ -GtkWidget-wide-separators: 0;
+ padding: 0;
}
GtkSeparator {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]