[meld] build_helpers: Add a basic GTK settings.ini file



commit d89048db15b83015b5d0b60522771d6575a713aa
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Apr 11 08:30:09 2021 +1000

    build_helpers: Add a basic GTK settings.ini file
    
    This used to be included in the distribution (in a very long ago build)
    and made it slightly easier for people to toggle the GTK dark theme
    support. There's currently no real down-side to including this, so we
    may as well have it.

 meld/build_helpers.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/meld/build_helpers.py b/meld/build_helpers.py
index 73f8c3ec..3240d667 100644
--- a/meld/build_helpers.py
+++ b/meld/build_helpers.py
@@ -89,6 +89,8 @@ class build_data(distutils.cmd.Command):
         ('share/meld', ['data/gschemas.compiled']),
     ]
 
+    win32_settings_ini = '[Settings]\ngtk-application-prefer-dark-theme=0\n'
+
     style_source = "data/styles/*.style-scheme.xml.in"
     style_target_dir = 'share/meld/styles'
 
@@ -124,7 +126,18 @@ class build_data(distutils.cmd.Command):
         data_files.append(('share/meld', [target]))
 
         if windows_build:
-            gschemas = self.frozen_gschemas
+            # Write out a default settings.ini for Windows to make
+            # e.g., dark theme selection slightly easier.
+            settings_dir = os.path.join('build', 'etc', 'gtk-3.0')
+            if not os.path.exists(settings_dir):
+                os.makedirs(settings_dir)
+            settings_path = os.path.join(settings_dir, 'settings.ini')
+            with open(settings_path, 'w') as f:
+                print(self.win32_settings_ini, file=f)
+
+            gschemas = self.frozen_gschemas + [
+                ('etc/gtk-3.0', [settings_path])
+            ]
         else:
             gschemas = self.gschemas
         data_files.extend(gschemas)


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