[gnome-characters/bilelmoussaoui/ui-cleanup: 4/5] sidebar: load icons as symbolics




commit 22a5352da84000e68d1e7eb47822651f19e6e3be
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Fri Feb 12 03:22:50 2021 +0100

    sidebar: load icons as symbolics
    
    fixes #21

 src/categoryList.js | 3 +--
 src/main.js         | 3 +++
 src/util.js         | 9 ---------
 3 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/categoryList.js b/src/categoryList.js
index 1500986..c517be8 100644
--- a/src/categoryList.js
+++ b/src/categoryList.js
@@ -148,8 +148,7 @@ const CategoryListRowWidget = GObject.registerClass({
         let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL });
         this.add(hbox);
 
-        let pixbuf = Util.loadIcon(category.icon_name, 24);
-        let image = Gtk.Image.new_from_pixbuf(pixbuf);
+        let image = Gtk.Image.new_from_icon_name(category.icon_name, Gtk.IconSize.LARGE_TOOLBAR);
         image.get_style_context().add_class('category-icon');
         hbox.pack_start(image, false, false, 2);
 
diff --git a/src/main.js b/src/main.js
index 7413c74..b18b325 100644
--- a/src/main.js
+++ b/src/main.js
@@ -71,6 +71,9 @@ var MyApplication = GObject.registerClass({
     vfunc_startup () {
         super.vfunc_startup();
 
+        let theme = Gtk.IconTheme.get_default();
+        theme.add_resource_path('/org/gnome/Characters/icons');
+
         Util.loadStyleSheet('/org/gnome/Characters/application.css');
 
         Util.initActions(this,
diff --git a/src/util.js b/src/util.js
index c2dab7c..fe222ea 100644
--- a/src/util.js
+++ b/src/util.js
@@ -104,15 +104,6 @@ function getSettings(schemaId, path) {
                                   path: path });
 }
 
-function loadIcon(iconName, size) {
-    let theme = Gtk.IconTheme.get_default();
-    theme.add_resource_path('/org/gnome/Characters/icons');
-
-    return theme.load_icon(iconName,
-                           size,
-                           Gtk.IconLookupFlags.GENERIC_FALLBACK);
-}
-
 function assertEqual(one, two) {
     if (one != two)
         throw Error('Assertion failed: ' + one + ' != ' + two);


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