[gevice] testing Gtk.CssProvider()



commit 1f0113b84d5bf499928baf0cd71f5353dd6ace8c
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date:   Fri Oct 7 14:19:45 2011 -0300

    testing Gtk.CssProvider()

 ChangeLog          |    4 ++
 data/ui/gevice.css |  102 ----------------------------------------------------
 src/gevice.py      |   13 ++++---
 3 files changed, 12 insertions(+), 107 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a811dcf..1fc65d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-07  Alejandro Valdes Jimenez  <avaldes gnome org>
+	* data/ui/gevice.css:
+	* src/gevice.py: testing Gtk.CssProvider()
+
 2011-10-06  Alejandro Valdes Jimenez  <avaldes gnome org>
 	* data/ui/gevice.css: add new file
 
diff --git a/data/ui/gevice.css b/data/ui/gevice.css
index b2a253a..807df9f 100644
--- a/data/ui/gevice.css
+++ b/data/ui/gevice.css
@@ -1,17 +1,4 @@
-/* Apply round borders */
-
-.notebook,
-.button,
-.entry {
-  border-radius: 1;
-  border-style: solid;
-  border-width: 1;
-}
-
-
 /* Add some gradients */
-
-.menubar,
 .toolbar {
   border-width: 0;
   background-image: -gtk-gradient (linear,
@@ -19,92 +6,3 @@
                                    from (@bg_color),
                                    to (shade (@bg_color, 0.95)));
 }
-
-.button:hover,
-.menu:hover,
-.menubar:hover {
-  background-image: -gtk-gradient (linear,
-                                   left top, left bottom,
-                                   from (shade (@selected_bg_color, 1.1)),
-                                   color-stop (0.55, shade (@selected_bg_color, 1.0)),
-                                   color-stop (0.55, shade (@selected_bg_color, 0.8)),
-                                   to (shade (@selected_bg_color, 0.9)));
-}
-
-/* Theme scrollbars */
-
-/* Gradient for vertical scrollbars'
- * sliders, from left to right
- */
-.slider.vertical {
-  background-image: -gtk-gradient (linear,
-                                   left top, right top,
-                                   from (mix (shade (@bg_color, 0.9), @selected_bg_color, 0.3)),
-                                   to (mix (@bg_color, @selected_bg_color, 0.3)));
-}
-
-.slider.vertical:hover {
-  background-image: -gtk-gradient (linear,
-                                   left top, right top,
-                                   from (shade (@selected_bg_color, 0.9)),
-                                   to (@selected_bg_color));
-}
-
-/* Now horizontal scrollbars',
- * from top to bottom
- */
-.slider.horizontal {
-  background-image: -gtk-gradient (linear,
-                                   left top, left bottom,
-                                   from (shade (@bg_color, 0.9)),
-                                   to (@bg_color));
-}
-
-.slider.horizontal:hover {
-  background-image: -gtk-gradient (linear,
-                                   left top, left bottom,
-                                   from (shade (@selected_bg_color, 0.9)),
-                                   to (@selected_bg_color));
-}
-
-.trough {
-  background-image: -gtk-gradient (radial,
-                                   center center, 0,
-                                   center center, 1,
-                                   from (@bg_color),
-                                   to (shade (@bg_color, 0.8)));
-}
-
-GtkScrollbar.button {
-  border-width: 0;
-
-  /* Override any background with
-   * a full transparent color
-   */
-  background-image: none;
-  background-color: rgba (0, 0, 0, 0);
-}
-
-
-/* Theme treeview rows */
-
-GtkTreeView row {
-  border-width: 0;
-  border-radius: 0;
-}
-
-GtkTreeView row:selected:focused {
-  background-image: -gtk-gradient (linear,
-                                   left top, left bottom,
-                                   from (@selected_bg_color),
-                                   to (shade (@selected_bg_color, 1.4)));
-}
-
-/* Add some animations */
-GtkButton:hover {
-  transition: 100ms linear;
-}
-
-GtkCheckButton:active {
-  transition: 250ms ease-in-out;
-}
diff --git a/src/gevice.py b/src/gevice.py
index 4c5b150..c8edb48 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU General Public License along
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from gi.repository import Gtk, GdkPixbuf, Vte, GLib, Gio
+from gi.repository import Gtk, GdkPixbuf, Vte, GLib, Gio, Gdk
 
 import os
 import os.path
@@ -56,10 +56,6 @@ class Gevice:
     self.modelproto.append (["rdp"])
     self.modelproto.append (["xdmcp"])    
     
-    # style
-    self.default_style = Gtk.CssProvider()
-    self.default_style.load_from_file(Gio.file_new_for_path(os.path.join(config.UIDIR,"gevice.css")))
-    
     # model for devices
     self.gmodel = gevicemodel.GeviceModel(self)
     
@@ -78,6 +74,13 @@ class Gevice:
     self.window_main.set_icon (GdkPixbuf.Pixbuf.new_from_file(os.path.join (config.ARTDIR,"gevice.png")))
     self.window_main.set_title(config.PACKAGE)
     self.window_main.connect ("delete_event",self.on_delete_event)
+
+    # style
+    self.default_style = Gtk.CssProvider()
+    self.default_style.load_from_file(Gio.file_new_for_path(os.path.join(config.UIDIR,"gevice.css")))
+    Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), 
+      self.default_style, 
+      Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + 1)
     
     self.context_id = self.statusbar.get_context_id("status")
     



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