From f281bd751ec235a56c27ae703b7484ad1b9cf7b2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Jul 2017 09:11:56 +1000 Subject: [PATCH] ratbagd: drop 'GetProfileByIndex' This is superfluous, it's trivial enough to get the Profiles property and then work with that. We're not talking about a huge amount of data anyway. Signed-off-by: Peter Hutterer --- DBusInterface.md | 6 ------ ratbagd/ratbagd-device.c | 22 ---------------------- tools/ratbagd.py | 8 -------- 3 files changed, 36 deletions(-) diff --git a/DBusInterface.md b/DBusInterface.md index 8ed7cd4b..a94729e6 100644 --- a/DBusInterface.md +++ b/DBusInterface.md @@ -84,12 +84,6 @@ profiles. Provides the list of profile paths for all profiles on this device, see **org.freedesktop.ratbag1.Profile**. -### Methods - -#### `GetProfileByIndex(u) → (o)` - -Returns the object path for the profile with the given index - #### `Commit() → ()` Commits the changes to the device. Changes to the device are batched; they diff --git a/ratbagd/ratbagd-device.c b/ratbagd/ratbagd-device.c index 65e77485..ebc88426 100644 --- a/ratbagd/ratbagd-device.c +++ b/ratbagd/ratbagd-device.c @@ -214,27 +214,6 @@ static int ratbagd_device_get_profiles(sd_bus *bus, return sd_bus_message_close_container(reply); } -static int ratbagd_device_get_profile_by_index(sd_bus_message *m, - void *userdata, - sd_bus_error *error) -{ - struct ratbagd_device *device = userdata; - struct ratbagd_profile *profile; - unsigned int index; - int r; - - r = sd_bus_message_read(m, "u", &index); - if (r < 0) - return r; - - if (index >= device->n_profiles || !device->profiles[index]) - return -ENXIO; - - profile = device->profiles[index]; - return sd_bus_reply_method_return(m, "o", - ratbagd_profile_get_path(profile)); -} - static int ratbagd_device_commit(sd_bus_message *m, void *userdata, sd_bus_error *error) @@ -298,7 +277,6 @@ const sd_bus_vtable ratbagd_device_vtable[] = { SD_BUS_PROPERTY("Name", "s", ratbagd_device_get_device_name, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Svg", "s", ratbagd_device_get_svg, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Profiles", "ao", ratbagd_device_get_profiles, 0, SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_METHOD("GetProfileByIndex", "u", "o", ratbagd_device_get_profile_by_index, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetSvg", "s", "s", ratbagd_device_get_theme_svg, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("Commit", "", "u", ratbagd_device_commit, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_VTABLE_END, diff --git a/tools/ratbagd.py b/tools/ratbagd.py index fbbcbdbe..bc2b157a 100644 --- a/tools/ratbagd.py +++ b/tools/ratbagd.py @@ -292,14 +292,6 @@ class RatbagdDevice(_RatbagdDBus): """ return self._dbus_call("GetSvg", "s", theme) - def get_profile_by_index(self, index): - """Returns the profile found at the given index, or None if no profile - was found. - - @param index The index to find the profile at, as int - """ - return self._dbus_call("GetProfileByIndex", "u", index) - def commit(self): """Commits all changes made to the device.""" return self._dbus_call("Commit", "")