mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 15:14:38 +01:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Benjamin Tissoires
parent
04b54d26e2
commit
f281bd751e
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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", "")
|
||||
|
||||
Reference in New Issue
Block a user