<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/22 Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>On 22 November 2013 21:20, Rogelio Mita <span dir="ltr"><<a href="mailto:rogeliomita@activitycentral.com" target="_blank">rogeliomita@activitycentral.com</a>></span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div><br><div class="gmail_quote">2013/11/22 Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Yes the callback is never executed because there is no python notification. And our test succeeds because it doesn't make sure that the callback is called.</blockquote></div><div class="gmail_extra"><br></div></div><div class="gmail_extra">
Ok, I see...</div><div class="gmail_extra"><br></div><div class="gmail_extra">I am watching <a href="https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/activity/webactivity.py#L89" target="_blank">https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/activity/webactivity.py#L89</a> and I can see if we are in standalone mode this fragment of code is not executed (obvious because the activity is not started from sugar) then we don't have <i>window.suga</i>r global var, and I think that it is good and need be maintained through all cycle (is understood?).</div>
<div class="gmail_extra">I mean, if you are in <i>standalone mode</i> you should not exist <i>"global" sugar var</i>, </div></div></div></blockquote><div><br></div></div><div>Yeah I think setting that variable is wrong. I probably know why I did it but I was just missing something. We should remove that... </div>
</div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>
</div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br><div dir="ltr"><div class="gmail_extra">
<div class="gmail_extra">and in the client side, the logic for <i><b>onStandalone</b></i> method <i>is check that sugar var existence</i>.</div>
<div class="gmail_extra">Because I noted the behaviour when <i>sugar var</i> don't exists on client side, <a href="https://github.com/sugarlabs/sugar-web/blob/master/env.js#L13" target="_blank">this fragment</a> creates this variable anyway and I do not understand why.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I propose remove this fragment at the moment and make a method activity.onStandalone (as was already discussed with Manu, I remember) and the logic can be: checks existence of sugar var, make sence?</div>
<span><font color="#888888">
</font></span></div><span></span></div></blockquote><div><br></div></div><div>I think I was the one suggesting to add an isStandalone method. But after looking into it a bit more I tend tothink it's better to make getEnvironment pass null to the callback, it should make it easier to write code that works in both modes.<br>
<br></div><div>About the logic, unfortunately checking window.sugar won't work because we can't assume window.sugar has been already set when getEnvironment is called... the python code you linked might be called after getEnvironment has been called and will erroneously think we are in standalone mode.<br>
</div></div></div></div></blockquote><div><br></div><div>you are right. I thought for a moment that this fragment is executed to begging before activity.setup(), I'm still in doubt, are you sure about this?</div><div>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div>
<br></div><div>That's why I suggested to check if window.location starts with activity://. It's a bit ugly but it will always work.<br></div></div></div></div>
</blockquote></div><br>Seems to be a good start, if I understand what you say, it would result there is no need to use callbacks in this method, ie: we can return object environment on sugar environment or null in other case, or better yet, ask to Environment model about the mode which is...</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">var environment = env.getEnvironment(), though it sounds redundant...</div><div class="gmail_extra"><br></div><div class="gmail_extra">OR!</div><div class="gmail_extra">
<br></div><div class="gmail_extra">var environment = activity.getEnvironment()</div><div class="gmail_extra">sounds better to me, and ask to environment object everything related to him</div>
<div class="gmail_extra"><div><br></div><div>You likes some these ideas?</div><div><br></div>-- <br>Roger<div><br><div><a href="http://activitycentral.com/" target="_blank">Activity Central</a></div></div>
</div></div>