Bugzilla – Bug 1516
GtkConfigStore does not show read-only attributes
Last modified: 2012-12-07 12:16:28 EST
Currently, the GtkConfigStore does not show at all read-only attributes. I think it would be nice to have GtkConfigStore to show read-only attributes for inspection purposes, or even just for information purposes. One use case is in the LTE model where there are some IDs exported as read-only attributes, since they are assigned automatically and not meant to be set by the user. I noticed that the lack for visualization of read-only attributes in GtkConfigStore has caused at least once someone to make a read-only attribute settable, only for the purpose of showing it up in GtkConfigStore, even if the attribute itself was not meant to be set at all.
Created attachment 1458 [details] tentative patch Here is a tentative patch to fix the problem. It achieves the purposes, i.e., read-only attributes show up on GtkConfigStore. I didn't test it with anything else, hence I am not sure that it does not break any other config-store functionality.
Looks good to me to commit. We don't have an automated test for GtkConfigStore, however.
I applied the patch. I need to know a read only attribute that I should now be able to see.
The patch does not work for me. I added these lines: GtkConfigStore outputConfig; outputConfig.ConfigureDefaults (); outputConfig.ConfigureAttributes (); to this tutorial example: examples/tutorial/second.cc When I run the code and the attribute GUI is open, I am not able to see these read-only attributes, which are indicated by this TypeId::ATTR_GET: static TypeId tid = TypeId ("ns3::WaypointMobilityModel") .SetParent<MobilityModel> () .SetGroupName ("Mobility") .AddConstructor<WaypointMobilityModel> () .AddAttribute ("NextWaypoint", "The next waypoint used to determine position.", TypeId::ATTR_GET, WaypointValue (), MakeWaypointAccessor (&WaypointMobilityModel::GetNextWaypoint), MakeWaypointChecker ()) .AddAttribute ("WaypointsLeft", "The number of waypoints remaining.", TypeId::ATTR_GET, UintegerValue (0), MakeUintegerAccessor (&WaypointMobilityModel::WaypointsLeft), MakeUintegerChecker<uint32_t> ()) Maybe I don't understand how to know which ones are read-only.
I've just pushed the following changeset to enable one such attribute (it was previously commented out, I guess because it did not show up on GtkConfigStore so it seemed to be not working): changeset: 9172:2d6235af7a36 tag: tip user: Nicola Baldo <nbaldo@cttc.es> date: Fri Dec 07 11:12:43 2012 +0100 summary: uncommented LteUeNetDevice::Imsi attribute I've tested it with src/lte/examples/lena-simple.cc by uncommenting the lines that enable GtkConfigStore. The attribute path is /NodeList/1/DeviceList/0/Imsi
Created attachment 1481 [details] screenshot GtkConfigStore before patch
Created attachment 1482 [details] screenshot GtkConfigStore after patch I've just attached two screenshot showing the behavior before and after the patch.
(In reply to comment #0) > Currently, the GtkConfigStore does not show at all read-only attributes. > > I think it would be nice to have GtkConfigStore to show read-only attributes > for inspection purposes, or even just for information purposes. One use case > is in the LTE model where there are some IDs exported as read-only > attributes, since they are assigned automatically and not meant to be set by > the user. > > I noticed that the lack for visualization of read-only attributes in > GtkConfigStore has caused at least once someone to make a read-only > attribute settable, only for the purpose of showing it up in GtkConfigStore, > even if the attribute itself was not meant to be set at all.