[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GWorkspace openFile & ImageViewer
From: |
Marko Riedel |
Subject: |
Re: GWorkspace openFile & ImageViewer |
Date: |
Wed, 9 Apr 2003 14:10:57 +0200 (CEST) |
Hi there,
Enrico Sersale writes:
>
> On Tue, 8 Apr 2003, 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.
> >
[SNIP]
>
> No, GWorkspace doesn't launch anything.
> It only gets the "right" application name for the file from NSWorkspace
> (getInfoForFile:application:type:), does some icon animation if this is
> choosed in the preferences and then calls the NSWorkspace method
> -openFile:withApplication:
> It is NSWorkspace that keeps in "_launched" an array of the apps it has
> launched, not GWorkspace.
>
> An other (related?) problem: some apps, I've tried with Gorm and Ink,
> don't open a second file if a file is already open.
> For example, try:
>
> gopen a.rtf
>
> "a" is loaded and shown.
>
> gopen b.rtf
>
> "b" is not open.
>
> Adding a NSLog in -loadFileWrapperRepresentation:ofType: shows that, the
> second time, this method is not called.
>
>
[SNIP]
I looked at NSWorkspace.m and its use of _launched (dictionary).
1. NSWorkspace invokes _connectApplication in order to open a file.
2. It seems it is looking for a named port (application name minus
extension) to talk to the application. Does NSApplication implement
this, i.e. does it listen on this port? What sort of messages
(selectors) can be invoked over this type of connection?
3. I guess that the current implementation never establishes a
connection. NSWorkspace then launches the application with the file
as a command line argument (line 442). This explains why it launches
the same application more than once, i.e. one for every file.
4. NSWorkspace consults _launched, but the code shows that the
contents of this dictionary do not affect which app
_connectApplication returns.
Maybe we should implement listening behavior in NSApplication? This
would make _launched superfluous, at least where opening files are
concerned. If there is an app at the named port, message it, else
launch it, then message.
These are just some ideas. I don't know my way around NSWorkspace yet.
Best regards,
--
+------------------------------------------------------------+
| Marko Riedel, EDV Neue Arbeit gGmbH, mriedel@neuearbeit.de |
| http://www.geocities.com/markoriedelde/index.html |
+------------------------------------------------------------+
- GWorkspace openFile & ImageViewer, Marko Riedel, 2003/04/08
- Re: GWorkspace openFile & ImageViewer, Enrico Sersale, 2003/04/09
- Re: GWorkspace openFile & ImageViewer,
Marko Riedel <=
- Re: GWorkspace openFile & ImageViewer, Richard Frith-Macdonald, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Marko Riedel, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Richard Frith-Macdonald, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Enrico Sersale, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Alexander Malmberg, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Enrico Sersale, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Richard Frith-Macdonald, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Alexander Malmberg, 2003/04/09
- Re: GWorkspace openFile & ImageViewer, Matt Rice, 2003/04/10