Wireshark-dev: Re: [Wireshark-dev] How do I initialise a boolean preference
From: skydiver <skydiver@xxxxxxxxx>
Date: Mon, 22 Jan 2007 16:39:49 +0100 (CET)
Hi,

Question: is our preference already in the preferences file?
Then your default gets overwritten by this stored value. The default is
default only when the preference is newly introduced.

Thanx,
Jaap

On Mon, 22 Jan 2007, Hal Lander wrote:

> I start Wireshark (don't open a file or anything).
> My dissector's proto_reg_handoff routine is called.
> In the code that runs only once I initialise a variable
>     static gboolean prefTick
> to TRUE, and register the preference.
> Before returning the variable is printed out and it is TRUE.
>
> My dissector's proto_reg_handoff routine is called a second time (I have not
> done anything in the Wireshark window yet).
> Before returning the variable prefTick is printed out and it is FALSE.
>
> In Wireshark I edit the preferences for my protocol, I can see my tick box
> and it is unticked.
> I tick the box and apply it.
> My dissector's proto_reg_handoff routine is called
> Before returning the variable prefTick is printed out and it is TRUE.
>
> My question are;
> 1. Why is my proto_reg_handoff routine being called twice initially?
> 2. Why does the second call set my preference to FALSE?
> 3. How do I get the tick box to default to TRUE initially (which is what i
> was trying to do) ?
>
> It looks as though the code is working apart from not having the right
> initial value.
>
> TIA
> Hal
>
> _________________________________________________________________
> Valentine?s Day -- Shop for gifts that spell L-O-V-E at MSN Shopping
> http://shopping.msn.com/content/shp/?ctId=8323,ptnrid=37,ptnrdata=24095&tcode=wlmtagline
>
>