[gnome-text-editor] build: embed icons instead of installing them



commit 5f73033289758c7794ee530e71ae582b7be35644
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 29 15:41:25 2022 -0700

    build: embed icons instead of installing them
    
    We don't need to be installing anything to the system-wide hicolor icon
    theme, just embed them instead.
    
    Sadly, I wish we were pre-rendering these icons into symbolic PNG to avoid
    librsvg at startup, but this is good enough for now.
    
    Fixes #456

 data/icons/hicolor/meson.build         | 1 -
 data/icons/meson.build                 | 2 --
 src/editor-application.c               | 3 +++
 src/org.gnome.TextEditor.gresource.xml | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
index bb79507..9cfc0a5 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -10,5 +10,3 @@ install_data(
   install_dir: join_paths(icondir, 'symbolic/apps'),
   rename: '@0 -symbolic svg'.format(app_id),
 )
-
-subdir('hicolor')
diff --git a/src/editor-application.c b/src/editor-application.c
index 13ff6bf..251c1e1 100644
--- a/src/editor-application.c
+++ b/src/editor-application.c
@@ -344,6 +344,9 @@ editor_application_startup (GApplication *application)
                                               GTK_STYLE_PROVIDER (self->recoloring),
                                               GTK_STYLE_PROVIDER_PRIORITY_THEME+1);
 
+  gtk_icon_theme_add_resource_path (gtk_icon_theme_get_for_display (display),
+                                    "/org/gnome/TextEditor/icons");
+
   gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", quit_accels);
   gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.help", help_accels);
 
diff --git a/src/org.gnome.TextEditor.gresource.xml b/src/org.gnome.TextEditor.gresource.xml
index c949fe8..9c01833 100644
--- a/src/org.gnome.TextEditor.gresource.xml
+++ b/src/org.gnome.TextEditor.gresource.xml
@@ -24,4 +24,8 @@
   <gresource prefix="/plugins/modelines">
     <file alias="language-mappings">modelines/language-mappings</file>
   </gresource>
+  <gresource prefix="/org/gnome/TextEditor/icons/scalable/actions">
+    <file preprocess="xml-stripblanks" 
alias="document-admin-symbolic.svg">../data/icons/hicolor/scalable/actions/document-admin-symbolic.svg</file>
+    <file preprocess="xml-stripblanks" 
alias="document-modified-symbolic.svg">../data/icons/hicolor/scalable/actions/document-modified-symbolic.svg</file>
+  </gresource>
 </gresources>


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