mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 15:14:38 +01:00
ratbagd: remove GetResolutionByIndex
This is superfluous, it's trivial enough to get the Resolutions 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
70f3da98db
commit
7097f1dea6
@@ -302,27 +302,6 @@ static int ratbagd_profile_set_active(sd_bus_message *m,
|
||||
ratbag_profile_set_active(profile->lib_profile));
|
||||
}
|
||||
|
||||
static int ratbagd_profile_get_resolution_by_index(sd_bus_message *m,
|
||||
void *userdata,
|
||||
sd_bus_error *error)
|
||||
{
|
||||
struct ratbagd_profile *profile = userdata;
|
||||
struct ratbagd_resolution *resolution;
|
||||
unsigned int index = 0;
|
||||
int r;
|
||||
|
||||
r = sd_bus_message_read(m, "u", &index);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (index >= profile->n_resolutions || !profile->resolutions[index])
|
||||
return 0;
|
||||
|
||||
resolution = profile->resolutions[index];
|
||||
return sd_bus_reply_method_return(m, "o",
|
||||
ratbagd_resolution_get_path(resolution));
|
||||
}
|
||||
|
||||
const sd_bus_vtable ratbagd_profile_vtable[] = {
|
||||
SD_BUS_VTABLE_START(0),
|
||||
SD_BUS_PROPERTY("Index", "u", NULL, offsetof(struct ratbagd_profile, index), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
@@ -331,7 +310,6 @@ const sd_bus_vtable ratbagd_profile_vtable[] = {
|
||||
SD_BUS_PROPERTY("Leds", "ao", ratbagd_profile_get_leds, 0, 0),
|
||||
SD_BUS_PROPERTY("IsActive", "b", ratbagd_profile_is_active, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||
SD_BUS_METHOD("SetActive", "", "u", ratbagd_profile_set_active, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||
SD_BUS_METHOD("GetResolutionByIndex", "u", "o", ratbagd_profile_get_resolution_by_index, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||
SD_BUS_VTABLE_END,
|
||||
};
|
||||
|
||||
|
||||
@@ -347,11 +347,6 @@ class RatbagdProfile(_RatbagdDBus):
|
||||
"""Set this profile to be the active profile."""
|
||||
return self._dbus_call("SetActive", "")
|
||||
|
||||
def get_resolution_by_index(self, index):
|
||||
"""Returns the resolution found at the given index. This function
|
||||
returns a RatbagdResolution or None if no resolution was found."""
|
||||
return self._dbus_call("GetResolutionByIndex", "u", index)
|
||||
|
||||
|
||||
class RatbagdResolution(_RatbagdDBus):
|
||||
"""Represents a ratbagd resolution."""
|
||||
|
||||
Reference in New Issue
Block a user