From 7097f1dea6150ce00aab860330623ec84a079955 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Jul 2017 09:19:45 +1000 Subject: [PATCH] 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 --- ratbagd/ratbagd-profile.c | 22 ---------------------- tools/ratbagd.py | 5 ----- 2 files changed, 27 deletions(-) diff --git a/ratbagd/ratbagd-profile.c b/ratbagd/ratbagd-profile.c index adca758c..1ab3b28c 100644 --- a/ratbagd/ratbagd-profile.c +++ b/ratbagd/ratbagd-profile.c @@ -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, }; diff --git a/tools/ratbagd.py b/tools/ratbagd.py index 04d66a69..b71f8b98 100644 --- a/tools/ratbagd.py +++ b/tools/ratbagd.py @@ -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."""