Login  Register

Add menu item to Nautilus context menu on selected packages?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Add menu item to Nautilus context menu on selected packages?

MartinW
137 posts
Hi,
i have a tool that works on packages.
So far i added a wizard to the world menu, but i would rather add a menu item to the Nautilus context menu on selected packages - is this possible?

Best regards,
Martin.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Add menu item to Nautilus context menu on selected packages?

Benjamin Van Ryseghem (Pharo)
1320 posts
It is :)
And I would even say it is not complicated :P

Here is an example from Nautilus

AbstractNautilusUI class>>packagesMenu: aBuilder
<contextMenu>
<nautilusGlobalPackageMenu>
| package target |
target := aBuilder model.

(package := target selectedPackage) ifNil: [ ^ target ].
(aBuilder item: #'Browse scoped')
keyText: 'b, s' if: Nautilus useOldStyleKeys not;
action: [ target restrictedBrowsePackage ];
order: 1000;
help: 'Open a browser on a restricted view';
withSeparatorAfter.

:)

Ben

On 12 Nov 2013, at 15:41, MartinW <[hidden email]> wrote:

Hi,
i have a tool that works on packages.
So far i added a wizard to the world menu, but i would rather add a menu
item to the Nautilus context menu on selected packages - is this possible?

Best regards,
Martin.



--
View this message in context: http://forum.world.st/Add-menu-item-to-Nautilus-context-menu-on-selected-packages-tp4721406.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Add menu item to Nautilus context menu on selected packages?

MartinW
137 posts
Quite easy indeed. Thank you.
Is there any system behing the ordering of menu entries?

Martin.

Benjamin Van Ryseghem-2 wrote
It is :)
And I would even say it is not complicated :P

> So far i added a wizard to the world menu, but i would rather add a menu
> item to the Nautilus context menu on selected packages - is this possible?
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Add menu item to Nautilus context menu on selected packages?

Benjamin Van Ryseghem (Pharo)
1320 posts
You can give them a priority, then it depends of the other items :)

Ben

On 13 Nov 2013, at 17:31, MartinW <[hidden email]> wrote:

Quite easy indeed. Thank you.
Is there any system behing the ordering of menu entries?

Martin.


Benjamin Van Ryseghem-2 wrote
It is :)
And I would even say it is not complicated :P

So far i added a wizard to the world menu, but i would rather add a menu
item to the Nautilus context menu on selected packages - is this
possible?





--
View this message in context: http://forum.world.st/Add-menu-item-to-Nautilus-context-menu-on-selected-packages-tp4721406p4721787.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Add menu item to Nautilus context menu on selected packages?

MartinW
137 posts
In reply to this post by Benjamin Van Ryseghem (Pharo)
I have one follow-up question trying to understand how this works:
I see that <nautilusXXXMenu> is used in AbstractNautilusUI to build the menus — but why is <contextMenu> here? Also the code seems to work all the same without <contextMenu>?

Martin.

Benjamin Van Ryseghem-2 wrote
Here is an example from Nautilus

AbstractNautilusUI class>>packagesMenu: aBuilder
        <contextMenu>
        <nautilusGlobalPackageMenu>
        | package target |
        target := aBuilder model.

        (package := target selectedPackage) ifNil: [ ^ target ].
       
        (aBuilder item: #'Browse scoped')
                keyText: 'b, s' if: Nautilus useOldStyleKeys not;
                action: [ target restrictedBrowsePackage ];
                order: 1000;
                help: 'Open a browser on a restricted view';
                withSeparatorAfter.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Add menu item to Nautilus context menu on selected packages?

Benjamin Van Ryseghem (Pharo)
1320 posts
No idea …

I do not added it, so I can not tell

Ben

On 02 Dec 2013, at 15:25, MartinW <[hidden email]> wrote:

I have one follow-up question trying to understand how this works:
I see that <nautilusXXXMenu> is used in AbstractNautilusUI to build the
menus — but why is <contextMenu> here? Also the code seems to work all the
same without <contextMenu>?

Martin.


Benjamin Van Ryseghem-2 wrote
Here is an example from Nautilus

AbstractNautilusUI class>>packagesMenu: aBuilder

<contextMenu>

<nautilusGlobalPackageMenu>
| package target |
target := aBuilder model.

(package := target selectedPackage) ifNil: [ ^ target ].

(aBuilder item: #'Browse scoped')
keyText: 'b, s' if: Nautilus useOldStyleKeys not;
action: [ target restrictedBrowsePackage ];
order: 1000;
help: 'Open a browser on a restricted view';
withSeparatorAfter.





--
View this message in context: http://forum.world.st/Add-menu-item-to-Nautilus-context-menu-on-selected-packages-tp4721406p4726709.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.