[shotwell] Replace override_background with CSS



commit 8c443d24a2198bbc4018286c1410a179eee6571a
Author: Jens Georg <mail jensge org>
Date:   Fri Mar 30 17:09:28 2018 +0200

    Replace override_background with CSS

 misc/org.gnome.Shotwell.css      |    3 +++
 org.gnome.Shotwell.gresource.xml |    1 +
 src/Properties.vala              |    4 +---
 src/main.vala                    |    4 ++++
 4 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/misc/org.gnome.Shotwell.css b/misc/org.gnome.Shotwell.css
new file mode 100644
index 0000000..38192c5
--- /dev/null
+++ b/misc/org.gnome.Shotwell.css
@@ -0,0 +1,3 @@
+textview.shotwell-static text {
+    background-color: @theme_unfocused_bg_color;
+}
diff --git a/org.gnome.Shotwell.gresource.xml b/org.gnome.Shotwell.gresource.xml
index ec04227..bc33edc 100644
--- a/org.gnome.Shotwell.gresource.xml
+++ b/org.gnome.Shotwell.gresource.xml
@@ -86,5 +86,6 @@
       <file>icons/videos-page.png</file>
       <file>icons/zoom-in.png</file>
       <file>icons/zoom-out.png</file>
+      <file>misc/org.gnome.Shotwell.css</file>
   </gresource>
 </gresources>
diff --git a/src/Properties.vala b/src/Properties.vala
index 3cbd5af..1d7a987 100644
--- a/src/Properties.vala
+++ b/src/Properties.vala
@@ -28,9 +28,7 @@ private abstract class Properties : Gtk.Grid {
             // makes sense during editing. In this instance we only *show*
             // the content and thus want that the parent's background color
             // is inherited to the TextView
-            Gtk.StyleContext context = info_scroll.get_style_context();
-            view.override_background_color (Gtk.StateFlags.NORMAL,
-                context.get_background_color(Gtk.StateFlags.NORMAL));
+            view.get_style_context().add_class("shotwell-static");
             view.set_wrap_mode(Gtk.WrapMode.WORD);
             view.set_cursor_visible(false);
             view.set_editable(false);
diff --git a/src/main.vala b/src/main.vala
index d09c827..1dda0cb 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -361,6 +361,10 @@ void main(string[] args) {
         AppDirs.terminate();
         return;
     }
+
+    var provider = new Gtk.CssProvider();
+    provider.load_from_resource("/org/gnome/Shotwell/misc/org.gnome.Shotwell.css");
+    Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
     
     if (CommandlineOptions.show_version) {
         if (Resources.GIT_VERSION != null)


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