gdesktopappinfo: Add g_desktop_app_info_launch_uris_as_manager()

A new GDesktopAppInfo specific function which provides more control
over launched processes.  Intended basically only for use in GNOME
Shell, where we want:

*) To directly know the GPid for each launched program, without
   having to listen to a DBus signal emitted in our own process
*) Possibly control over the process environment; for example,
   we may want to call setsid() or redirect file descriptors.

And in the future:
*) To avoid recursively calling ourself via DBus, when a later
   patch causes g_app_info_launch() to indirect via the shell.

https://bugzilla.gnome.org/show_bug.cgi?id=606960
This commit is contained in:
Colin Walters
2010-12-20 14:48:53 -05:00
parent bb6c44b9d3
commit e6546debd6
2 changed files with 108 additions and 5 deletions

View File

@@ -93,6 +93,30 @@ GType g_desktop_app_info_lookup_get_type (void) G_GNUC_CON
GAppInfo *g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
const char *uri_scheme);
/**
* GDesktopAppLaunchCallback:
* @appinfo: a #GDesktopAppInfo
* @pid: Process identifier
* @user_data: User data
*
* During invocation, g_desktop_app_info_launch_uris_as_manager() may
* create one or more child processes. This callback is invoked once
* for each, providing the process ID.
*/
typedef void (GDesktopAppLaunchCallback) (GDesktopAppInfo *appinfo,
GPid pid,
gpointer user_data);
gboolean g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GSpawnFlags spawn_flags,
GSpawnChildSetupFunc setup,
gpointer user_setup_data,
GDesktopAppLaunchCallback callback,
gpointer pid_callback_data,
GError **error);
#endif /* G_DISABLE_DEPRECATED */
G_END_DECLS