Skip to content

Commit

Permalink
Rename to gnome_background_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored and tintou committed Sep 29, 2023
1 parent 9be8b7d commit b9744dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Background/Background.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions src/Background/BackgroundSource.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -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 ();
Expand Down Expand Up @@ -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 ();
}
Expand All @@ -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;
Expand Down

0 comments on commit b9744dd

Please sign in to comment.