gnustep-dev
[Top][All Lists]
Advanced

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

Re: Graceful termination again


From: Enrico Sersale
Subject: Re: Graceful termination again
Date: Fri, 27 Jan 2006 22:10:33 +0200

On 2006-01-27 20:14:40 +0200 Richard Frith-Macdonald <address@hidden> wrote:

On 27 Jan 2006, at 15:47, Enrico Sersale wrote:

[snip]

I still think it would be good to get round to implementing the capability of asking the workspace manager to perform operations centrally, but we need to think about defining the api/protocol that NSWorkspace should use to talk to it. I don't see any reason why we need to design the whole thing at once though. We could just add methods as we want to implement them. What do you think are the most important operations that should be handled centrally?

There are not many operations.
Besides -performFileOperation::::: and - selectFile:inFileViewerRootedAtPath: that are already performed in the workspace application, I've implemented the following methods that seem to cover all the needed operations:

-openFile:withApplication:andDeactivate:
(in NSWorkspace this is called also by:
    -openFile:withApplication:
    -openFile:
    -openFile:fromImage:at:inView:)

-launchApplication:showIcon:autolaunch:
(in NSWorkspace this is called also by:
    -launchApplication:)

-openTempFile:

-_launchApplication:arguments:

-launchedApplications

I've also -extendPowerOffBy: but, for the moment, it does nothing.

I've made sure that all those (with the exception of the private _launchApplication:arguments: method) try to ask the workspace manager for the information.
I also made -activeApplication query the workspace manager.

There is only a little problem:
NSWorkspace, in -_workspaceApplication, if its instance has been created by the 
the workspace application itself, returns nil; but there are many places in 
GWorkspace where [NSWorkspace sharedWorkspace] is used for icons, for methods 
as -getInfoForFile:application:type: but also for launching an application or 
for opening files. With the current implementation I should change [NSWorkspace 
sharedWorkspace] with [GWorkspace gworkspace] in tens of places. Moreover, 
GWorkspace is made by various frameworks, bundles and classes where the 
GWorkspace class is not visible.
What do you think about adding to the workspace application "protocol" a 
"+sharedInstance" class method to be called in -_workspaceApplication? With this solution 
-_workspaceApplication would return the local instance, avoiding any recursion.
Something like [[[NSBundle mainBundle] principalClass] sharedInstance].

All this stuff is already on CVS but it's untested because today I've not had the time for building -gui with a modified NSWorkspace.

I wrote a trivial tool 'gcloseall' to call -launchedApplications then iterate through the returned array terminating all the applications. When I ran it without GWorkspace running (so it used the fallback mechanism) it worked fine.

When I ran it with GWorkspace running, it received an array containing only the information for Gorm (as long as Gorm was running) ... but not the information for Ink and GSFractal (which were also running) or for the second copy of Gorm, so I think it needs some debugging yet. Also I noticed that the information I did get (for Gorm) lacked the application path and process identifier.

These will be fixed in the next days, using also the new NSApplication 
notifications. (hoping that the tomorrow SVN switch will not give too much 
problems...)

Perhaps you could add in NSWorkspace.m a declaration of an informal protocol to be used only as a reference for who wants to write other workspace applications/daemons.

Or perhaps just listing the methods in the documentation?





reply via email to

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