diff options
author | Ingvar Stepanyan <rreverser@google.com> | 2021-07-13 19:31:17 +0000 |
---|---|---|
committer | Marcus Meissner <meissner@suse.de> | 2021-07-14 08:25:30 +0200 |
commit | c0a7de1cce4de66569b08eb5063bafe0ab0bac83 (patch) | |
tree | 4446c4ce6b99f15190b25e7c9540116ffc3a9241 /camlibs/ptp2/config.c | |
parent | 44fa56ff0432348762c8530905aff13bc95b1202 (diff) | |
download | libgphoto2-c0a7de1cce4de66569b08eb5063bafe0ab0bac83.tar.gz |
Mark properties without setters as readonly
Without this, widgets for things like "Serial Number", "Manufacturer", "Battery level" etc. would be created as writable, even though they are not.
It it possible to special case them in GUI frontends when rendering (e.g. by making everything under "status" section readonly anyway), but it seems better to return correct readonly status for such properties from libgphoto2 itself.
Diffstat (limited to 'camlibs/ptp2/config.c')
-rw-r--r-- | camlibs/ptp2/config.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 92e08ce0d..0f804505e 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -10743,6 +10743,9 @@ _get_config (Camera *camera, const char *confname, CameraWidget **outwidget, Cam GP_LOG_D ("Getting function prop '%s' / 0x%04x", cursub->label, cursub->type ); ret = cursub->getfunc (camera, &widget, cursub, NULL); + if (ret == GP_OK && cursub->putfunc == _put_None) { + gp_widget_set_readonly(widget, 1); + } if (mode == MODE_SINGLE_GET) { *outwidget = widget; free (setprops); @@ -10778,6 +10781,9 @@ _get_config (Camera *camera, const char *confname, CameraWidget **outwidget, Cam GP_LOG_D ("Failed to parse value of property '%s' / 0x%04x: error code %d", cursub->label, cursub->propid, ret); continue; } + if (cursub->putfunc == _put_None) { + gp_widget_set_readonly(widget, 1); + } if (mode == MODE_SINGLE_GET) { *outwidget = widget; free (setprops); @@ -10804,6 +10810,9 @@ _get_config (Camera *camera, const char *confname, CameraWidget **outwidget, Cam GP_LOG_D ("Failed to parse value of property '%s' / 0x%04x: error code %d", cursub->label, cursub->propid, ret); continue; } + if (cursub->putfunc == _put_None) { + gp_widget_set_readonly(widget, 1); + } if (mode == MODE_SINGLE_GET) { *outwidget = widget; free (setprops); |