[gnome-tweak-tool] Use CSS classes instead of selectors for theming
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Use CSS classes instead of selectors for theming
- Date: Sun, 18 Aug 2013 19:49:34 +0000 (UTC)
commit 7eb7377ccc3576657694e92f794ea0e74ae911f0
Author: John Stowers <john stowers gmail com>
Date: Tue Aug 6 16:16:17 2013 +0200
Use CSS classes instead of selectors for theming
data/shell.css | 31 ++++++++++++++++++-------------
gtweak/tweakview.py | 14 ++++++++------
gtweak/widgets.py | 8 ++++----
3 files changed, 30 insertions(+), 23 deletions(-)
---
diff --git a/data/shell.css b/data/shell.css
index 5cacefb..32ac569 100644
--- a/data/shell.css
+++ b/data/shell.css
@@ -1,28 +1,33 @@
-.list#tweak-group {
- background-color: @theme_bg_color;
-}
-.list#tweak-categories {
+/* the sidebar */
+.list.tweak-categories {
background-color: #ebedeb;
}
-.list-row#tweak-category {
+.list-row.tweak-category {
padding: 10px;
}
-.list-row#tweak {
+
+/* the container and tweaks in a group */
+.list.tweak-group {
+ background-color: @theme_bg_color;
+}
+.list-row.tweak {
padding: 3px 3px 0px 0px;
background-color: @theme_bg_color;
}
-.list-row:hover#tweak {
+.list-row.tweak:hover {
background-color: @theme_bg_color;
}
-.list-row#tweak-title {
+.list-row.tweak.title {
padding: 10px 10px 0px 0px;
background-color: @theme_bg_color;
}
-.list-row:hover#tweak-title {
+.list-row.tweak.title:hover {
padding: 10px 10px 0px 0px;
background-color: @theme_bg_color;
}
-/* GtkStack {
- * margin: 20px;
- * }
- */
+
+
+.main-container {
+ padding: 20px;
+}
+
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index c786bbf..ff7975c 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -89,7 +89,8 @@ class Window(Gtk.ApplicationWindow):
self.entry.connect("search-changed", self._on_search)
self.revealer.add(self.entry)
- self.listbox = Gtk.ListBox(name="tweak-categories")
+ self.listbox = Gtk.ListBox()
+ self.listbox.get_style_context().add_class("tweak-categories")
self.listbox.set_size_request(200,-1)
self.listbox.connect("row-selected", self._on_select_row)
self.listbox.set_header_func(self._list_header_func, None)
@@ -109,10 +110,10 @@ class Window(Gtk.ApplicationWindow):
right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.right_header = Gtk.HeaderBar()
- #GRR why can I not put margin in the CSS?
- self.stack = Gtk.Stack(name="main-container",
- margin=20)
-
+ #GRR why can I not put margin in the CSS of a GtkStack
+ self.stack = Gtk.Stack()
+ self.stack.get_style_context().add_class("main-container")
+ self.stack.props.margin = 20
right_box.pack_start(self.right_header, False, False, 0)
right_box.pack_start(self.stack, True, True, 0)
@@ -132,7 +133,8 @@ class Window(Gtk.ApplicationWindow):
def _make_items_listbox(text):
lbl = Gtk.Label(text, xalign=0.0)
lbl.set_name('row')
- row = Gtk.ListBoxRow(name="tweak-category")
+ row = Gtk.ListBoxRow()
+ row.get_style_context().add_class("tweak-category")
row.add(lbl)
return row
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index 5f981f4..f60236d 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -214,18 +214,18 @@ class _DependableMixin(object):
class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
def __init__(self, name, *tweaks):
Gtk.ListBox.__init__(self,
- name="tweak-group",
selection_mode=Gtk.SelectionMode.NONE)
+ self.get_style_context().add_class("tweak-group")
TweakGroup.__init__(self, name, *tweaks)
self._sg = Gtk.SizeGroup(
mode=Gtk.SizeGroupMode.HORIZONTAL)
self._sg.props.ignore_hidden = True
for t in self.tweaks:
- cssname = "tweak"
+ row = Gtk.ListBoxRow()
+ row.get_style_context().add_class("tweak")
if isinstance(t, Title):
- cssname = "tweak-title"
- row = Gtk.ListBoxRow(name=cssname)
+ row.get_style_context().add_class("title")
row.add(t)
self.add(row)
if t.widget_for_size_group:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]