[PATCH 1/2] Add CSS stylesheet to Anaconda GUI

Máirín Duffy duffy at redhat.com
Wed Feb 5 00:54:47 UTC 2014


We need GTK stylesheet support to implement the branding/styling
for bug 1045250. This work is based on a patch from David Shea.
---
 data/Makefile.am              | 8 +++-----
 data/anaconda-gtk.css         | 0
 pyanaconda/ui/gui/__init__.py | 6 ++++++
 scripts/makeupdates           | 2 ++
 4 files changed, 11 insertions(+), 5 deletions(-)
 create mode 100644 data/anaconda-gtk.css

diff --git a/data/Makefile.am b/data/Makefile.am
index b7eddfe..ebbdaaf 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -21,11 +21,9 @@ SUBDIRS = command-stubs icons liveinst pixmaps systemd post-scripts
 
 CLEANFILES = *~
 
-ksdir                 = $(datadir)/$(PACKAGE_NAME)
-dist_ks_DATA          = interactive-defaults.ks
-
-tmuxdir               = $(datadir)/$(PACKAGE_NAME)
-dist_tmux_DATA        = tmux.conf
+dist_pkgdata_DATA          = interactive-defaults.ks \
+			     tmux.conf \
+			     anaconda-gtk.css
 
 helpdir               = $(datadir)/$(PACKAGE_NAME)
 dist_help_DATA        = anaconda_options.txt
diff --git a/data/anaconda-gtk.css b/data/anaconda-gtk.css
new file mode 100644
index 0000000..e69de29
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 966bc93..3d553e8 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -389,6 +389,12 @@ class GraphicalUserInterface(UserInterface):
         settings.set_property("gtk-font-name", "Cantarell")
         settings.set_property("gtk-icon-theme-name", "gnome")
 
+        # Apply the application stylesheet
+        provider = Gtk.CssProvider()
+        provider.load_from_path("/usr/share/anaconda/anaconda-gtk.css")
+        Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
+                Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+
         self._currentAction.window.show_all()
 
         # Do this at the last possible minute.
diff --git a/scripts/makeupdates b/scripts/makeupdates
index f1d6ecc..6079fac 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -159,6 +159,8 @@ def copyUpdatedFiles(tag, updates, cwd):
             install_to_dir(file, "lib/systemd/system-generators")
         elif file == "data/tmux.conf":
             install_to_dir(file, "usr/share/anaconda")
+        elif file == "data/anaconda-gtk.css":
+            install_to_dir(file, "usr/share/anaconda")
         elif file == "data/interactive-defaults.ks":
             install_to_dir(file, "usr/share/anaconda")
         elif file == "data/liveinst/liveinst":
-- 
1.8.4.2



More information about the anaconda-patches mailing list