Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > possible to "move" services?

possible to "move" services?
Thread Tools
Forum Regular
Join Date: Jul 2002
Location: eimsbusch
Status: Offline
Reply With Quote
Sep 30, 2002, 05:37 AM
 
hi,

i'm wondering if it's possible to move (or rather copy) services out of the services submenu and into a dedicated menu item in the menubar.

the idea is as follows:

upon launch, we check if certain services are installed
if so, we implement a "tools" menu which holds these services

is that possible? if so - how?

i feel like this may be against the ui-guidelines, but i wouldn't care, since it would be of great benefit for the user.

thanx.

m
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 03:57 AM
 
Should be possible. Make an app with a NSUIElement of 1 in its Info.plist so it has no dock icon, and have it create and maintain an NSStatusItem to be the "Tools" menu. The contents of that menu can then be linked to the available services using NSApplication's setServicesMenu: method.
[vash:~] banana% killall killall
Terminated
     
kzmk  (op)
Forum Regular
Join Date: Jul 2002
Location: eimsbusch
Status: Offline
Reply With Quote
Oct 1, 2002, 04:11 AM
 
Originally posted by Gul Banana:
Should be possible. Make an app with a NSUIElement of 1 in its Info.plist so it has no dock icon, and have it create and maintain an NSStatusItem to be the "Tools" menu. The contents of that menu can then be linked to the available services using NSApplication's setServicesMenu: method.
uhm, maybe i put it wrong in my initial post...

we're in the process of creating a texteditor.
there are a bunch of services available which work on text. like "summarize", wordservice, leolookup, etc.

what we'd like to do is the following: check if these services are installed, and if so, place them in a "tools" menu. we don't want all the installed services in that menu, since we don't need the grab.service in our app, for example. we just want a range of selected services accessible through a tools-menu rather than the services submenu.

so?
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 04:20 AM
 
Ah. Different kettle of fish. For anyone interested in the answer to the original question (which may or may not help you guys) my implementation of it is at http://homepage.mac.com/castiglione/...rvicesMenu.sit (10 KB).

For your current question, [NSApplication setServicesMenu:] is not what you want because that will get all of them impartially. Just let me do a bit of research, and I'll see if there's an easy way to do what you want...
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 04:31 AM
 
Well, there's no API for it, I'm afraid... at least, not at the higher levels. You can't request a list of services, only specify a menu to be populated with the ones that there are and validate what objects they should apply to. If you were to delve into the CoreFoundation or subclass NSApplication or NSMenu I would speculate that there might be a way to pretend you were a menu and thus get a list of services.. actually, here's an idea:
For your Tools menu, use a custom subclass of NSMenu which, instead of displaying disabled items as greyed out, does not display them at all. That should have the effect you're looking for, if you then make that the application's servicesMenu.
[vash:~] banana% killall killall
Terminated
     
kzmk  (op)
Forum Regular
Join Date: Jul 2002
Location: eimsbusch
Status: Offline
Reply With Quote
Oct 1, 2002, 05:01 AM
 
Originally posted by Gul Banana:
Well, there's no API for it, I'm afraid... at least, not at the higher levels. You can't request a list of services, only specify a menu to be populated with the ones that there are and validate what objects they should apply to. If you were to delve into the CoreFoundation or subclass NSApplication or NSMenu I would speculate that there might be a way to pretend you were a menu and thus get a list of services.. actually, here's an idea:
For your Tools menu, use a custom subclass of NSMenu which, instead of displaying disabled items as greyed out, does not display them at all. That should have the effect you're looking for, if you then make that the application's servicesMenu.
uh, great idea.
not exactly what we're looking for, but it might be a nice compromise.
the only problem i see is that by implementing such a menu, we pretend that its contents are provided by our app. so if some services don't play nice (disk copy comes to mind), we end up with a confusing number and selection of services, and the users will hold us responsible for that...

but i'll look into it. thanx alot.
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 05:10 AM
 
That's true, although one could argue that it seems a bit deceptive, anyway, to pretend that third-party services are a feature of your application
[vash:~] banana% killall killall
Terminated
     
kzmk  (op)
Forum Regular
Join Date: Jul 2002
Location: eimsbusch
Status: Offline
Reply With Quote
Oct 1, 2002, 05:30 AM
 
Originally posted by Gul Banana:
That's true, although one could argue that it seems a bit deceptive, anyway, to pretend that third-party services are a feature of your application
we would, of course, give full credit.

i still feel that it would be nice to do it like we intended. the user shouldn't need to care if *we+ provide a certain functionality or if we simply take advantage of other apps' features.

another idea: what if we know *for sure* that a service is installed? say... "summarize". would it be possible to call this service through our own menu?
i'm thinking about bundling the services we feel interesting anyway...
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 06:09 AM
 
That's possible. Just have a look at the Service API and call the service's methods yourself, instead of getting the OS to do it.
[vash:~] banana% killall killall
Terminated
     
kzmk  (op)
Forum Regular
Join Date: Jul 2002
Location: eimsbusch
Status: Offline
Reply With Quote
Oct 2, 2002, 06:09 AM
 
Originally posted by Gul Banana:
That's possible. Just have a look at the Service API and call the service's methods yourself, instead of getting the OS to do it.
great. thanx.

btw: what a small world... you're the guy that did "focuslayer", right?
any progress on the blurring-idea yet?
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 2, 2002, 07:37 AM
 
I am, and unfortunately, my time being limited, I haven't implemented that yet - I'm concentrating on other projects and on fixing the remaining bugs with floating windows.
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: May 2001
Location: NYC
Status: Offline
Reply With Quote
Oct 2, 2002, 11:41 AM
 
Check out ICeCoffEE.

It's very nice.
     
kzmk  (op)
Forum Regular
Join Date: Jul 2002
Location: eimsbusch
Status: Offline
Reply With Quote
Oct 16, 2002, 02:53 AM
 
Originally posted by Gul Banana:
That's possible. Just have a look at the Service API and call the service's methods yourself, instead of getting the OS to do it.
ok, we looked into our possibilities, and decided to not do it that way. we'd have to provide a pretty intelligent installer for the services to ensure that we're not messing up stuff - no go...

so... is it possible to make, say, a subdirectory in our .app-package, name it "services" and use the services from within our app?

that'd be cool, i guess, and i wouldn't bother about doubled services (one in our menu, one in the services menu).

works?

greetz
m
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 16, 2002, 11:21 PM
 
It's possible. Have a look at NSBundle(NSNibLoadingAdditions).h, load the service bundle, and then pretend to its main class that you're what it plugs into.
[vash:~] banana% killall killall
Terminated
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:51 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2