[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-development
Subject:    [haiku-development] Re: Help regarding GSoC idea : Tracker add-on for a version control system
From:       Hrishi Hiraskar <hrishihiraskar () gmail ! com>
Date:       2018-03-27 4:51:09
Message-ID: CAANq6A1zfJ45ca68HPj8nmB5N1VAsxcEg-DgqVfCo+t_iCsAxw () mail ! gmail ! com
[Download RAW message or body]

Hi Rene

I was able to pass the top level menu to the add on and was able to
manipulate it.

Thank you for your valuable guidance.
This code was necessary for my GSoC proposal.

Regards
Hrishikesh Hiraskar

On Tue, Mar 27, 2018 at 12:04 AM Rene Gollent <anevilyak@gmail.com> wrote:

> On Mon, Mar 26, 2018 at 2:22 PM, Hrishi Hiraskar
> <hrishihiraskar@gmail.com> wrote:
> > But now that I can call `populate_menu (entry_ref dir_ref, BMessage *msg,
> > BMenuItem* item)`,  where I'm passing the BMenuItem of the add on item
> > created at
> > 
> https://github.com/Hrily/haiku/blob/63ede39cc8b8149b906969666c0f1bc7ad80193c/src/kits/tracker/ContainerWindow.cpp#L235
> 
> > 
> > I can neither access `item->Submenu()` nor `item->Menu()`. Both turned
> out
> > to be null.
> 
> A BMenuItem won't have a Submenu() unless it was constructed with one
> (c.f.
> https://git.haiku-os.org/haiku/tree/headers/os/interface/MenuItem.h#n26
> ). So you may need to make further changes/additions to the API here
> in order for you to be able to do that. The Menu() call returns a
> pointer to the parent menu that the item is part of in any case, and
> it hasn't yet been added to one at the point where this code is being
> called, hence getting NULL in both cases. In this case though, since
> I'm guessing you want to be able to add items to the top level context
> menu itself rather than the add-ons submenu anyways. As such, you may
> want to take a slightly different approach here, where either the
> add-on API is extended to add another call that can be passed the top
> level menu so that the add-on can then manipulate it directly, or
> alternatively a call that allows the add-on to return a list of items
> rather than being given one up front to modify as was previously the
> case.
> 
> Regards,
> 
> Rene
> 
> 


[Attachment #3 (text/html)]

<div dir="ltr"><div><div><div><div><div>Hi Rene<br><br></div>I was able to pass the \
top level menu to the add on and was able to manipulate it.<br><br></div>Thank you \
for your valuable guidance.<br></div>This code was necessary for my GSoC \
proposal.<br><br></div>Regards<br></div>Hrishikesh \
Hiraskar<br><div><div><div><div><div><div><div><div><br><div class="gmail_quote"><div \
dir="ltr">On Tue, Mar 27, 2018 at 12:04 AM Rene Gollent &lt;<a \
href="mailto:anevilyak@gmail.com">anevilyak@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Mar 26, 2018 at 2:22 PM, \
Hrishi Hiraskar<br> &lt;<a href="mailto:hrishihiraskar@gmail.com" \
target="_blank">hrishihiraskar@gmail.com</a>&gt; wrote:<br> &gt; But now that I can \
call `populate_menu (entry_ref dir_ref, BMessage *msg,<br> &gt; BMenuItem* item)`,   \
where I&#39;m passing the BMenuItem of the add on item<br> &gt; created at<br>
&gt; <a href="https://github.com/Hrily/haiku/blob/63ede39cc8b8149b906969666c0f1bc7ad80193c/src/kits/tracker/ContainerWindow.cpp#L235" \
rel="noreferrer" target="_blank">https://github.com/Hrily/haiku/blob/63ede39cc8b8149b906969666c0f1bc7ad80193c/src/kits/tracker/ContainerWindow.cpp#L235</a><br>
 &gt;<br>
&gt; I can neither access `item-&gt;Submenu()` nor `item-&gt;Menu()`. Both turned \
out<br> &gt; to be null.<br>
<br>
A BMenuItem won&#39;t have a Submenu() unless it was constructed with one<br>
(c.f. <a href="https://git.haiku-os.org/haiku/tree/headers/os/interface/MenuItem.h#n26" \
rel="noreferrer" target="_blank">https://git.haiku-os.org/haiku/tree/headers/os/interface/MenuItem.h#n26</a><br>
 ). So you may need to make further changes/additions to the API here<br>
in order for you to be able to do that. The Menu() call returns a<br>
pointer to the parent menu that the item is part of in any case, and<br>
it hasn&#39;t yet been added to one at the point where this code is being<br>
called, hence getting NULL in both cases. In this case though, since<br>
I&#39;m guessing you want to be able to add items to the top level context<br>
menu itself rather than the add-ons submenu anyways. As such, you may<br>
want to take a slightly different approach here, where either the<br>
add-on API is extended to add another call that can be passed the top<br>
level menu so that the add-on can then manipulate it directly, or<br>
alternatively a call that allows the add-on to return a list of items<br>
rather than being given one up front to modify as was previously the<br>
case.<br>
<br>
Regards,<br>
<br>
Rene<br>
<br>
</blockquote></div></div></div></div></div></div></div></div></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic