[meld/fix-all-user-install] build_helpers: Add a basic GTK settings.ini file




commit 105e1774ec47ba81a8d29ea4951cb102de3d1086
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 fa1602f3..92db8f70 100644
--- a/meld/build_helpers.py
+++ b/meld/build_helpers.py
@@ -87,6 +87,8 @@ class build_data(distutils.cmd.Command):
         ('share/meld', ['data/gschemas.compiled']),
     ]
 
+    win32_settings_ini = '[Settings]\ngtk-application-prefer-dark-theme=0\n'
+
     def initialize_options(self):
         pass
 
@@ -95,7 +97,18 @@ class build_data(distutils.cmd.Command):
 
     def get_data_files(self):
         if os.name == 'nt':
-            return 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)
+
+            return self.frozen_gschemas + [
+                ('etc/gtk-3.0', [settings_path])
+            ]
         else:
             return self.gschemas
 


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