Drop the writable-name capability

Make this implict - if the profile has a name, it's writable. Otherwise it's
not and you'll have to rely on the index or make up your own naming.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-02-20 14:11:43 +10:00
parent 5328c20a58
commit 32a5ad377e
8 changed files with 20 additions and 28 deletions

View File

@@ -407,7 +407,6 @@ hidpp10drv_read_profile(struct ratbag_profile *profile)
if (rc)
return;
ratbag_profile_set_cap(profile, RATBAG_PROFILE_CAP_WRITABLE_NAME);
if (hidpp10->profile_type != HIDPP10_PROFILE_UNKNOWN)
ratbag_profile_set_cap(profile, RATBAG_PROFILE_CAP_DISABLE);

View File

@@ -81,15 +81,6 @@ enum ratbag_error_code {
enum ratbag_profile_capability {
RATBAG_PROFILE_CAP_NONE = 0,
/**
* The device has the capability to write a name to a profile
* and store it in its flash.
*
* Any changes uploaded to the device will be cached in libratbag
* and will be committed to it after a commit only.
*/
RATBAG_PROFILE_CAP_WRITABLE_NAME = 100,
/**
* This profile can be assigned as the default profile. A default
* profile is the profile that is selected when the device
@@ -97,7 +88,7 @@ enum ratbag_profile_capability {
* profile, the device either picks last-used profile or a specific
* profile (usually the first).
*/
RATBAG_PROFILE_CAP_SET_DEFAULT,
RATBAG_PROFILE_CAP_SET_DEFAULT = 101,
/**
* The profile can be disabled and enabled. Profiles are not

View File

@@ -671,7 +671,7 @@ ratbag_create_profile(struct ratbag_device *device,
profile->index = index;
profile->num_resolutions = 0;
profile->is_enabled = true;
profile->name = asprintf_safe("Profile %d", index + 1);
profile->name = NULL;
list_insert(&device->profiles, &profile->link);
list_init(&profile->buttons);
@@ -1589,8 +1589,7 @@ ratbag_profile_set_name(struct ratbag_profile *profile,
{
char *name_copy;
if (!ratbag_profile_has_capability(profile,
RATBAG_PROFILE_CAP_WRITABLE_NAME))
if (!profile->name)
return RATBAG_ERROR_CAPABILITY;
name_copy = strdup_safe(name);