discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GWorkspace openFile & ImageViewer


From: Richard Frith-Macdonald
Subject: Re: GWorkspace openFile & ImageViewer
Date: Wed, 09 Apr 2003 12:34:22 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030327 Debian/1.3-4

Marko Riedel wrote:

Hi folks,

I am trying to get GPSText to open PS and PDF files when they are
double-clicked in the workspace browser. This was suggested to me by
Nicolas Roard.

I found that GWorkspace launches the application correctly, but it
repeats the file name among the command line arguments. My application
parses these as well, so that it opens the file twice. (I could fix
this by checking whether the file has already been opened, but I would
prefer to understand what exactly is happening.) I have also noticed
that GWorkspace tries to lauch a second copy of the application when I
click on a second file, whereas it should message the process that is
already running to open the file.

I was curious to know whether my code was the problem, so I compiled
and installed ImageViewer. It seems to have the same problem: open a
TIFF file and the app launches, open a second file and GWorkspace does
not message the process that is already running and tries to launch
another copy of ImageViewer instead.
Maybe someone can help me out here.

The application delegate (in your case it's your Controller class) needs to support the standard file handling methods which the workspace will send to it to ask it to handle a file operation.

These are ...
-application:openFile:
-application:openFileWithoutUI:
-application:openTempFile:
-application:printFile:

Just to get it to open files from GWorkspace you probably only need to implement the first of these.

You also need to have GPSTextInfo.plist contain information telling the system which file extensions the application is able to open ... if the app is installed in one of the standard locations (make install should do that) and the make_services tool is run to update the caches, then NSWorkspace should know to use it to open the files, and should send the -application:openFile: message to it.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]