2006-05-21 11:18:11 -05:00
|
|
|
/*
|
2006-08-20 03:49:03 -05:00
|
|
|
* moospawn.h
|
2005-11-28 02:12:50 +00:00
|
|
|
*
|
2010-12-21 20:15:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2005-11-28 02:12:50 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* This file is part of medit. medit is free software; you can
|
|
|
|
* redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License,
|
|
|
|
* or (at your option) any later version.
|
2005-11-28 02:12:50 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
2005-11-28 02:12:50 +00:00
|
|
|
*/
|
|
|
|
|
2007-04-12 10:31:28 -05:00
|
|
|
#ifndef MOO_SPAWN_H
|
|
|
|
#define MOO_SPAWN_H
|
2005-11-28 02:12:50 +00:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2006-08-20 03:49:03 -05:00
|
|
|
#define MOO_TYPE_CMD (_moo_cmd_get_type ())
|
2005-11-28 02:12:50 +00:00
|
|
|
#define MOO_CMD(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_CMD, MooCmd))
|
|
|
|
#define MOO_CMD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_CMD, MooCmdClass))
|
|
|
|
#define MOO_IS_CMD(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_CMD))
|
|
|
|
#define MOO_IS_CMD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_CMD))
|
|
|
|
#define MOO_CMD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_CMD, MooCmdClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _MooCmd MooCmd;
|
|
|
|
typedef struct _MooCmdPrivate MooCmdPrivate;
|
|
|
|
typedef struct _MooCmdClass MooCmdClass;
|
|
|
|
|
2005-11-29 17:33:44 +00:00
|
|
|
/* XXX BUFFERED */
|
2005-11-28 02:12:50 +00:00
|
|
|
typedef enum {
|
|
|
|
MOO_CMD_COLLECT_STDOUT = 1 << 0,
|
|
|
|
MOO_CMD_COLLECT_STDERR = 1 << 1,
|
|
|
|
MOO_CMD_STDOUT_TO_PARENT = 1 << 2,
|
|
|
|
MOO_CMD_STDERR_TO_PARENT = 1 << 3,
|
2006-05-23 12:27:28 -05:00
|
|
|
MOO_CMD_UTF8_OUTPUT = 1 << 4,
|
|
|
|
MOO_CMD_OPEN_CONSOLE = 1 << 5
|
2005-11-28 02:12:50 +00:00
|
|
|
} MooCmdFlags;
|
|
|
|
|
|
|
|
struct _MooCmd
|
|
|
|
{
|
2006-08-20 03:49:03 -05:00
|
|
|
GObject base;
|
2005-11-28 02:12:50 +00:00
|
|
|
MooCmdPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooCmdClass
|
|
|
|
{
|
2006-08-20 03:49:03 -05:00
|
|
|
GObjectClass base_class;
|
2005-11-28 02:12:50 +00:00
|
|
|
|
|
|
|
/* action signal */
|
|
|
|
gboolean (*abort) (MooCmd *cmd);
|
|
|
|
|
|
|
|
gboolean (*cmd_exit) (MooCmd *cmd,
|
|
|
|
int status);
|
2006-09-02 02:33:09 -05:00
|
|
|
gboolean (*stdout_line) (MooCmd *cmd,
|
|
|
|
const char *line);
|
|
|
|
gboolean (*stderr_line) (MooCmd *cmd,
|
|
|
|
const char *line);
|
2005-11-28 02:12:50 +00:00
|
|
|
};
|
|
|
|
|
2010-11-11 22:19:50 -08:00
|
|
|
#ifdef MOO_PATCHED_G_SPAWN_WIN32_HIDDEN_CONSOLE
|
|
|
|
#define MOO_SPAWN_WIN32_HIDDEN_CONSOLE G_SPAWN_WIN32_HIDDEN_CONSOLE
|
|
|
|
#else
|
|
|
|
#define MOO_SPAWN_WIN32_HIDDEN_CONSOLE 0
|
|
|
|
#endif
|
2005-11-28 02:12:50 +00:00
|
|
|
|
2006-08-20 03:49:03 -05:00
|
|
|
GType _moo_cmd_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
MooCmd *_moo_cmd_new (const char *working_dir,
|
2005-11-28 02:12:50 +00:00
|
|
|
char **argv,
|
|
|
|
char **envp,
|
|
|
|
GSpawnFlags flags,
|
|
|
|
MooCmdFlags cmd_flags,
|
|
|
|
GSpawnChildSetupFunc child_setup,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
2006-08-20 03:49:03 -05:00
|
|
|
void _moo_cmd_abort (MooCmd *cmd);
|
2005-11-28 02:12:50 +00:00
|
|
|
|
2006-08-31 01:26:26 -05:00
|
|
|
gboolean _moo_unix_spawn_async (char **argv,
|
|
|
|
GSpawnFlags g_flags,
|
|
|
|
GError **error);
|
|
|
|
char **_moo_env_add (char **add);
|
|
|
|
|
2005-11-28 02:12:50 +00:00
|
|
|
|
2010-12-27 20:31:05 -08:00
|
|
|
gboolean moo_spawn_command_line_async_with_flags (const gchar *command_line,
|
|
|
|
GSpawnFlags g_flags,
|
|
|
|
GError **error);
|
|
|
|
|
2005-11-28 02:12:50 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2007-04-12 10:31:28 -05:00
|
|
|
#endif /* MOO_SPAWN_H */
|