Rename to gnome_background_settings

This commit is contained in:
lenemter 2023-09-16 13:52:19 +09:00 committed by Corentin Noël
parent 9be8b7d5f2
commit b9744dd3fc
2 changed files with 9 additions and 9 deletions

View File

@ -105,7 +105,7 @@ namespace Gala {
private void load_pattern () {
string color_string;
var settings = background_source.settings;
var settings = background_source.gnome_background_settings;
color_string = settings.get_string ("primary-color");
var color = Clutter.Color.from_string (color_string);

View File

@ -31,7 +31,7 @@ namespace Gala {
public signal void changed ();
public Meta.Display display { get; construct; }
public Settings settings { get; construct; }
public GLib.Settings gnome_background_settings { get; construct; }
internal int use_count { get; set; default = 0; }
@ -50,19 +50,19 @@ namespace Gala {
monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.connect (monitors_changed);
settings = new Settings ("org.gnome.desktop.background");
gnome_background_settings = new Settings ("org.gnome.desktop.background");
// unfortunately the settings sometimes tend to fire random changes even though
// nothing actually happened. The code below is used to prevent us from spamming
// new actors all the time, which lead to some problems in other areas of the code
for (int i = 0; i < OPTIONS.length; i++) {
hash_cache[i] = settings.get_value (OPTIONS[i]).hash ();
hash_cache[i] = gnome_background_settings.get_value (OPTIONS[i]).hash ();
}
settings.changed.connect ((key) => {
gnome_background_settings.changed.connect ((key) => {
for (int i = 0; i < OPTIONS.length; i++) {
if (key == OPTIONS[i]) {
uint new_hash = settings.get_value (key).hash ();
uint new_hash = gnome_background_settings.get_value (key).hash ();
if (hash_cache[i] != new_hash) {
hash_cache[i] = new_hash;
changed ();
@ -95,7 +95,7 @@ namespace Gala {
public Background get_background (int monitor_index) {
string? filename = null;
var style = settings.get_enum ("picture-options");
var style = gnome_background_settings.get_enum ("picture-options");
if (style != GDesktop.BackgroundStyle.NONE) {
filename = get_background_path ();
}
@ -119,14 +119,14 @@ namespace Gala {
private string get_background_path () {
if (Granite.Settings.get_default ().prefers_color_scheme == DARK) {
var uri = settings.get_string ("picture-uri-dark");
var uri = gnome_background_settings.get_string ("picture-uri-dark");
var path = File.new_for_uri (uri).get_path ();
if (FileUtils.test (path, EXISTS)) {
return path;
}
}
var uri = settings.get_string ("picture-uri");
var uri = gnome_background_settings.get_string ("picture-uri");
var path = File.new_for_uri (uri).get_path ();
if (FileUtils.test (path, EXISTS)) {
return path;