[sushi] all: use the OSD style class from GTK for the toolbar



commit 36c2759ee41c1eef7d5241b38cc9c921be74b119
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 19 20:36:02 2012 -0400

    all: use the OSD style class from GTK for the toolbar
    
    Instead of hardcoding a different style.

 data/style/gtk-style.css |   37 -------------------------------------
 src/js/ui/mainWindow.js  |    3 +++
 src/js/ui/utils.js       |    7 +++++++
 src/js/viewers/audio.js  |    2 +-
 src/js/viewers/evince.js |    7 +++----
 src/js/viewers/gst.js    |    2 +-
 src/js/viewers/html.js   |    2 +-
 src/js/viewers/image.js  |    2 +-
 src/js/viewers/text.js   |    2 +-
 9 files changed, 18 insertions(+), 46 deletions(-)
---
diff --git a/data/style/gtk-style.css b/data/style/gtk-style.css
index 3eb01f3..ef09ad1 100644
--- a/data/style/gtk-style.css
+++ b/data/style/gtk-style.css
@@ -38,43 +38,6 @@ GtkSourceView {
     background-color: shade (@np_bg_color, 1.70);
 }
 
-.np-toolbar {
-    border-style: none;
-    border-radius: 3px;
-    border-width: 0;
-
-    background-color: @np_bg_color;
-}
-
-.np-toolbar GtkSeparatorToolItem {
-    -GtkWidget-wide-separators: 1;
-    -GtkWidget-separator-width: 1;
-
-    border-width: 1px;
-    border-style: solid;
-}
-
-.np-toolbar .button {
-    border-image: none;
-    background-image: -gtk-gradient(linear,
-                                    left top, left bottom,
-                                    from(#333),
-                                    color-stop(0.50, shade (#333, 1.40)),
-                                    to (#333));
-}
-
-.np-toolbar .button:hover {
-    background-image: -gtk-gradient(linear,
-                                    left top, left bottom,
-                                    from(shade(#333, 1.20)),
-                                    color-stop(0.50, shade (#333, 1.60)),
-                                    to (shade(#333, 1.20)));
-}
-
-.np-toolbar GtkLabel {
-    font: Cantarell 8;
-}
-
 .np-decoration {
     font: bold;
 }
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index c406098..ff9945b 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -44,6 +44,7 @@ const Mainloop = imports.mainloop;
 const MimeHandler = imports.ui.mimeHandler;
 const Constants = imports.util.constants;
 const SpinnerBox = imports.ui.spinnerBox;
+const Utils = imports.ui.utils;
 
 const Sushi = imports.gi.Sushi;
 
@@ -514,6 +515,8 @@ MainWindow.prototype = {
         if (!this._toolbarActor)
             return;
 
+        Utils.alphaGtkWidget(this._toolbarActor.get_widget());
+
         this._toolbarActor.set_reactive(true);
         this._toolbarActor.set_opacity(0);
         this._mainGroup.add_actor(this._toolbarActor);
diff --git a/src/js/ui/utils.js b/src/js/ui/utils.js
index 10a9a9e..de14d77 100644
--- a/src/js/ui/utils.js
+++ b/src/js/ui/utils.js
@@ -139,3 +139,10 @@ function formatTimeString(timeVal) {
 
     return str;
 }
+
+function alphaGtkWidget(widget) {
+    widget.override_background_color(0, new Gdk.RGBA({ red: 0,
+                                                       green: 0,
+                                                       blue: 0,
+                                                       alpha: 0 }));
+}
diff --git a/src/js/viewers/audio.js b/src/js/viewers/audio.js
index 2b304ef..c73a0f0 100644
--- a/src/js/viewers/audio.js
+++ b/src/js/viewers/audio.js
@@ -255,7 +255,7 @@ AudioRenderer.prototype = {
 
     createToolbar : function () {
         this._mainToolbar = new Gtk.Toolbar();
-        this._mainToolbar.get_style_context().add_class('np-toolbar');
+        this._mainToolbar.get_style_context().add_class('osd');
         this._mainToolbar.set_icon_size(Gtk.IconSize.MENU);
         this._mainToolbar.show();
 
diff --git a/src/js/viewers/evince.js b/src/js/viewers/evince.js
index a415b61..3257028 100644
--- a/src/js/viewers/evince.js
+++ b/src/js/viewers/evince.js
@@ -114,9 +114,8 @@ EvinceRenderer.prototype = {
     },
 
     _createLabelItem : function() {
-        this._pageLabel = new Gtk.Label();
-        this._pageLabel.set_margin_left(2);
-        this._pageLabel.set_margin_right(2);
+        this._pageLabel = new Gtk.Label({ margin_left: 10,
+                                          margin_right: 10 });
 
         let item = new Gtk.ToolItem();
         item.set_expand(true);
@@ -128,7 +127,7 @@ EvinceRenderer.prototype = {
 
     createToolbar : function() {
         this._mainToolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
-        this._mainToolbar.get_style_context().add_class('np-toolbar');
+        this._mainToolbar.get_style_context().add_class('osd');
         this._mainToolbar.set_show_arrow(false);
         this._mainToolbar.show();
 
diff --git a/src/js/viewers/gst.js b/src/js/viewers/gst.js
index 77a73f9..97e8043 100644
--- a/src/js/viewers/gst.js
+++ b/src/js/viewers/gst.js
@@ -143,7 +143,7 @@ GstRenderer.prototype = {
 
     createToolbar : function () {
         this._mainToolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
-        this._mainToolbar.get_style_context().add_class('np-toolbar');
+        this._mainToolbar.get_style_context().add_class('osd');
         this._mainToolbar.show();
 
         this._toolbarActor = new GtkClutter.Actor({ contents: this._mainToolbar,
diff --git a/src/js/viewers/html.js b/src/js/viewers/html.js
index 29fa92b..e4bad41 100644
--- a/src/js/viewers/html.js
+++ b/src/js/viewers/html.js
@@ -77,7 +77,7 @@ HTMLRenderer.prototype = {
 
     createToolbar : function() {
         this._mainToolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
-        this._mainToolbar.get_style_context().add_class('np-toolbar');
+        this._mainToolbar.get_style_context().add_class('osd');
         this._mainToolbar.set_show_arrow(false);
         this._mainToolbar.show();
 
diff --git a/src/js/viewers/image.js b/src/js/viewers/image.js
index b1f4a16..0853d85 100644
--- a/src/js/viewers/image.js
+++ b/src/js/viewers/image.js
@@ -101,7 +101,7 @@ ImageRenderer.prototype = {
 
     createToolbar : function() {
         this._mainToolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
-        this._mainToolbar.get_style_context().add_class('np-toolbar');
+        this._mainToolbar.get_style_context().add_class('osd');
         this._mainToolbar.set_show_arrow(false);
         this._mainToolbar.show();
 
diff --git a/src/js/viewers/text.js b/src/js/viewers/text.js
index ea0cc0a..d84d529 100644
--- a/src/js/viewers/text.js
+++ b/src/js/viewers/text.js
@@ -111,7 +111,7 @@ TextRenderer.prototype = {
 
     createToolbar : function() {
         this._mainToolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
-        this._mainToolbar.get_style_context().add_class('np-toolbar');
+        this._mainToolbar.get_style_context().add_class('osd');
         this._mainToolbar.set_show_arrow(false);
 
         this._toolbarRun = Utils.createOpenButton(this._file, this._mainWindow);



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