🔧 Add separate ui files for adw and gtk4

This commit is contained in:
Simon Schneegans
2022-11-07 06:12:21 +01:00
parent 3e902cbf37
commit f4ebfddfa8
57 changed files with 6033 additions and 1999 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ var Apparition = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Apparition.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Apparition.ui`);
// Bind all properties.
dialog.bindAdjustment('apparition-randomness');
+1 -1
View File
@@ -146,7 +146,7 @@ var BrokenGlass = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/BrokenGlass.ui');
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/BrokenGlass.ui`);
// Bind all properties.
dialog.bindAdjustment('broken-glass-animation-time');
+1 -1
View File
@@ -95,7 +95,7 @@ var Doom = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Doom.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Doom.ui`);
// Bind all properties.
dialog.bindAdjustment('doom-animation-time');
+1 -1
View File
@@ -87,7 +87,7 @@ var EnergizeA = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeA.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/EnergizeA.ui`);
// Bind all properties.
dialog.bindAdjustment('energize-a-animation-time');
+1 -1
View File
@@ -88,7 +88,7 @@ var EnergizeB = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeB.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/EnergizeB.ui`);
// Bind all properties.
dialog.bindAdjustment('energize-b-animation-time');
+1 -1
View File
@@ -107,7 +107,7 @@ var Fire = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Fire.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Fire.ui`);
// Bind all properties.
dialog.bindAdjustment('fire-animation-time');
+1 -1
View File
@@ -83,7 +83,7 @@ var Glide = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Glide.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Glide.ui`);
// Bind all properties.
dialog.bindAdjustment('glide-animation-time');
+1 -1
View File
@@ -105,7 +105,7 @@ var Hexagon = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Hexagon.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Hexagon.ui`);
// Bind all properties.
dialog.bindAdjustment('hexagon-animation-time');
+1 -1
View File
@@ -138,7 +138,7 @@ var Incinerate = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Incinerate.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Incinerate.ui`);
// Bind all properties.
dialog.bindAdjustment('incinerate-animation-time');
+1 -1
View File
@@ -121,7 +121,7 @@ var Matrix = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/Matrix.ui');
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Matrix.ui`);
// Bind all properties.
dialog.bindAdjustment('matrix-animation-time');
+1 -1
View File
@@ -81,7 +81,7 @@ var PixelWheel = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/PixelWheel.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/PixelWheel.ui`);
// Bind all properties.
dialog.bindAdjustment('pixel-wheel-animation-time');
+1 -1
View File
@@ -107,7 +107,7 @@ var PixelWipe = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/PixelWipe.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/PixelWipe.ui`);
// Bind all properties.
dialog.bindAdjustment('pixel-wipe-animation-time');
+1 -1
View File
@@ -81,7 +81,7 @@ var Pixelate = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Pixelate.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Pixelate.ui`);
// Bind all properties.
dialog.bindAdjustment('pixelate-animation-time');
+2 -1
View File
@@ -125,7 +125,8 @@ var SnapOfDisintegration = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/SnapOfDisintegration.ui');
dialog.getBuilder().add_from_resource(
`/ui/${utils.getUIDir()}/SnapOfDisintegration.ui`);
// Bind all properties.
dialog.bindAdjustment('snap-animation-time');
+1 -1
View File
@@ -123,7 +123,7 @@ var TRexAttack = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/TRexAttack.ui');
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/TRexAttack.ui`);
// Bind all properties.
dialog.bindAdjustment('trex-animation-time');
+1 -1
View File
@@ -85,7 +85,7 @@ var TVEffect = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/TVEffect.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/TVEffect.ui`);
// Bind all properties.
dialog.bindAdjustment('tv-animation-time');
+1 -1
View File
@@ -93,7 +93,7 @@ var Wisps = class {
getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Wisps.ui`);
dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Wisps.ui`);
// Bind all properties.
dialog.bindAdjustment('wisps-animation-time');
+18 -3
View File
@@ -17,6 +17,14 @@
const {Gtk, Gio} = imports.gi;
const ByteArray = imports.byteArray;
// libadwaita is available starting with GNOME Shell 42.
let Adw = null;
try {
Adw = imports.gi.Adw;
} catch (e) {
// Nothing to do.
}
// Returns the given argument, except for "alpha", "beta", and "rc". In these cases -3,
// -2, and -1 are returned respectively.
function toNumericVersion(x) {
@@ -62,9 +70,16 @@ function isGTK4() {
return Gtk.get_major_version() == 4;
}
// This method returns 'gtk3' or 'gtk4' depending on the currently used gtk version.
function getGTKString() {
return isGTK4() ? 'gtk4' : 'gtk3';
// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of
// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42).
function isADW() {
return Adw && shellVersionIsAtLeast(42, 'beta');
}
// This method returns 'gtk3', 'gtk4', or 'adw' depending on the currently used GTK / and
// or libadwaita version.
function getUIDir() {
return isADW() ? 'adw' : (isGTK4() ? 'gtk4' : 'gtk3');
}
// This method returns true if the current GNOME Shell version matches the given