util: add Util.spawn and friends

Add Util.spawn, Util.spawnCommandLine, and Util.spawnDesktop for
spawning a command/argv/.desktop file in the background, automatically
handling errors via MessageTray.SystemNotificationSource(), and
Util.trySpawn, Util.trySpawnCommandLine, and Utils.trySpawnDesktop
that don't do automatic error handling (but do at least clean up the
error message in the exception a bit).

Update various other bits of code around the shell to use the new
methods.

https://bugzilla.gnome.org/show_bug.cgi?id=635089
This commit is contained in:
Dan Winship
2010-11-17 11:43:08 -05:00
parent a65a0f03d4
commit 8bdfb8df68
10 changed files with 158 additions and 42 deletions

View File

@ -14,6 +14,7 @@ const _ = Gettext.gettext;
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const Search = imports.ui.search;
const Util = imports.misc.util;
const NAUTILUS_PREFS_DIR = '/apps/nautilus/preferences';
const DESKTOP_IS_HOME_KEY = NAUTILUS_PREFS_DIR + '/desktop_is_home_dir';
@ -163,7 +164,7 @@ PlacesManager.prototype = {
icon_size: size });
},
function () {
new Shell.Process({ args: ['nautilus-connect-server'] }).run();
Util.spawn(['nautilus-connect-server']);
});
let networkApp = null;