summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibConfig/Client.cpp
AgeCommit message (Collapse)Author
2023-04-25LibCore: Big first step towards pluggable Core::EventLoopAndreas Kling
The EventLoop is now a wrapper around an EventLoopImplementation. Our old EventLoop code has moved into EventLoopImplementationUnix and continues to work as before. The main difference is that all the separate thread_local variables have been collected into a file-local ThreadData data structure. The goal here is to allow running Core::EventLoop with a totally different backend, such as Qt for Ladybird.
2022-12-23LibConfig+LibCore+ConfigServer: Support u32 configuration entriesTimothy Flynn
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-10-01LibCore+LibConfig+ConfigServer: Add Config::{add,remove}_group()thankyouverycool
Plumbs synchronous calls for adding and removing group entries to config files. This is useful for services like SystemServer which default to group names for executable paths, and for removing all keys at once.
2022-10-01LibConfig+ConfigServer: Make remove_key() synchronousthankyouverycool
Previously, when removing keys, the config utility terminated its connection before changes could be synced.
2022-04-26LibConfig+ConfigServer: Write config values synchronouslyMoustafa Raafat
This patch fixes the issue of pressing the ok button of a settings menu without saving the changes, or not reverting the changes when pressing the cancel button because the app has died before the new values make it to the other end.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-01-15LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServersin-ack
This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
2021-11-18LibConfig: Add list methods for groups and keysfaxe1008
Use the methods exposed by ConfigServer to list groups and keys.
2021-11-13LibConfig: Add removal/notifcation for keysfaxe1008
2021-08-26ConfigServer+LibConfig: Add way for clients to listen for config changesAndreas Kling
This patch adds a Config::Listener abstract class that anyone can inherit from and receive notifications when configuration values change. We don't yet monitor file system changes, so these only work for changes made by ConfigServer itself. In order to receive these notifications, clients must monitor the domain by calling monitor_domain(). Only pledged domains can be monitored. Note that the client initiating the change does not get notified.
2021-08-26ConfigServer+LibConfig: Add pledge_domains() APIAndreas Kling
This API lets applications specify which configuration domains they will be accessing throughout their lifetime. It works similarly in spirit to the kernel's pledge(). You cannot pledge_domains() more than once, and once you have used it, it's no longer possible to access any other configuration domain. This is obviously just a first cut of this mechanism, and we may need to tweak it further as we go.
2021-08-26LibConfig: VERIFY that a Core::EventLoop exists before connectingAndreas Kling
It's not possible to connect to ConfigServer without having an event loop available. This VERIFY makes it much easier to understand why things are not working. :^)
2021-08-26Userland: Introduce ConfigServer and LibConfigAndreas Kling
ConfigServer is an IPC service that provides access to application configuration and settings. The idea is to replace all uses of Core::ConfigFile with IPC requests to ConfigServer. This first cut of the API is pretty similar to Core::ConfigFile. The old: auto config = Core::ConfigFile::open_for_app("App"); auto value = config->read_entry("Group", "Key"); The new: auto value = Config::read_string("App", "Group", "Key"); ConfigServer uses the ~/.config directory as its backing store and all the files remain human-editable. :^)