[libdazzle] prefs: add some default CSS styling for preferences



commit f17ae751292560977000ac62a0e7bbcbc78585b8
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 6 03:07:00 2017 -0700

    prefs: add some default CSS styling for preferences

 data/themes/shared.css                    |    1 +
 data/themes/shared/shared-preferences.css |   42 +++++++++++++++++++++++++++++
 src/dazzle.gresources.xml                 |    1 +
 src/prefs/dzl-preferences-group.c         |    2 +-
 tests/test-preferences.c                  |   13 +++++++++
 5 files changed, 58 insertions(+), 1 deletions(-)
---
diff --git a/data/themes/shared.css b/data/themes/shared.css
index ce191c3..5c7ca44 100644
--- a/data/themes/shared.css
+++ b/data/themes/shared.css
@@ -1,5 +1,6 @@
 /* Theme agnostic or base-layer CSS styling */
 @import url("resource:///org/gnome/dazzle/themes/shared/shared-pillbox.css");
+@import url("resource:///org/gnome/dazzle/themes/shared/shared-preferences.css");
 @import url("resource:///org/gnome/dazzle/themes/shared/shared-progressbutton.css");
 @import url("resource:///org/gnome/dazzle/themes/shared/shared-stacklist.css");
 @import url("resource:///org/gnome/dazzle/themes/shared/shared-suggestions.css");
diff --git a/data/themes/shared/shared-preferences.css b/data/themes/shared/shared-preferences.css
new file mode 100644
index 0000000..59f7073
--- /dev/null
+++ b/data/themes/shared/shared-preferences.css
@@ -0,0 +1,42 @@
+entry.preferences-search {
+  border: none;
+  border-right: 1px solid alpha(@borders, 0.55);
+  border-bottom: 1px solid alpha(@borders, 0.55);
+  border-radius: 0;
+}
+
+dzlpreferencesview stacksidebar list {
+  background-color: @content_view_bg;
+  border-right: 1px solid alpha(@borders, 0.55);
+}
+
+dzlpreferencesview stacksidebar list separator {
+  background-color: transparent;
+}
+
+dzlpreferencesview list row entry {
+  background: transparent;
+  border: none;
+  padding: 0;
+  padding-left: 5px;
+  border-radius: 3px;
+  margin: -5px;
+}
+
+dzlpreferencesview list row spinbutton entry {
+  margin-left: 2px;
+}
+
+dzlpreferences dzlpreferencesgroup list row {
+  padding: 10px;
+  border-bottom: 1px solid alpha(@borders, 0.2);
+}
+
+dzlpreferences dzlpreferencesgroup list row:last-child {
+  border-bottom: none;
+}
+
+dzlpreferences dzlpreferencesgroup list entry {
+  background: none;
+  min-height: 0px;
+}
diff --git a/src/dazzle.gresources.xml b/src/dazzle.gresources.xml
index 97b74c3..47de3d9 100644
--- a/src/dazzle.gresources.xml
+++ b/src/dazzle.gresources.xml
@@ -37,6 +37,7 @@
     <!-- Default and Fallback Theme -->
     <file compressed="true" alias="shared.css">../data/themes/shared.css</file>
     <file compressed="true" alias="shared/shared-pillbox.css">../data/themes/shared/shared-pillbox.css</file>
+    <file compressed="true" 
alias="shared/shared-preferences.css">../data/themes/shared/shared-preferences.css</file>
     <file compressed="true" 
alias="shared/shared-progressbutton.css">../data/themes/shared/shared-progressbutton.css</file>
     <file compressed="true" 
alias="shared/shared-stacklist.css">../data/themes/shared/shared-stacklist.css</file>
     <file compressed="true" 
alias="shared/shared-suggestions.css">../data/themes/shared/shared-suggestions.css</file>
diff --git a/src/prefs/dzl-preferences-group.c b/src/prefs/dzl-preferences-group.c
index e2963a2..559a57b 100644
--- a/src/prefs/dzl-preferences-group.c
+++ b/src/prefs/dzl-preferences-group.c
@@ -248,7 +248,7 @@ dzl_preferences_group_class_init (DzlPreferencesGroupClass *klass)
   g_object_class_install_properties (object_class, LAST_PROP, properties);
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/dazzle/ui/dzl-preferences-group.ui");
-  gtk_widget_class_set_css_name (widget_class, "preferencesgroup");
+  gtk_widget_class_set_css_name (widget_class, "dzlpreferencesgroup");
   gtk_widget_class_bind_template_child (widget_class, DzlPreferencesGroup, box);
   gtk_widget_class_bind_template_child (widget_class, DzlPreferencesGroup, list_box);
   gtk_widget_class_bind_template_child (widget_class, DzlPreferencesGroup, list_box_frame);
diff --git a/tests/test-preferences.c b/tests/test-preferences.c
index e3b4291..06fdbab 100644
--- a/tests/test-preferences.c
+++ b/tests/test-preferences.c
@@ -49,6 +49,17 @@ add_preferences (DzlPreferences *prefs)
   dzl_preferences_set_page (prefs, "appearance", NULL);
 }
 
+static void
+load_css (void)
+{
+  g_autoptr(GtkCssProvider) provider = NULL;
+
+  provider = dzl_css_provider_new ("/org/gnome/dazzle/themes");
+  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                             GTK_STYLE_PROVIDER (provider),
+                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
 gint
 main (gint   argc,
       gchar *argv[])
@@ -58,6 +69,8 @@ main (gint   argc,
 
   gtk_init (&argc, &argv);
 
+  load_css ();
+
   window = g_object_new (GTK_TYPE_WINDOW,
                          "title", "Preferences Test",
                          "default-width", 800,


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