Hey Michael,<br><br>Did you try applying Sayamindu&#39;s patch from the previous email (and did you see the associated screenshot)?<br><br>I&#39;m surprised it hasn&#39;t been cleaned up and pushed by the Sugar dev team by now.<br>
<br>-Wade<br><br><div class="gmail_quote">On Sun, Jan 4, 2009 at 5:55 PM, Michael Stone <span dir="ltr">&lt;<a href="mailto:michael@laptop.org">michael@laptop.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Sat, Jan 03, 2009 at 02:23:41PM -0500, Chris Marshall wrote:<br>
&gt;Two specific questions come to mind:<br>
&gt;<br>
&gt;(1) How does Sugar know that a new top level<br>
&gt; &nbsp; &nbsp; window has been instantiated? &nbsp;Is there a<br>
&gt; &nbsp; &nbsp; hook from the X server or what?<br>
<br>
</div>Here&#39;s a short code tour for your enjoyment. I&#39;ll start by tracing<br>
backwards from what we know:<br>
<br>
1. Clone the sugar source code:<br>
<br>
 &nbsp; git clone git://<a href="http://git.sugarlabs.org/sugar/mainline.git" target="_blank">git.sugarlabs.org/sugar/mainline.git</a> sugar<br>
<br>
2. We know that things including gray circles appear in the top part of<br>
the frame. What causes this?<br>
<br>
 &nbsp; cd sugar<br>
 &nbsp; find . -name &#39;*frame*&#39;<br>
 &nbsp; # Inspiration!<br>
 &nbsp; cd src/jarabe/frame<br>
<br>
3. Start reading files here looking for info about how the frame is<br>
constructed.<br>
<br>
 &nbsp; Ah hah! We find out from src/jarabe/frame/frame.py that the frame<br>
 &nbsp; consists of four panels.<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line117" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line117</a><br>

<br>
 &nbsp; What goes in the top panel? Read _create_top_panel():<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line177" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line177</a><br>

<br>
 &nbsp; Bingo! An ActivitiesTray()!<br>
<br>
4. Go find ActivitiesTray():<br>
<br>
 &nbsp; First, search for &quot;ActivitiesTray&quot;. Find the import line at<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line29" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line29</a><br>

<br>
 &nbsp; Next, go read src/jarabe/frame/activitiestray.py looking for the<br>
 &nbsp; definition of ActivitiesTray()<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line299" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line299</a><br>

<br>
5. Figure out what message causes the tray to add icons.<br>
<br>
 &nbsp; Doesn&#39;t that __activity_added_cb() callback look suspicious?<br>
<br>
 &nbsp; Let&#39;s figure out what causes self._home_model to generate<br>
 &nbsp; &#39;activity-added&#39; signals.<br>
<br>
6. Track down self._home_model.<br>
<br>
 &nbsp; Ah! In ActivitiesTray.__init__, we set it equal to shell.get_model().<br>
<br>
 &nbsp; Where does the variable &quot;shell&quot; come from? From here:<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line39" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line39</a><br>

<br>
7. Track down &#39;get_model&#39; in src/jarabe/model/shell.py<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line573" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line573</a><br>

<br>
 &nbsp; So what&#39;s a ShellModel?<br>
<br>
8. Look more carefully at ShellModel.<br>
<br>
 &nbsp; We find the definition of the &#39;activity-added&#39; signal here:<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line282" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line282</a><br>

<br>
 &nbsp; alongside several other tasty-sounding signals.<br>
<br>
 &nbsp; ...<br>
<br>
 &nbsp; Oooh, look at the __init__ method:<br>
<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line310" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line310</a><br>

<br>
 &nbsp; Doesn&#39;t that &quot;window-open&quot; signal sound interesting?<br>
<br>
9. Review.<br>
<br>
 &nbsp; We&#39;ve pretty much figured out the chain of events that results in the<br>
 &nbsp; appearance of a new button on the frame&#39;s top panel&#39;s activities tray.<br>
<br>
 &nbsp; Moreover, while we still don&#39;t really know why the buttons sometimes<br>
 &nbsp; display gray circles vs activity icons or how to remove a button, we<br>
 &nbsp; can be fairly sure that the answers lie close by, e.g.<br>
<br>
 &nbsp; (where the gray circles come from:)<br>
 &nbsp; <a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line67" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line67</a><br>

<br>
 &nbsp; and back in jarabe.model.shell.ShellModel, which seems to be driving<br>
 &nbsp; the show w.r.t. to the display and removal of items in the<br>
 &nbsp; ActivitiesTray.<br>
<br>
10. Forward.<br>
<br>
 &nbsp; The questions which remain include:<br>
<br>
 &nbsp; &nbsp; a) What things are driving the ShellModel? Are they doing so<br>
 &nbsp; &nbsp; correctly?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;hint: nope. read<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line434" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line434</a><br>

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt" target="_blank">http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt</a><br>

<br>
 &nbsp; &nbsp; &nbsp; &nbsp;(also, please help me get the ideas in the patches at the top of<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://dev.laptop.org/git/users/mstone/sugar" target="_blank">http://dev.laptop.org/git/users/mstone/sugar</a> and<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://dev.laptop.org/git/users/mstone/sugar-toolkit" target="_blank">http://dev.laptop.org/git/users/mstone/sugar-toolkit</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp;merged which, while they won&#39;t solve your problem, may still be<br>
 &nbsp; &nbsp; &nbsp; &nbsp;generally useful.)<br>
<br>
 &nbsp; &nbsp; b) What icon data should we be feeding into those buttons? Where<br>
 &nbsp; &nbsp; does it come from?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;hint: read<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://standards.freedesktop.org/wm-spec/latest/" target="_blank">http://standards.freedesktop.org/wm-spec/latest/</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://standards.freedesktop.org/wm-spec/latest/ar01s05.html#id2569669" target="_blank">http://standards.freedesktop.org/wm-spec/latest/ar01s05.html#id2569669</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp;and start asking questions.<br>
<br>
Hope this helps,<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.laptop.org">Devel@lists.laptop.org</a><br>
<a href="http://lists.laptop.org/listinfo/devel" target="_blank">http://lists.laptop.org/listinfo/devel</a><br>
</div></div></blockquote></div><br>