[dconf-editor] Add setting to change rows height.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Add setting to change rows height.
- Date: Sat, 30 Apr 2016 12:43:54 +0000 (UTC)
commit ccf5fbc334f3762b79953601e35a0f79311bec9f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Apr 30 14:43:35 2016 +0200
Add setting to change rows height.
editor/ca.desrt.dconf-editor.gschema.xml | 9 +++++++
editor/dconf-editor.css | 37 +++++++++++++++++++++--------
editor/dconf-window.vala | 11 +++++++++
editor/folder-list-box-row.ui | 1 -
editor/key-list-box-row.ui | 1 -
5 files changed, 47 insertions(+), 12 deletions(-)
---
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index b933743..9cd4ff3 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain='dconf'>
+ <enum id="ca.desrt.dconf-editor.Themes">
+ <value value="0" nick="three-twenty-two"/>
+ <value value="1" nick="small-rows"/>
+ </enum>
<schema id="ca.desrt.dconf-editor.Settings" path="/ca/desrt/dconf-editor/">
<child schema="ca.desrt.dconf-editor.Demo" name="demo"/>
<key name="window-width" type="i">
@@ -42,6 +46,11 @@
<summary>Show initial warning</summary>
<description>If 'true', Dconf Editor opens a popup when launched reminding the user to be
careful.</description>
</key>
+ <key name="theme" enum="ca.desrt.dconf-editor.Themes">
+ <default>'three-twenty-two'</default>
+ <summary>The theme of the navigation list</summary>
+ <description>The themes are defined by the application, you cannot add one. Two themes are available
for now: 'three-twenty-two' that will remain as close as possible to the default theme of the 3.22 release,
and 'small-rows' that tries to minimize the rows height.</description>
+ </key>
</schema>
<enum id="ca.desrt.dconf-editor.DemoEnum">
<value value="0" nick="Red"/>
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index 24c1b94..f1fb8a8 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -16,24 +16,41 @@
*/
/*\
-* * folder rows
+* * rows height and icon
\*/
+/* row height */
+.dconf-list > row {
+ transition:min-height 0.3s;
+}
+ .dconf-list > row { min-height:2.6rem; }
+.small-rows .dconf-list > row { min-height:1.3rem; }
+
+/* folder icon */
.dconf-list > row > .folder > grid {
background-image:-gtk-icontheme("folder-symbolic");
- background-size:24px;
background-repeat:no-repeat;
-}
-.dconf-list:dir(ltr) > row > .folder > grid {
- padding-left:48px;
- background-position:12px center;
-}
-.dconf-list:dir(rtl) > row > .folder > grid {
- padding-right:48px;
- background-position:calc(100%-12px) center;
+ transition:background-position 0.3s,
+ background-size 0.3s,
+ padding-left 0.3s,
+ padding-right 0.3s; /* warning: ltr/rtl */
}
+/* visual padding: 0.75rem */
+.dconf-list:dir(ltr) > row > .folder > grid { background-position:0.75rem center; }
+.dconf-list:dir(rtl) > row > .folder > grid { background-position:calc(100% - 0.75rem) center; }
+
+/* icon sizing */
+ .dconf-list > row > .folder > grid { background-size:1.5rem; }
+.small-rows .dconf-list > row > .folder > grid { background-size:0.75rem; }
+
+/* technical padding: (2 * visual padding) + icon size */
+ .dconf-list:dir(ltr) > row > .folder > grid { padding-left: 3rem; }
+.small-rows .dconf-list:dir(ltr) > row > .folder > grid { padding-left: 2.25rem; }
+ .dconf-list:dir(rtl) > row > .folder > grid { padding-right: 3rem; }
+.small-rows .dconf-list:dir(rtl) > row > .folder > grid { padding-right: 2.25rem; }
+
/*\
* * pathbar
\*/
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 1d92d54..6edb928 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -62,6 +62,17 @@ class DConfWindow : ApplicationWindow
search_bar.connect_entry (search_entry);
+ settings.changed["theme"].connect (() => {
+ string theme = settings.get_string ("theme");
+ StyleContext context = get_style_context ();
+ if (theme == "three-twenty-two" && context.has_class ("small-rows"))
+ context.remove_class ("small-rows");
+ else if (theme == "small-rows" && !context.has_class ("small-rows"))
+ context.add_class ("small-rows");
+ });
+ if (settings.get_string ("theme") == "small-rows")
+ get_style_context ().add_class ("small-rows");
+
dir_tree_view.set_model (model);
current_path = settings.get_string ("saved-view");
diff --git a/editor/folder-list-box-row.ui b/editor/folder-list-box-row.ui
index 4a7aab5..2523340 100644
--- a/editor/folder-list-box-row.ui
+++ b/editor/folder-list-box-row.ui
@@ -10,7 +10,6 @@
<object class="GtkGrid">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
- <property name="height-request">42</property>
<!-- no margin_start: done via CSS -->
<property name="column-spacing">6</property>
<property name="margin-end">6</property><!-- same as column_spacing -->
diff --git a/editor/key-list-box-row.ui b/editor/key-list-box-row.ui
index e2bfa59..0b5ad1e 100644
--- a/editor/key-list-box-row.ui
+++ b/editor/key-list-box-row.ui
@@ -6,7 +6,6 @@
<object class="GtkGrid">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
- <property name="height-request">42</property>
<property name="margin-start">10</property><!-- looks cool -->
<property name="column-spacing">6</property>
<property name="margin-end">6</property><!-- same as column_spacing -->
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]