Bug 1516 - GtkConfigStore does not show read-only attributes
GtkConfigStore does not show read-only attributes
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: config-store
ns-3-dev
All All
: P5 normal
Assigned To: Mitch Watrous
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-22 10:07 EDT by Nicola Baldo
Modified: 2012-12-07 12:16 EST (History)
2 users (show)

See Also:


Attachments
tentative patch (6.67 KB, patch)
2012-10-22 10:09 EDT, Nicola Baldo
Details | Diff
screenshot GtkConfigStore before patch (50.53 KB, image/png)
2012-12-07 05:29 EST, Nicola Baldo
Details
screenshot GtkConfigStore after patch (45.56 KB, image/png)
2012-12-07 05:29 EST, Nicola Baldo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Baldo 2012-10-22 10:07:27 EDT
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.
Comment 1 Nicola Baldo 2012-10-22 10:09:40 EDT
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.
Comment 2 Tom Henderson 2012-10-26 18:03:44 EDT
Looks good to me to commit.  We don't have an automated test for GtkConfigStore, however.
Comment 3 Mitch Watrous 2012-12-06 17:25:45 EST
I applied the patch.

I need to know a read only attribute that I should now be able to see.
Comment 4 Mitch Watrous 2012-12-06 21:35:18 EST
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.
Comment 5 Nicola Baldo 2012-12-07 05:28:01 EST
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
Comment 6 Nicola Baldo 2012-12-07 05:29:01 EST
Created attachment 1481 [details]
screenshot GtkConfigStore before patch
Comment 7 Nicola Baldo 2012-12-07 05:29:36 EST
Created attachment 1482 [details]
screenshot GtkConfigStore after patch

I've just attached two screenshot showing the behavior before and after the patch.
Comment 8 Mitch Watrous 2012-12-07 12:16:28 EST
(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.