Skip to content

Commit

Permalink
Guard draw-background from being set if it doesn't exist, fixes #109, f…
Browse files Browse the repository at this point in the history
…ixes #43, updates #91
  • Loading branch information
daf committed Mar 15, 2018
1 parent 98153b5 commit f6a0690
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/SetBG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,15 @@ Glib::ustring SetBGGnome::get_gsettings_key()
void SetBGGnome::set_show_desktop()
{
Glib::RefPtr<Gio::Settings> settings = Gio::Settings::create(get_gsettings_key());
settings->set_boolean("draw-background", true);
std::vector<Glib::ustring> keys = settings->list_keys();

if (std::find(keys.begin(), keys.end(), Glib::ustring("draw-background")) != keys.end()) {
try {
settings->set_boolean("draw-background", true);
} catch (...) {
std::cerr << "ERROR: draw-background supposedly exists, but threw an error while setting it\n";
}
}
}

/**
Expand Down

0 comments on commit f6a0690

Please sign in to comment.