[gnome-tweak-tool] Move CSS to external file
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Move CSS to external file
- Date: Sun, 18 Aug 2013 19:48:34 +0000 (UTC)
commit 60d2c3b5079fde71c7c502832136e1ada6c67236
Author: John Stowers <john stowers gmail com>
Date: Sun Aug 4 13:22:27 2013 +0200
Move CSS to external file
* set a list row background color
* set a minimum width for the sidebar
data/shell.css | 6 ++++++
gtweak/tweakview.py | 17 ++++++++---------
2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/data/shell.css b/data/shell.css
new file mode 100644
index 0000000..8039233
--- /dev/null
+++ b/data/shell.css
@@ -0,0 +1,6 @@
+.list#tweak-categories {
+ background: #ebedeb;
+}
+.list-row#tweak-category {
+ padding: 10px;
+}
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index 30f8a84..134ef2e 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with gnome-tweak-tool. If not, see <http://www.gnu.org/licenses/>.
+import os.path
import logging
import datetime
@@ -89,10 +90,13 @@ class Window(Gtk.ApplicationWindow):
self.entry.connect("search-changed", self._on_search)
self.revealer.add(self.entry)
- self.listbox = Gtk.ListBox()
+ self.listbox = Gtk.ListBox(name="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)
scroll = Gtk.ScrolledWindow()
+ scroll.set_policy(Gtk.PolicyType.NEVER,
+ Gtk.PolicyType.AUTOMATIC)
scroll.add(self.listbox)
left_header.pack_start(self.button)
@@ -116,14 +120,9 @@ class Window(Gtk.ApplicationWindow):
return right_box
def load_css(self):
- css = """
- #row
- {
- padding: 10px;
- }
- """
css_provider = Gtk.CssProvider()
- css_provider.load_from_data(css)
+ css_provider.load_from_path(
+ os.path.join(gtweak.PKG_DATA_DIR, 'shell.css'))
screen = Gdk.Screen.get_default()
context = Gtk.StyleContext()
context.add_provider_for_screen(screen, css_provider,
@@ -134,7 +133,7 @@ class Window(Gtk.ApplicationWindow):
def _items_listbox(text):
lbl = Gtk.Label(text, xalign=0.0)
lbl.set_name('row')
- row = Gtk.ListBoxRow()
+ row = Gtk.ListBoxRow(name="tweak-category")
row.add(lbl)
return row
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]