Debian Codegraph @

gdk/quartz/gdkspawn-quartz.c

raw
1 /*
2 * Copyright (C) 2003 Sun Microsystems Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 *
19 * Authors: Mark McLoughlin <[email protected]>
20 */
21
22 #include "config.h"
23
24 #include "gdkspawn.h"
25
26 #include <glib.h>
27 #include <gdk/gdk.h>
28
29 gboolean
30 gdk_spawn_on_screen (GdkScreen *screen,
31 const gchar *working_directory,
32 gchar **argv,
33 gchar **envp,
34 GSpawnFlags flags,
35 GSpawnChildSetupFunc child_setup,
36 gpointer user_data,
37 gint *child_pid,
38 GError **error)
39 {
40 g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
41 g_assert (sizeof(GPid) == sizeof(int));
42
43 return g_spawn_async (working_directory,
44 argv,
45 envp,
46 flags,
47 child_setup,
48 user_data,
49 (GPid*)child_pid,
50 error);
51 }
52
53 gboolean
54 gdk_spawn_on_screen_with_pipes (GdkScreen *screen,
55 const gchar *working_directory,
56 gchar **argv,
57 gchar **envp,
58 GSpawnFlags flags,
59 GSpawnChildSetupFunc child_setup,
60 gpointer user_data,
61 gint *child_pid,
62 gint *standard_input,
63 gint *standard_output,
64 gint *standard_error,
65 GError **error)
66 {
67 g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
68 g_assert (sizeof(GPid) == sizeof(int));
69
70 return g_spawn_async_with_pipes (working_directory,
71 argv,
72 envp,
73 flags,
74 child_setup,
75 user_data,
76 (GPid*)child_pid,
77 standard_input,
78 standard_output,
79 standard_error,
80 error);
81 }
82
83 gboolean
84 gdk_spawn_command_line_on_screen (GdkScreen *screen,
85 const gchar *command_line,
86 GError **error)
87 {
88 gchar **argv = NULL;
89 gboolean retval;
90
91 g_return_val_if_fail (command_line != NULL, FALSE);
92
93 if (!g_shell_parse_argv (command_line,
94 NULL, &argv,
95 error))
96 return FALSE;
97
98 retval = gdk_spawn_on_screen (screen,
99 NULL, argv, NULL,
100 G_SPAWN_SEARCH_PATH,
101 NULL, NULL, NULL,
102 error);
103 g_strfreev (argv);
104
105 return retval;
106 }