[shotwell] Fix Theme initialization code



commit 6285ef5d48b0b529a0bebeae0e308e8c37a6f541
Author: Jens Georg <mail jensge org>
Date:   Fri Feb 22 11:49:28 2019 +0100

    Fix Theme initialization code
    
    Move everything into Resources.init():
     - Icon theme search paths
     - CSS provider

 data/icons/hicolor/meson.build  | 14 --------------
 src/AppWindow.vala              |  7 -------
 src/Resources.vala              | 14 ++++++++++----
 src/plugins/ManifestWidget.vala |  2 +-
 4 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 6e0c1f79..0c39dbae 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -439,13 +439,6 @@ public abstract class AppWindow : PageWindow {
         // with each ActionGroup while we're adding the groups to the UIManager.
 
         add_actions ();
-        
-        Gtk.CssProvider provider = new Gtk.CssProvider();
-        provider.load_from_resource("/org/gnome/Shotwell/themes/org.gnome.Shotwell.css");
-        Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-        var foo = Gtk.IconTheme.get_default();
-        foo.add_resource_path("/org/gnome/Shotwell/icons/hicolor");
     }
 
     private const GLib.ActionEntry[] common_actions = {
diff --git a/src/Resources.vala b/src/Resources.vala
index c8d1ccb4..669f2852 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -798,7 +798,8 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
     private string END_MULTIMONTH_DATE_FORMAT_STRING = null;
 
     public void init () {
-        get_icon_theme_engine();
+        init_icon_theme_engine();
+        init_css_provider();
         // load application-wide stock icons as IconSets
         generate_rating_strings();
     }
@@ -990,12 +991,17 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
         
         return noninterpretable_badge_pixbuf;
     }
+
+    private void init_css_provider() {
+        Gtk.CssProvider provider = new Gtk.CssProvider();
+        provider.load_from_resource("/org/gnome/Shotwell/themes/org.gnome.Shotwell.css");
+        Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+    }
     
-    public Gtk.IconTheme get_icon_theme_engine() {
+    private void init_icon_theme_engine() {
         Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default();
         icon_theme.add_resource_path("/org/gnome/Shotwell/icons");
-        
-        return icon_theme;
+        icon_theme.add_resource_path("/org/gnome/Shotwell/icons/hicolor");
     }
     
     // This method returns a reference to a cached pixbuf that may be shared throughout the system.
diff --git a/src/plugins/ManifestWidget.vala b/src/plugins/ManifestWidget.vala
index 8fb0ba21..e6e638c1 100644
--- a/src/plugins/ManifestWidget.vala
+++ b/src/plugins/ManifestWidget.vala
@@ -148,7 +148,7 @@ private class ManifestListView : Gtk.TreeView {
         set_grid_lines(Gtk.TreeViewGridLines.NONE);
         get_selection().set_mode(Gtk.SelectionMode.BROWSE);
         
-        Gtk.IconTheme icon_theme = Resources.get_icon_theme_engine();
+        Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default();
         
         // create a list of plugins (sorted by name) that are separated by extension points (sorted
         // by name)


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