[meld: 1/3] icons: embed application icon as a resource too



commit 2b0890750eec7d82a87b582ee65427150cb02259
Author: Vasily Galkin <galkin-vv ya ru>
Date:   Thu Jun 11 23:47:30 2020 +0300

    icons: embed application icon as a resource too
    
    Before this patch not-installed meld or meld built for windows
    has problems loading its own svg icon,
    since the icon doesn't present in resources
    and were never installed into the OS.
    
    This leads to lack of application icon on non-Gnome linux DE's
    and lack of icon inside about window on all platforms.
    
    This patch embeds application icon into resources,
    so it is usable from inside meld even if it is not installed.
    
    This change can lead to a situation when builtin icon
    overrides the icon from a user-configured icon theme.

 bin/meld                          | 1 +
 meld/build_helpers.py             | 1 +
 meld/resources/meld.gresource.xml | 4 ++++
 meld/resources/meson.build        | 5 ++++-
 4 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/bin/meld b/bin/meld
index 1c769000..79a61ad6 100755
--- a/bin/meld
+++ b/bin/meld
@@ -273,6 +273,7 @@ def setup_resources():
                 "glib-compile-resources",
                 "--target={}".format(resource_file),
                 "--sourcedir=meld/resources",
+                "--sourcedir=data/icons/hicolor",
                 "meld/resources/meld.gresource.xml",
             ],
             cwd=melddir
diff --git a/meld/build_helpers.py b/meld/build_helpers.py
index 158ab65f..73f8c3ec 100644
--- a/meld/build_helpers.py
+++ b/meld/build_helpers.py
@@ -117,6 +117,7 @@ class build_data(distutils.cmd.Command):
             "glib-compile-resources",
             "--target={}".format(target),
             "--sourcedir={}".format(resource_dir),
+            "--sourcedir={}".format("data/icons/hicolor"),
             self.resource_source,
         ])
 
diff --git a/meld/resources/meld.gresource.xml b/meld/resources/meld.gresource.xml
index da158901..3295a462 100644
--- a/meld/resources/meld.gresource.xml
+++ b/meld/resources/meld.gresource.xml
@@ -1,5 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
+  <gresource prefix="/org/gnome/meld/icons">
+    <file>scalable/apps/org.gnome.Meld.svg</file>
+    <file>scalable/apps/org.gnome.MeldDevel.svg</file>
+  </gresource>
   <gresource prefix="/org/gnome/meld">
     <file>gtk/help-overlay.ui</file>
     <file>gtk/menus.ui</file>
diff --git a/meld/resources/meson.build b/meld/resources/meson.build
index 46bc1e04..98e47059 100644
--- a/meld/resources/meson.build
+++ b/meld/resources/meson.build
@@ -2,7 +2,10 @@ gnome.compile_resources(
   application_id,
   meson.project_name() + '.gresource.xml',
   gresource_bundle: true,
-  source_dir: meson.current_build_dir(),
+  source_dir: [
+    meson.current_build_dir(),
+    meson.current_source_dir() + '/../../data/icons/hicolor'
+    ],
   install_dir: pkgdatadir,
   install: true,
 )


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