Re: No Service matching 'OpenURL'
Patrick Cardona <[email protected]> Tue, 02 Dec 2025 16:55:40 +0100
| Newsgroups | gmane.comp.lib.gnustep.general |
|---|---|
| Message-ID | <23fca20c9720bdf843faf75e5bd70c8c@pi400> |
Hello, As we already discussed about the needed service to provide an openURL action, I tried to set some... - First stage: trying to get a working service to open an URL selected in a text. But it is not yet successful. I have not the error message, "Failed to contact service provider for 'Open URL'", but nothing happens when I use the menu "Services > Open URL". I am attaching a basis of that work: <GNUmakefile><openURLServiceInfo.plist><service.m> Maybe you will find something obvious I am not able to see. On 2025-10-05 19:47:45 +0200 Patrick Cardona <[email protected]> wrote: > Hello, > > When I click on a web link from GNUMail... I note this behaviour: > > 1) The Chromium Web Browser is launching with a new blank tab; > 2) An alert panel says: "No Service matching 'OpenURL'" > 3) When I close this panel, the clicked URL is finally opened in a > new tab of > Chromium. > > What am I missing to avoid this alert panel: a service? > (...) Regards, Patrick -- Patrick Cardona - Pi400 - GNU/Linux aarch64 (Debian 13.2) Xorg (1:7.7+24) - libcairo2 (1.18.4-1+rpt1 arm64) Window Maker (0.96.0-4) - GWorkspace (1.1.0 - 02 2025) - Theme: AGNOSTEP - MUA: GNUMail (1.4.0)
GNUmakefile
(application/octet-stream, 152 B) - not displayed
openURLServiceInfo.plist
(application/octet-stream, 206 B) - not displayed
service.m
(text/plain, 774 B)
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@interface OpenURLService : NSObject
@end
@implementation OpenURLService
- (void)openURL:(NSPasteboard *)pboard
userData:(NSString *)userData
error:(NSString **)error
{
NSString *url = [pboard stringForType:NSStringPboardType];
if (url) {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
}
}
@end
int main(int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
OpenURLService *service = [[OpenURLService alloc] init];
[NSApp setServicesProvider:service];
[service release];
[NSApp run];
[pool release];
return 0;
}