## AnjutaLauncher

AnjutaLauncher —

##

# Synopsis

    struct      AnjutaLauncher;
    struct      AnjutaLauncherClass;
    struct      AnjutaLauncherPriv;
    enum        AnjutaLauncherOutputType;
    void        (*AnjutaLauncherOutputCallback) (AnjutaLauncher *launcher,
                                                 AnjutaLauncherOutputType output_type,
                                                 const gchar *chars,
                                                 gpointer user_data);
    AnjutaLauncher* anjuta_launcher_new         (void);
    gboolean    anjuta_launcher_is_busy         (AnjutaLauncher *launcher);
    gboolean    anjuta_launcher_execute         (AnjutaLauncher *launcher,
                                                 const gchar *command_str,
                                                 AnjutaLauncherOutputCallback callback,
                                                 gpointer callback_data);
    gboolean    anjuta_launcher_execute_v       (AnjutaLauncher *launcher,
                                                 gchar *const argv[],
                                                 AnjutaLauncherOutputCallback callback,
                                                 gpointer callback_data);
    gboolean    anjuta_launcher_set_encoding    (AnjutaLauncher *launcher,
                                                 const gchar *charset);
    void        anjuta_launcher_send_stdin      (AnjutaLauncher *launcher,
                                                 const gchar *input_str);
    void        anjuta_launcher_send_ptyin      (AnjutaLauncher *launcher,
                                                 const gchar *input_str);
    gint        anjuta_launcher_get_child_pid   (AnjutaLauncher *launcher);
    void        anjuta_launcher_reset           (AnjutaLauncher *launcher);
    void        anjuta_launcher_signal          (AnjutaLauncher *launcher,
                                                 int sig);
    void        anjuta_launcher_set_buffered_output
                                                (AnjutaLauncher *launcher,
                                                 gboolean buffered);
    void        anjuta_launcher_set_check_passwd_prompt
                                                (AnjutaLauncher *launcher,
                                                 gboolean buffered);
    gboolean    anjuta_launcher_set_terminal_echo
                                                (AnjutaLauncher *launcher,
                                                 gboolean echo_on);

## Object Hierarchy

      GObject
       +----AnjutaLauncher

## Signal Prototypes

    "busy"      void        user_function      (AnjutaLauncher *anjutalauncher,
                                                gboolean arg1,
                                                gpointer user_data);
    "child-exited"
                void        user_function      (AnjutaLauncher *anjutalauncher,
                                                gint arg1,
                                                gint arg2,
                                                gulong arg3,
                                                gpointer user_data);

## Description

## Details

### struct AnjutaLauncher

    struct AnjutaLauncher;

### struct AnjutaLauncherClass

    struct AnjutaLauncherClass {

        GObjectClass parent_class;

    	/* Signals */
    	void (*child_exited_signal) (AnjutaLauncher *launcher,
    								 int child_pid, int exit_status,
    								 gulong time_taken_in_seconds);
    	void (*busy_signal) (AnjutaLauncher *launcher, gboolean busy_flag);
    };

### struct AnjutaLauncherPriv

    struct AnjutaLauncherPriv;

### enum AnjutaLauncherOutputType

    typedef enum {
    	ANJUTA_LAUNCHER_OUTPUT_STDOUT,
    	ANJUTA_LAUNCHER_OUTPUT_STDERR,
    	ANJUTA_LAUNCHER_OUTPUT_PTY
    } AnjutaLauncherOutputType;

### AnjutaLauncherOutputCallback ()

    void        (*AnjutaLauncherOutputCallback) (AnjutaLauncher *launcher,
                                                 AnjutaLauncherOutputType output_type,
                                                 const gchar *chars,
                                                 gpointer user_data);

`launcher` : |
`output_type` : |
`chars` : |
`user_data` : |

### anjuta_launcher_new ()

    AnjutaLauncher* anjuta_launcher_new         (void);

Sets if input (those given in STDIN) should enabled or disabled. By default, it is disabled.

Returns : | a new instance of AnjutaLancher class.

### anjuta_launcher_is_busy ()

    gboolean    anjuta_launcher_is_busy         (AnjutaLauncher *launcher);

Tells if the laucher is currently executing any command.

`launcher` : | a AnjutaLancher object.
Returns : | TRUE if launcher is busy, otherwisee FALSE.

### anjuta_launcher_execute ()

    gboolean    anjuta_launcher_execute         (AnjutaLauncher *launcher,
                                                 const gchar *command_str,
                                                 AnjutaLauncherOutputCallback callback,
                                                 gpointer callback_data);

Executes a command in the launcher. Both outputs (STDOUT and STDERR) are delivered to the above callback. The data are delivered as they arrive from the process and could be of any lenght. If the process asks for passwords, the user will be automatically prompted with a dialog to enter it. Please note that not all formats of the password are recognized. Those with the standard 'assword:' substring in the prompt should work well.

`launcher` : | a AnjutaLancher object.
`command_str` : | The command to execute.
`callback` : | The callback for delivering output from the process.
`callback_data` : | Callback data for the above callback.
Returns : | TRUE if successfully launched, otherwise FALSE.

### anjuta_launcher_execute_v ()

    gboolean    anjuta_launcher_execute_v       (AnjutaLauncher *launcher,
                                                 gchar *const argv[],
                                                 AnjutaLauncherOutputCallback callback,
                                                 gpointer callback_data);

The first of the `args` is the command itself. The rest are sent to the as it's arguments. This function works similar to `anjuta_launcher_execute()`.

`launcher` : | a AnjutaLancher object.
`argv` : | Command args.
`callback` : | The callback for delivering output from the process.
`callback_data` : | Callback data for the above callback.
Returns : | TRUE if successfully launched, otherwise FALSE.

### anjuta_launcher_set_encoding ()

    gboolean    anjuta_launcher_set_encoding    (AnjutaLauncher *launcher,
                                                 const gchar *charset);

Sets the character set to use for Input/Output with the process.

`launcher` : | a AnjutaLancher object.
`charset` : | Character set to use for Input/Output with the process.
Returns : | TRUE if successful, otherwise FALSE.

### anjuta_launcher_send_stdin ()

    void        anjuta_launcher_send_stdin      (AnjutaLauncher *launcher,
                                                 const gchar *input_str);

Sends a string to Standard input of the process currently being executed.

`launcher` : | a AnjutaLancher object.
`input_str` : | The string to send to STDIN of the process.

### anjuta_launcher_send_ptyin ()

    void        anjuta_launcher_send_ptyin      (AnjutaLauncher *launcher,
                                                 const gchar *input_str);

Sends a string to TTY input of the process currently being executed. Mostly useful for entering passwords and other inputs which are directly read from TTY input of the process.

`launcher` : | a AnjutaLancher object.
`input_str` : | The string to send to PTY of the process.

### anjuta_launcher_get_child_pid ()

    gint        anjuta_launcher_get_child_pid   (AnjutaLauncher *launcher);

Gets the Process ID of the child being executed.

`launcher` : | a AnjutaLancher object.
Returns : | Process ID of the child.

### anjuta_launcher_reset ()

    void        anjuta_launcher_reset           (AnjutaLauncher *launcher);

Resets the launcher and kills (SIGTERM) current process, if it is still executing.

`launcher` : | a AnjutaLancher object.

### anjuta_launcher_signal ()

    void        anjuta_launcher_signal          (AnjutaLauncher *launcher,
                                                 int sig);

Sends a kernel signal to the process that is being executed.

`launcher` : | a AnjutaLancher object.
`sig` : | kernel signal ID (e.g. SIGTERM).

### anjuta_launcher_set_buffered_output ()

    void        anjuta_launcher_set_buffered_output
                                                (AnjutaLauncher *launcher,
                                                 gboolean buffered);

`launcher` : |
`buffered` : |

### anjuta_launcher_set_check_passwd_prompt ()

    void        anjuta_launcher_set_check_passwd_prompt
                                                (AnjutaLauncher *launcher,
                                                 gboolean buffered);

`launcher` : |
`buffered` : |

### anjuta_launcher_set_terminal_echo ()

    gboolean    anjuta_launcher_set_terminal_echo
                                                (AnjutaLauncher *launcher,
                                                 gboolean echo_on);

`launcher` : |
`echo_on` : |
Returns : |

## Signals

### The "busy" signal

    void        user_function                  (AnjutaLauncher *anjutalauncher,
                                                gboolean arg1,
                                                gpointer user_data);

`anjutalauncher` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "child-exited" signal

    void        user_function                  (AnjutaLauncher *anjutalauncher,
                                                gint arg1,
                                                gint arg2,
                                                gulong arg3,
                                                gpointer user_data);

`anjutalauncher` : | the object which received the signal.
`arg1` : |
`arg2` : |
`arg3` : |
`user_data` : | user data set when the signal handler was connected.