[dconf-editor] Fix PathBar theming for external themes.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Fix PathBar theming for external themes.
- Date: Sat, 24 Sep 2016 13:27:24 +0000 (UTC)
commit 50c9c60094ecb23dc9016498cfdf94df033b2085
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Sep 24 15:24:28 2016 +0200
Fix PathBar theming for external themes.
https://bugzilla.gnome.org/show_bug.cgi?id=771831
editor/dconf-editor.css | 15 ++-------------
editor/pathbar.vala | 23 +++++++++++++++++------
2 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index 3df173f..0d626f5 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -180,22 +180,11 @@ window > popover.menu {
border-bottom-color:#8b8e8f; /* color mostly used for backdrop things */
}
-.pathbar > button:disabled > .item,
-.pathbar > button:disabled:hover > .item {
+.pathbar > button.active > .item,
+.pathbar > button.active:hover > .item {
border-bottom-color: @theme_selected_bg_color;
}
-/* ensure label color */
-.pathbar > button > .item,
-.pathbar > button:disabled > .item {
- color:@theme_fg_color;
-}
-
-.pathbar:backdrop > button > .item,
-.pathbar:backdrop > button:disabled > .item {
- color:@theme_unfocused_fg_color;
-}
-
/*\
* * properties list
\*/
diff --git a/editor/pathbar.vala b/editor/pathbar.vala
index c937f84..939bca4 100644
--- a/editor/pathbar.vala
+++ b/editor/pathbar.vala
@@ -37,7 +37,7 @@ public class PathBar : Box, PathElement
public void set_path (string path)
requires (path [0] == '/')
{
- root_button.set_sensitive (path != "/");
+ activate_item (root_button, path == "/");
complete_path = "";
string [] split = path.split ("/", /* max tokens disabled */ 0);
@@ -59,7 +59,7 @@ public class PathBar : Box, PathElement
if (maintain_all)
{
complete_path += ((PathBarItem) child).text_string;
- child.set_sensitive (true);
+ activate_item (child, false);
return;
}
@@ -69,11 +69,11 @@ public class PathBar : Box, PathElement
split = split [1:split.length];
if (split.length == 0 || (split.length == 1 && !is_key_path))
{
- child.set_sensitive (false);
+ activate_item (child, true);
maintain_all = true;
}
else
- child.set_sensitive (true);
+ activate_item (child, false);
return;
}
@@ -131,7 +131,7 @@ public class PathBar : Box, PathElement
}
/*\
- * * widgets creation
+ * * widgets management
\*/
private void add_slash_label ()
@@ -144,10 +144,21 @@ public class PathBar : Box, PathElement
PathBarItem path_bar_item = new PathBarItem (label);
path_bar_item.path_bar_item_clicked_handler = path_bar_item.clicked.connect (() => request_path
(complete_path));
- path_bar_item.set_sensitive (!block);
+ activate_item (path_bar_item, block);
add (path_bar_item);
}
+
+ private void activate_item (Widget item, bool state)
+ {
+ StyleContext context = item.get_style_context ();
+ if (state == context.has_class ("active"))
+ return;
+ if (state)
+ context.add_class ("active");
+ else
+ context.remove_class ("active");
+ }
}
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/pathbar-item.ui")]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]