refactor: rename the D-Bus names to org.cutefish

main
reionwong 1 week ago
parent e6b4933283
commit 8d613502f1

@ -11,7 +11,7 @@
using namespace cutefish;
static constexpr const char* kService = "com.cutefish.SettingsUI";
static constexpr const char* kService = "org.cutefish.SettingsUI";
static constexpr const char* kPath = "/SettingsUI";
static void printHelp(const char* program)

@ -132,7 +132,7 @@ void Battery::setPercentEnabled(bool enabled)
if (m_mock)
return;
dbus::Proxy(dbus::Connection::session(), "com.cutefish.Statusbar", "/Statusbar", "com.cutefish.Statusbar")
dbus::Proxy(dbus::Connection::session(), "org.cutefish.Statusbar", "/Statusbar", "org.cutefish.Statusbar")
.send("setBatteryPercentage", enabled);
}

@ -14,7 +14,7 @@ namespace settings {
TimeSettings::TimeSettings(timedate::TimeDate& timeDate)
: m_timeDate(timeDate)
, m_statusBar(dbus::Connection::session(), "com.cutefish.Statusbar", "/Statusbar", "com.cutefish.Statusbar")
, m_statusBar(dbus::Connection::session(), "org.cutefish.Statusbar", "/Statusbar", "org.cutefish.Statusbar")
, m_canNtp(timeDate.canNtp())
, m_useNtp(timeDate.ntp())
{

@ -10,9 +10,9 @@ using namespace cutefish::base;
namespace settings {
static constexpr const char* kService = "com.cutefish.Services";
static constexpr const char* kPath = "/com/cutefish/Services/Brightness";
static constexpr const char* kInterface = "com.cutefish.Services.Brightness";
static constexpr const char* kService = "org.cutefish.Services";
static constexpr const char* kPath = "/org/cutefish/Services/Brightness";
static constexpr const char* kInterface = "org.cutefish.Services.Brightness";
Brightness::Brightness()
: m_service(dbus::Connection::session(), kService, kPath, kInterface)

@ -14,7 +14,7 @@ using namespace cutefish::base;
namespace settings {
DockSettings::DockSettings()
: m_dock(dbus::Connection::session(), "com.cutefish.Dock", "/Dock", "com.cutefish.Dock")
: m_dock(dbus::Connection::session(), "org.cutefish.Dock", "/Dock", "org.cutefish.Dock")
{
const Settings shell(paths::cutefishConfig("shell"));
m_iconSize = int(shell.intValue("Dock/IconSize"));

@ -10,8 +10,8 @@ using namespace cutefish::base;
namespace settings {
static constexpr const char* kService = "com.cutefish.HotCorners1";
static constexpr const char* kPath = "/com/cutefish/HotCorners1";
static constexpr const char* kService = "org.cutefish.HotCorners1";
static constexpr const char* kPath = "/org/cutefish/HotCorners1";
// The compositor's modifier bits, as in the shortcuts service.
static constexpr int kShiftDown = 1 << 0;
@ -46,7 +46,7 @@ HotCorners::HotCorners()
m_properties = reply.value<dbus::VariantMap>().value_or(dbus::VariantMap());
m_available = true;
}
const dbus::Proxy shortcuts(bus, "com.cutefish.Shortcuts1", "/com/cutefish/Shortcuts1", "com.cutefish.Shortcuts1");
const dbus::Proxy shortcuts(bus, "org.cutefish.Shortcuts1", "/org/cutefish/Shortcuts1", "org.cutefish.Shortcuts1");
m_commandKeys = shortcuts.property<std::string>("shortcutConvention").value_or(std::string()) == "command";
m_changedMatch = m_corners.onSignal("changed", [this](const dbus::Message&) { reload(); });
m_watch = bus->watchName(kService, [this](const std::string& owner) {

@ -11,7 +11,7 @@
namespace settings {
// The compositor's com.cutefish.HotCorners1: what each screen corner runs.
// The compositor's org.cutefish.HotCorners1: what each screen corner runs.
class HotCorners
{
public:

@ -14,15 +14,15 @@
namespace settings {
// One of the compositor's input services, such as com.cutefish.Keyboard1:
// One of the compositor's input services, such as org.cutefish.Keyboard1:
// its properties, read when it appears and again after each of its change
// signals, and calls to its setters. The first read blocks, so a page shows
// the service's values from its first frame.
class CompositorService
{
public:
// The object path follows the name: com.cutefish.Mouse1 lives at
// /com/cutefish/Mouse1, and its interface has the same name.
// The object path follows the name: org.cutefish.Mouse1 lives at
// /org/cutefish/Mouse1, and its interface has the same name.
explicit CompositorService(std::string name);
~CompositorService();

@ -37,7 +37,7 @@ static InputMethod::Method describe(const std::string& id)
}
InputMethod::InputMethod()
: m_service("com.cutefish.InputMethod1")
: m_service("org.cutefish.InputMethod1")
{
refreshMethods();
m_wasAvailable = m_service.isAvailable();

@ -11,7 +11,7 @@
namespace settings {
// Client of the compositor's com.cutefish.InputMethod1 service.
// Client of the compositor's org.cutefish.InputMethod1 service.
class InputMethod
{
public:

@ -123,7 +123,7 @@ const std::vector<KeyboardLayout>& keyboardLayouts()
}
Keyboard::Keyboard()
: m_service("com.cutefish.Keyboard1")
: m_service("org.cutefish.Keyboard1")
{
}

@ -24,7 +24,7 @@ const std::vector<KeyboardLayout>& keyboardLayouts();
// Reads a rules file such as /usr/share/X11/xkb/rules/evdev.xml.
std::vector<KeyboardLayout> readKeyboardLayouts(const std::string& path);
// Client of the compositor's com.cutefish.Keyboard1 service.
// Client of the compositor's org.cutefish.Keyboard1 service.
class Keyboard
{
public:

@ -21,9 +21,9 @@ using namespace cutefish::base;
namespace settings {
static constexpr const char* kService = "com.cutefish.Services";
static constexpr const char* kPath = "/com/cutefish/Services/Language";
static constexpr const char* kInterface = "com.cutefish.Services.Language";
static constexpr const char* kService = "org.cutefish.Services";
static constexpr const char* kPath = "/org/cutefish/Services/Language";
static constexpr const char* kInterface = "org.cutefish.Services.Language";
static std::string displayName(const icu::Locale& locale, const icu::Locale& displayLocale)
{

@ -6,7 +6,7 @@
namespace settings {
Mouse::Mouse()
: m_service("com.cutefish.Mouse1")
: m_service("org.cutefish.Mouse1")
{
}

@ -8,7 +8,7 @@
namespace settings {
// Client of the compositor's com.cutefish.Mouse1 service.
// Client of the compositor's org.cutefish.Mouse1 service.
class Mouse
{
public:

@ -10,8 +10,8 @@ using namespace cutefish::base;
namespace settings {
Notifications::Notifications()
: m_shell(dbus::Connection::session(), "com.cutefish.Notification", "/Notification",
"com.cutefish.Notification")
: m_shell(dbus::Connection::session(), "org.cutefish.Notification", "/Notification",
"org.cutefish.Notification")
{
m_doNotDisturb = m_shell.property<bool>("doNotDisturb").value_or(false);
m_doNotDisturbMatch = m_shell.onSignal("doNotDisturbChanged", [this](const dbus::Message&) {

@ -25,8 +25,8 @@ static int readTimeout(const Settings& settings, const std::string& key, int fal
}
PowerSettings::PowerSettings()
: m_service(dbus::Connection::session(), "com.cutefish.Services", "/com/cutefish/Services/Power",
"com.cutefish.Services.Power")
: m_service(dbus::Connection::session(), "org.cutefish.Services", "/org/cutefish/Services/Power",
"org.cutefish.Services.Power")
{
const Settings settings(paths::cutefishConfig("services"));
m_batteryScreenOff = readTimeout(settings, "Power/BatteryScreenOff", kDefaultBatteryScreenOff);

@ -94,7 +94,7 @@ static const std::map<uint32_t, uint32_t> kServiceKeysyms = {
};
ShortcutsModel::ShortcutsModel()
: m_service("com.cutefish.Shortcuts1")
: m_service("org.cutefish.Shortcuts1")
{
// The service's acceleratorsChanged, and its coming and going, end up here.
m_serviceChanged = m_service.changed.connect([this] { reload(); });

@ -17,7 +17,7 @@ class Value;
namespace settings {
// The keyboard shortcuts page's view of the compositor's
// com.cutefish.Shortcuts1 service. The compositor owns the bindings and the
// org.cutefish.Shortcuts1 service. The compositor owns the bindings and the
// defaults; this side owns the order the actions are listed in, their
// categories and their descriptions, the way
// ash/webui/shortcut_customization_ui's layout table does for the ChromeOS

@ -6,7 +6,7 @@
namespace settings {
Touchpad::Touchpad()
: m_service("com.cutefish.Touchpad1")
: m_service("org.cutefish.Touchpad1")
{
}

@ -8,7 +8,7 @@
namespace settings {
// Client of the compositor's com.cutefish.Touchpad1 service. Without the
// Client of the compositor's org.cutefish.Touchpad1 service. Without the
// service every value is the compositor's default.
class Touchpad
{

@ -19,13 +19,13 @@ namespace settings {
namespace {
// The compositor's com.cutefish.Touchscreen1 service: the touch screens by
// The compositor's org.cutefish.Touchscreen1 service: the touch screens by
// name, and those turned off.
class Touchscreen
{
public:
Touchscreen()
: m_service("com.cutefish.Touchscreen1")
: m_service("org.cutefish.Touchscreen1")
{
}

@ -27,7 +27,7 @@ struct TimeSettingsFixture : ::testing::Test
{
dbus::Connection* bus = dbus::Connection::session();
const dbus::Proxy daemon(bus, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus");
if (!bus || daemon.call("NameHasOwner", std::string("com.cutefish.Statusbar")).value<bool>().value_or(true))
if (!bus || daemon.call("NameHasOwner", std::string("org.cutefish.Statusbar")).value<bool>().value_or(true))
GTEST_SKIP() << "Needs a private session bus: run the tests in dbus-run-session";
timedated = std::make_unique<ServiceThread>("org.freedesktop.timedate1", [this](dbus::Connection& bus) {
@ -49,8 +49,8 @@ struct TimeSettingsFixture : ::testing::Test
object->publish();
return std::shared_ptr<void>(object);
});
statusBar = std::make_unique<ServiceThread>("com.cutefish.Statusbar", [this](dbus::Connection& bus) {
auto object = std::make_shared<dbus::Object>(&bus, "/Statusbar", "com.cutefish.Statusbar");
statusBar = std::make_unique<ServiceThread>("org.cutefish.Statusbar", [this](dbus::Connection& bus) {
auto object = std::make_shared<dbus::Object>(&bus, "/Statusbar", "org.cutefish.Statusbar");
object->addMethod("setTwentyFourTime", [this](bool enabled) { twentyFour = enabled ? 1 : 0; });
object->publish();
return std::shared_ptr<void>(object);
@ -65,7 +65,7 @@ struct TimeSettingsFixture : ::testing::Test
if (statusBar) {
statusBar->stop();
timedated->stop();
settings::testing::waitForNameGone("com.cutefish.Statusbar");
settings::testing::waitForNameGone("org.cutefish.Statusbar");
settings::testing::waitForNameGone("org.freedesktop.timedate1");
}
}

@ -175,7 +175,7 @@ private:
uint64_t revision = 1;
std::string previewToken;
dbus::Object display(bus.get(), "/com/cutefish/DisplayConfig1", "com.cutefish.DisplayConfig1");
dbus::Object display(bus.get(), "/org/cutefish/DisplayConfig1", "org.cutefish.DisplayConfig1");
display.addMethod("GetState", [&] {
return std::make_tuple(std::string("test"), std::string("seat0"), uint64_t(1), revision, physical,
logicals, std::vector<Placement>(), previewToken,
@ -224,10 +224,10 @@ private:
display.addSignal("OperationFinished", "sbbusastt");
display.addSignal("PreviewChanged", "sttt");
display.publish();
m_owned = bus->requestName("com.cutefish.DisplayConfig");
m_owned = bus->requestName("org.cutefish.DisplayConfig");
bool enabled = false;
dbus::Object nightLight(services.get(), "/com/cutefish/Services/NightLight", "com.cutefish.Services.NightLight");
dbus::Object nightLight(services.get(), "/org/cutefish/Services/NightLight", "org.cutefish.Services.NightLight");
nightLight.addProperty("enabled", [&] { return enabled; });
nightLight.addProperty("temperature", [] { return 0.5; });
nightLight.addProperty("schedule", [this] { return locked(m_schedule); });
@ -257,14 +257,14 @@ private:
if (!panel.devicePath.empty())
m_brightnessDisplays = {std::filesystem::path(panel.devicePath).filename().string() + "-eDP-1"};
dbus::Object brightness(services.get(), "/com/cutefish/Services/Brightness", "com.cutefish.Services.Brightness");
dbus::Object brightness(services.get(), "/org/cutefish/Services/Brightness", "org.cutefish.Services.Brightness");
brightness.addMethod("displays", [this] { return locked(m_brightnessDisplays); });
brightness.addMethod("displayBrightness", [](const std::string&) { return int32_t(70); });
brightness.addMethod("setDisplayBrightness", [](const std::string&, int32_t) {});
brightness.addSignal("displaysChanged", "");
brightness.addSignal("displayBrightnessChanged", "si");
brightness.publish();
m_owned = services->requestName("com.cutefish.Services") && m_owned;
m_owned = services->requestName("org.cutefish.Services") && m_owned;
ready.set_value();
loop.run();

@ -128,7 +128,7 @@ TEST(Language, SavingWithoutTheServiceReportsAnError)
// Never against the live session, whose languages this would change.
const base::dbus::Proxy daemon(base::dbus::Connection::session(), "org.freedesktop.DBus",
"/org/freedesktop/DBus", "org.freedesktop.DBus");
if (daemon.call("NameHasOwner", std::string("com.cutefish.Services")).value<bool>().value_or(false))
if (daemon.call("NameHasOwner", std::string("org.cutefish.Services")).value<bool>().value_or(false))
GTEST_SKIP() << "Needs a private session bus: run the tests in dbus-run-session";
LanguageConfig config({"en_US", "de_DE"});
Language language(config.path);

@ -24,7 +24,7 @@ using settings::testing::waitFor;
namespace {
// The compositor's com.cutefish.Mouse1 as a stand-in: its settings outlive a
// The compositor's org.cutefish.Mouse1 as a stand-in: its settings outlive a
// restart of the service, as the compositor keeps them in a file.
struct FakeMouse
{
@ -59,7 +59,7 @@ static void addSetting(dbus::Object& object, FakeMouse& fake, const std::string&
static std::shared_ptr<void> serve(dbus::Connection& bus, FakeMouse& fake)
{
auto object = std::make_shared<dbus::Object>(&bus, "/com/cutefish/Mouse1", "com.cutefish.Mouse1");
auto object = std::make_shared<dbus::Object>(&bus, "/org/cutefish/Mouse1", "org.cutefish.Mouse1");
object->addProperty("available", [] { return true; });
object->addSignal("availableChanged", "");
addSetting(*object, fake, "leftHanded", "setLeftHanded", &FakeMouse::leftHanded);
@ -79,7 +79,7 @@ struct MouseTest : ::testing::Test
{
if (!settings::testing::hasSessionBus())
GTEST_SKIP() << "no session bus";
service.emplace("com.cutefish.Mouse1", [this](dbus::Connection& bus) { return serve(bus, fake); });
service.emplace("org.cutefish.Mouse1", [this](dbus::Connection& bus) { return serve(bus, fake); });
}
void TearDown() override
@ -87,7 +87,7 @@ struct MouseTest : ::testing::Test
if (!service)
return;
service.reset();
settings::testing::waitForNameGone("com.cutefish.Mouse1");
settings::testing::waitForNameGone("org.cutefish.Mouse1");
}
FakeMouse fake;

@ -2,7 +2,7 @@
// SPDX-License-Identifier: BSD-3-Clause
// ShortcutsModel against a stand-in for the compositor's
// com.cutefish.Shortcuts1 service, answering in the JSON the real one
// org.cutefish.Shortcuts1 service, answering in the JSON the real one
// produces.
#include <gtest/gtest.h>
@ -76,7 +76,7 @@ struct FakeShortcuts
static std::shared_ptr<void> serve(dbus::Connection& bus, FakeShortcuts& fake)
{
auto object = std::make_shared<dbus::Object>(&bus, "/com/cutefish/Shortcuts1", "com.cutefish.Shortcuts1");
auto object = std::make_shared<dbus::Object>(&bus, "/org/cutefish/Shortcuts1", "org.cutefish.Shortcuts1");
object->addProperty("shortcutConvention", [&fake] {
std::lock_guard guard(fake.mutex);
return fake.convention;
@ -136,7 +136,7 @@ struct ShortcutsModelTest : ::testing::Test
{
if (!settings::testing::hasSessionBus())
GTEST_SKIP() << "no session bus";
service.emplace("com.cutefish.Shortcuts1", [this](dbus::Connection& bus) { return serve(bus, fake); });
service.emplace("org.cutefish.Shortcuts1", [this](dbus::Connection& bus) { return serve(bus, fake); });
}
void TearDown() override
@ -144,7 +144,7 @@ struct ShortcutsModelTest : ::testing::Test
if (!service)
return;
service.reset();
settings::testing::waitForNameGone("com.cutefish.Shortcuts1");
settings::testing::waitForNameGone("org.cutefish.Shortcuts1");
}
FakeShortcuts fake;

@ -21,7 +21,7 @@ using settings::testing::waitFor;
namespace {
// The compositor's com.cutefish.Touchpad1 as a stand-in, for a pad with
// The compositor's org.cutefish.Touchpad1 as a stand-in, for a pad with
// physical buttons: no choice of secondary click.
struct FakeTouchpad
{
@ -36,7 +36,7 @@ struct FakeTouchpad
static std::shared_ptr<void> serve(dbus::Connection& bus, FakeTouchpad& fake)
{
auto object = std::make_shared<dbus::Object>(&bus, "/com/cutefish/Touchpad1", "com.cutefish.Touchpad1");
auto object = std::make_shared<dbus::Object>(&bus, "/org/cutefish/Touchpad1", "org.cutefish.Touchpad1");
object->addProperty("available", [] { return true; });
object->addProperty("enabled", [] { return true; });
object->addProperty("disableWithMouse", [] { return false; });
@ -86,7 +86,7 @@ struct TouchpadTest : ::testing::Test
{
if (!settings::testing::hasSessionBus())
GTEST_SKIP() << "no session bus";
service.emplace("com.cutefish.Touchpad1", [this](dbus::Connection& bus) { return serve(bus, fake); });
service.emplace("org.cutefish.Touchpad1", [this](dbus::Connection& bus) { return serve(bus, fake); });
ASSERT_TRUE(service->start());
}
@ -95,7 +95,7 @@ struct TouchpadTest : ::testing::Test
if (!service)
return;
service.reset();
settings::testing::waitForNameGone("com.cutefish.Touchpad1");
settings::testing::waitForNameGone("org.cutefish.Touchpad1");
}
FakeTouchpad fake;

Loading…
Cancel
Save