diff options
author | asliturk <asliturk@hotmail.com> | 2020-02-02 14:45:45 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-02 15:08:37 +0100 |
commit | 9dfe6521fcb331c283c5ece6675daf699481df4e (patch) | |
tree | 133517c438b55c14709e2d1ffef457eb44ea707b /Libraries | |
parent | c5edc09b785f7f4b6696948b29bf985eda064a61 (diff) | |
download | serenity-9dfe6521fcb331c283c5ece6675daf699481df4e.zip |
LibGUI: Save current wallpaper setting to WindowManager.ini.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGUI/GDesktop.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GDesktop.cpp b/Libraries/LibGUI/GDesktop.cpp index fed676a593..2ffe5801c4 100644 --- a/Libraries/LibGUI/GDesktop.cpp +++ b/Libraries/LibGUI/GDesktop.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <LibCore/CConfigFile.h> #include <LibGUI/GDesktop.h> #include <LibGUI/GWindowServerConnection.h> #include <string.h> @@ -53,7 +54,17 @@ void GDesktop::did_receive_screen_rect(Badge<GWindowServerConnection>, const Rec bool GDesktop::set_wallpaper(const StringView& path) { GWindowServerConnection::the().post_message(WindowServer::AsyncSetWallpaper(path)); - return GWindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success(); + auto ret_val = GWindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success(); + + if (ret_val) { + dbg() << "Saving wallpaper path '" << path << "' to config file at " << config->file_name(); + + RefPtr<CConfigFile> config = CConfigFile::get_for_app("WindowManager"); + config->write_entry("Background", "Wallpaper", path); + config->sync(); + } + + return ret_val; } String GDesktop::wallpaper() const |